For example, say we typed the following script into a file called MyScript.lua (just a text file containing this script, created with notepad or some other text editor):
Dialog.Message("Hello", "World");
Now we drag and drop the file onto AutoPlay Media Studio's main window. (This will copy the file into the project's Scripts folder.) A dialog will appear that asks if we want to add a require line to our global script. Click "No" for now. We will explain the require statement later.
Now, wherever we add the following line of script to an event:
dofile(_SourceFolder.."\\AutoPlay\\Scripts\\MyScript.lua");
...that script file will be read in and executed immediately. In this case, you would see a message box with the friendly "hello world" message.
Tip: Use the dofile function to save yourself from having to re-type or re-paste a script into your projects over and over again.
require