Tylorfoot Teaches Scripting Part 1: Defining Scripts

[TylFT] Tylorfoot
Joined 03/06/2017
Posts 6,581
04:56 AM 27/02/2019
Yes, I made a scripting tutorial. Might not be a good one, but I hope it helps anyways,
The scripting language is Game Maker Language, if you didn't know.

In Brick-Hill, almost all scripts are defined as strings.
------------------
string = '
messageAll("this is a string, inside a string. be careful with these.");
';
execute_string(string);
------------------

First, you define the "variable" that will hold the contents of the script. Something like this would work: string = '
Then you can type out the contents of the script itself.
Finally, you close it off, with this: ';
Whenever you want to execute the script, use execute_string() and add the variable that has the script (string in this case) inside the parenthesis.
It should be noted that the string doesn't have to be in a single quote, however in my opinion its preferred.

Next, we will learn how to loop.
This can be usually achieved with the schedule(); function.
Just add this to the end of the script "string": schedule(5000,string)
Where 5000 is the amount of milliseconds until the script is executed again, and where string is the script executed. (string is an example, change it to whatever "variable" the function is in)
------------------
string = '
messageAll("this is a string, inside a string. be careful with these.");
schedule(5000,string)
';
execute_string(string);
------------------
Finally, events.
Events are a little more complicated.
There can be only one of each type in your game.
Example: you can have a onPlayerTouch event and a onGameConnection event
But you cant have more then one of these in your game, because the first event will be overwritten.
Defining them is the same, but you have to do this before the other steps:
------------------
s = define("onGameConnection")
s.script = '
------------------
Define the event itself, then the script that the event will execute.
This can also be used to create custom "functions".
Also: If you ever wanted to execute a script defined this way manually, you can do this: execute("yeetus")
Events also have arguments attached to them, but that will be covered soonTM.

Well I hope I didn't completely get all the facts wrong, see you when the sun explodes!


[BHIA] Perfect
Joined 02/12/2017
Posts 5,178
05:02 AM 27/02/2019
This is very nice


[USSR] instinctive_undertow
Joined 09/02/2019
Posts 7,893
05:03 AM 27/02/2019
Noice duuude.


jiggleballs69420
Joined 18/03/2018
Posts 7,974
05:08 AM 27/02/2019
nice


[03] Dose Of Crown
Joined 25/02/2019
Posts 3,163
04:45 PM 27/02/2019
10/10 tho i got this class privately this is still pretty gucci


[Pewds] 6bit
Joined 05/02/2019
Posts 2,120
10:14 PM 06/03/2019
Thank you very cool


[P00R] Doom Marine
Joined 31/07/2018
Posts 4,461
01:03 PM 21/03/2019
Thanks Tylor


[SC] blu
Joined 22/09/2017
Posts 3,018
02:43 PM 24/03/2019
http://pastebin.com/raw/hyeQ4E9g
very helpful, contains all docs used in scripting.

1