Difference between revisions of "MessageBox Tutorial"

Jump to navigation Jump to search
2,445 bytes added ,  12:26, 24 August 2007
Example spell script added to MessageBox tutorial
imported>ShadowDancer
imported>ShadowDancer
(Example spell script added to MessageBox tutorial)
End</pre>
I suggest using numbers instead of other variables when setting '''''Choosing'''''. Numbers give more meaning than words in this case, as the negative and positive numbers separate which part of the menu you're dealing with. You can also use numbers to signify which layer of the menu you are in. For instance, '''''-1''''' was the first layer in the above example. For the sub-menus of the main menu (Gold, Food, Blood), you can use '''''-11''''', '''''-12''''', '''''-13'''''. And, for example, for the sub-menus of Food you can use '''''-121''''', '''''-122''''', '''''-123''''' such that the first number signifies the menu of the first layer, the second the menu of the second layer, etc.
 
===Multiple Menus in a Spell Script===
Below is an example of multiple menus in a spell script. '''Step''' is used to control the stages of [[ScriptEffectUpdate]] for the '''MessageBox''' and the '''GetButtonPressed''' functions. While the initial '''MessageBox''' for the spell could have been in the [[ScriptEffectStart]], it is in the '''ScriptEffectUpdate''' block for clarity. Most of the button names as well as scripting have been left out so that the basics of manipulating multiple '''MessageBox''' functions can be seen.
 
<pre> ScriptName ExampleScript
Short Step
Short ButtonChoice1
Short ButtonChoice2
{Set Other Variables}
Begin ScriptEffectStart
{Set up start of Spell}
Set Step to 1
End
Begin ScriptEffectUpdate
If Step == 1
Messagebox "What do you want to do?", ["Button0"], ..., ["Button8"], "Next Page"
Set Step to 2
EndIf
If Step == 2
Set ButtonChoice1 to GetButtonPressed
If ButtonChoice1 == 0
{script to do whatever button is for}
Set Step to 0
ElseIf ButtonChoice1 == 1
{script to do whatever button is for}
Set Step to 0
ElseIf ButtonChoice1 == 2
{script to do whatever button is for}
Set Step to 0
ElseIf ButtonChoice1 == 3
{script to do whatever button is for}
Set Step to 0
ElseIf ButtonChoice1 == 4
{script to do whatever button is for}
Set Step to 0
ElseIf ButtonChoice1 == 5
{script to do whatever button is for}
Set Step to 0
ElseIf ButtonChoice1 == 6
{script to do whatever button is for}
Set Step to 0
ElseIf ButtonChoice1 == 7
{script to do whatever button is for}
Set Step to 0
ElseIf ButtonChoice1 == 8
{script to do whatever button is for}
Set Step to 0
ElseIf ButtonChoice1 == 9
Set Step to 3
EndIf
EndIf
If Step == 3
Messagebox "What do you want to do?", ["Button0"], ..., ["Button2"], "Quit"
Set Step to 4
EndIf
If Step == 4
Set ButtonChoice2 to GetButtonPressed
If ButtonChoice2 == 0
{script to do whatever button is for}
Set Step to 0
ElseIf ButtonChoice2 == 1
{script to do whatever button is for}
Set Step to 0
ElseIf ButtonChoice2 == 2
{script to do whatever button is for}
Set Step to 0
ElseIf ButtonChoice2 == 3
Set Step to 0
EndIf
EndIf
End</pre>
 
'''Notes:'''
Anonymous user

Navigation menu