Difference between revisions of "Common Mistakes"

Jump to navigation Jump to search
5 bytes removed ,  16:15, 17 October 2007
→‎Common MessageBox Mistakes: fix bbcode formatting
imported>Dev akm
imported>Dev akm
(→‎Common MessageBox Mistakes: fix bbcode formatting)
Line 138: Line 138:


#The script has to run every frame to catch the button press. For persistent objects (activators, containers, tokens, etc.) this means the object needs to be loaded in memory (i.e., in the same cell as the player). For quests, this means you have to set fQuestDelayTime to a low number, like .001. For all of them, you also have to place the code inside a blocktype that runs every frame (i.e., [[GameMode]], [[MenuMode]])
#The script has to run every frame to catch the button press. For persistent objects (activators, containers, tokens, etc.) this means the object needs to be loaded in memory (i.e., in the same cell as the player). For quests, this means you have to set fQuestDelayTime to a low number, like .001. For all of them, you also have to place the code inside a blocktype that runs every frame (i.e., [[GameMode]], [[MenuMode]])
#If you plan on having multiple menus displayed from one script, you need to use a governing variable to tell which menu you're currently displaying. For instance, make a [b]short MenuShowing[/b] variable and set it to 1 to display your first menu, and 2 to display the second menu.
#If you plan on having multiple menus displayed from one script, you need to use a governing variable to tell which menu you're currently displaying. For instance, make a '''short MenuShowing''' variable and set it to 1 to display your first menu, and 2 to display the second menu.
#If any part of your code after the button catch (that is, after [b]if (Button > -1)[/b]) requires more than one frame to process, and you've set up your code to set the button variable every frame, such as:
#If any part of your code after the button catch (that is, after '''if (Button > -1)''') requires more than one frame to process, and you've set up your code to set the button variable every frame, such as:
<pre>...
<pre>...
if (MenuShowing == -1)
if (MenuShowing == -1)
Line 149: Line 149:
if (Button == 0)
if (Button == 0)
...</pre>
...</pre>
then you need to change it to catch the button only when the player's decision hasn't been caught yet [i]and[/i] make sure to reset Button after displaying the menu:
then you need to change it to catch the button only when the player's decision hasn't been caught yet ''and'' make sure to reset Button after displaying the menu:
<pre>...
<pre>...
if (MenuShowing == -1)
if (MenuShowing == -1)
Anonymous user

Navigation menu