Difference between revisions of "Category:Troubleshooting"

1,392 bytes added ,  11:27, 14 July 2007
Added Common MessageBox Mistakes
imported>Dev akm
imported>Haama
(Added Common MessageBox Mistakes)
Line 214: Line 214:
your script will save, but won't run in game. You have to use the [[GetGameSetting]] function, as such:
your script will save, but won't run in game. You have to use the [[GetGameSetting]] function, as such:
<pre>set SomeVar to (GetGameSetting fiSomeGameSetting)</pre>
<pre>set SomeVar to (GetGameSetting fiSomeGameSetting)</pre>
== Common MessageBox Mistakes ==
#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.
#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 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:
<pre>...
if (MenuShowing == -1)
  MessageBox ...
  set MenuShowing to 1
elseif (MenuShowing == 1)
  set Button to GetButtonPressed
  if (Button > -1)
if (Button == 0)
...</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:
<pre>...
if (MenuShowing == -1)
  MessageBox ...
  set MenuShowing to 1
  set Button to GetButtonPressed
elseif (MenuShowing == 1)
  if (Button == -1)
set Button to GetButtonPressed
return
  elseif (Button == 0)
...</pre>


= Common Bugs =
= Common Bugs =
Anonymous user