Difference between revisions of "MessageBox Tutorial"
Jump to navigation
Jump to search
→Multiple Menus in a Spell Script: That should work
imported>ShadowDancer m (→Starting the whole thing: linking) |
imported>Haama (→Multiple Menus in a Spell Script: That should work) |
||
|
===Multiple Menus in a Spell Script===
A spell presents several challenges for multiple menus, but it can be done. Most importantly, you will need to set a high duration on the spell (see [[GetButtonPressed#GameMode or MenuMode?]]). However, the player could still open enough menus to run down the duration, no matter how long. To cover this scenario, all of the menu variables will be copied to a persistent object (in this case, the quest MenuVariables) when the spell runs out, and the spell will be recast.
This leads to one more small problem - if the variables are left set, then every time the spell is cast the menu would start more it left off before (well, ok, this could be cool, but I'll assume it's undesirable). To solve this, all of the external menu variables will be reset when the player exits the menu.
Note also that, as of now, this hasn't been tested for multiple menus.
The quest script:
<pre>scn MenuVariablesScript
Short Choosing
Short Choice</pre>
The spell script:
<pre>Short Choosing
Short Choice
if MenuVariables.Choosing
Set Choosing to MenuVariables.Choosing
Set Choice to MenuVariables.Choice
else
Set Choosing to -1
endif
End
Begin SpellEffectUpdate
If (Choosing == 0) ;meaning it shouldn't be running
set MenuVariables.Choosing to 0
set
Return
Elseif (Choosing == -1) ;Display your menu
Messagebox "What do you want to do?", ["Button0"], ..., ["Button8"], "Next Page"
Set Choice to GetButtonPressed
Return
Elseif (Choosing == 1)
If (Choice == -1) ;No choice yet
Return
Elseif (Choice == 0) ;Button0
;Whatever
...
Elseif (Choice ==
;Whatever you want to do
Set
Elseif (Choice ==
Set Choosing to -2 ;Following menu (choosing == -2)
Endif
Elseif (Choosing == -2) ;Gold menu
Messagebox "What do you want to do?", ["Button0"], ..., ["Button8"], "Exit"
Set Choosing to 2
Elseif
If (Choice == -1) ;No choice yet
Set Choice to GetButtonPressed
Elseif (Choice == 0) ;Button0
;Whatever
...
Elseif (Choice ==
;Whatever you want to do
Set
Elseif (Choice ==
Set Choosing to 0 ;to close the menus
Endif
Endif
End
begin ScriptEffectFinish
if Choosing
set MenuVariables.Choosing to Choosing
set MenuVariables.Choice to Choice
player.Cast Spell
endif
end</pre>
'''Notes:'''
| |||