learngs2:whatjusthappened

What Just Happened

Assuming everything just ran successfully, Graal took your script, compiled and executed it! Let's break it down:

function onCreated - All code should be contained within functions that can be executed. onCreated is a default function that will be executed the first time the function is created. In our case, this is whenever we first create the weapon, update the weapon or if the server is restarted

{ } - We wrap all code within these curly braces. By putting all our code within function onCreated() { …. } , it's saying that particular code belongs to the onCreated function. The code will only be executed if onCreated is called

echo() - This is an inbuilt Graal function that will print out the message that it is passed to it. For now, the message will be visible in the Remote Control chat window but this can differ

“Hello, World!” - This is the string value we passed to the echo() function to be printed. You could change this to any message you would like. It does not always need to be predefined text like this but we will come to that soon

Again I really want to point out that you needn't worry if you aren't completely understanding everything right now. It should hopefully make more sense the more we play around with it!

  • learngs2/whatjusthappened.txt
  • Last modified: 2023/02/24 12:23
  • by twinny