Difference between revisions of "MessageBox Tutorial"

136 bytes added ,  17:46, 26 August 2007
imported>Haama
imported>Haama
Line 32: Line 32:
elseif (Choice == 0)</pre>
elseif (Choice == 0)</pre>


===Which Block to run MessageBox and GetButtonPressed?===
===Timing===
MessageBox takes one frame to display, so you can use any [[:Category:Blocktypes|block]] to display it. However, GetButtonPressed needs to be in a block that continuously runs (i.e., [[GameMode]], [[MenuMode]], [[ScriptEffectUpdate]]) and needs to be on a script that is running every frame (i.e., an activator that is in a loaded cell, a quest running every .001 seconds, etc.), until it returns the player's button press. This is necessary as it will take more than a frame for the player to read the menu and make a decision (as well as some other peculiarities).
MessageBox takes one frame to display, so you can use any [[:Category:Blocktypes|block]] to display it. However, it can take up to 15 frames before GetButtonPressed will return the player's button press (even if the player presses the button on the same frame as the MessageBox function). Therefore, it needs to be in a block that runs every frame, such as [[GameMode]], [[MenuMode]], and [[ScriptEffectUpdate]]. It also needs to be on a script that is running every frame. For objects this means it must be in a [[Loaded]] cell, for quests this means [[Special variables#Locals|fQuestDelayTime]] must be set to .001 and they must be running, and for spells this means the duration must be long enough (more on that in the Spell Menus subsection).


===Keep 'em separated===
===Keep 'em separated===
Anonymous user