use (add) Functions:
(see this thread too:
viewtopic.php?f=10&t=5018&p=34407#p34401 )
a Function holds scripts: think of a Function as a basket~grouping (or if you're familiar with some basic programming: Functions = Batches = Macros), which can hold just a single script or many scripts.
Also, another great benefit of using Functions, you can loop them (individual Functions) on themselves, while also continuing your chain of scripting too:
(in code, sorry, but it's fast~easy for me to do it this way, lol)
<function name="character_creation_function">
age_function
</function>
<function name="age_function"><![CDATA[
msg ("What is your name?")
get input {
if (IsInt (result) and ToInt (result) > 0) {
player.age_integer = ToInt (result)
gender_function
} else {
age_function
}
}
</function>
<function name="gender_function">
show menu ("What is your gender?, split ("male;female", ";"), false) {
player.gender_string = ToString (result)
}
</function>
In the GUI~Editor: Add Function and to 'goto' different Functions, you add in the 'call function ~ call upon function' Script, and just type in the Function's name into the text box, that you want to goto, you can ignore adding in parameters, as this is a bit more advanced, unless you already understand their usage, then go ahead and do so as you might need to.
unfortunately, I am still a bit confused about the 'order of operations' with scripting, so the way that works best is this:
Function1
on ready { // you'll have to code this in, as I'm not sure if and or where it is in the GUI~Editor
-> Function2
-> on ready {
->-> Function3
->-> on ready {
->->-> Function4
->-> }
-> }
}
unfortunately, if you got script layers within the Functions, it's more difficult to get it to work:
Function1A
-> Script1A
-> wait { // or 'get input' or 'show menu'
->-> Script2A
->-> wait {
->->-> Script3A
->-> }
-> }
on ready {
-> Function2B
->-> Script1B
->-> wait {
->->-> Script2B
->-> }
}
// ERROR
// you're going to have multiple scripts and the 'wait' Scripts running at the same time, which they can't do... thus the ERROR.
thus, the best way is again (still not easy to get it to be set up like this... sighs):
Function1A
-> Script1A
-> wait { // or 'get input' or 'show menu'
->-> Script2A
->-> wait {
->->-> Script3A
->->-> on ready {
->->->-> Function2B
->->->->-> Script1B
->->->->-> wait {
->->->->->-> Script2B
->->->->-> }
->->-> }
->-> }
-> }
in code:
(this will, err I hope should lol, work)
<function name="function_1">
msg ("1")
wait {
msg ("2")
wait {
msg ("3")
wait {
function_2
}
}
}
</function>
<function name="function_2">
msg ("4")
wait {
msg ("5")
wait {
msg ("6")
wait {
function_3
}
}
}
</function>
<function name="function_3">
msg ("7")
wait {
msg ("8")
wait {
msg ("9")
wait {
msg ("10")
}
}
}
</function>