Script message window won't close

Post » Sat Mar 05, 2011 9:39 pm

SOLVED

Sorry for the title. The message window does close but it now appears in every button I click on the menu. Code snippet below:

scn RecycleBinScript; Recycle Bin which converts items of one type to another; 1. Display as buttons.; 2. If has items needed to create, do it; otherwise display "error" messageshort ButtonBegin OnActivate	if IsActionRef player == 1		; display message box of possible actions		ShowMessage RecycleMainMsg	endifEndBegin GameModeset Button to GetButtonPressed	if ( Button == 0 )		; ** Information Message on how the machine works **		player.ShowMessage RecycleInfoMsg	endif	if ( Button == 1 )                if ~itemcount is < required amount -1                       ~display generic failed message                else ~itemcount is >= required amount                       ~display generic success message                       ~remove required item(s)                       ~add new item(s)                endif         endif         if ( Button == 2 )         ...

~ denotes a shorthand explanation of what my code does in those areas.

Button 0 will display a message when I click on it, and clicking ok dismisses the message and allows me to activate the machine again. Problem is, when I select any other button in the list the message from Button 0 opens once each time. I thought the 'endif' above Button 1's entry would close off Button 0 and stop the message displaying on other button clicks. Could someone hint at why it's not doing that?
User avatar
Phoenix Draven
 
Posts: 3443
Joined: Thu Jun 29, 2006 3:50 am

Post » Sun Mar 06, 2011 10:46 am

[quote name='Winter Dragon' date='02 May 2010 - 12:40 PM' timestamp='1272822021' post='15904651']
Sorry for the title. The message window does close but it now appears in every button I click on the menu. Code snippet below:


~ denotes a shorthand explanation of what my code does in those areas.

Button 0 will display a message when I click on it, and clicking ok dismisses the message and allows me to activate the machine again. Problem is, when I select any other button in the list the message from Button 0 opens once each time. I thought the 'endif' above Button 1's entry would close off Button 0 and stop the message displaying on other button clicks. Could someone hint at why it's not doing that?
[/quote]


Hmm i may be wrong but maybe this


~ denotes a shorthand explanation of what my code does in those areas.

Button 0 will display a message when I click on it, and clicking ok dismisses the message and allows me to activate the machine again. Problem is, when I select any other button in the list the message from Button 0 opens once each time. I thought the 'endif' above Button 1's entry would close off Button 0 and stop the message displaying on other button clicks. Could someone hint at why it's not doing that?
[/quote]
User avatar
KIng James
 
Posts: 3499
Joined: Wed Sep 26, 2007 2:54 pm

Post » Sun Mar 06, 2011 4:20 am

You should set up your 'getbuttonpressed' differently, since in a GameMode block with no conditions It will ALWAYS try to intercept ALL button presses.
Remember, the GameMode block runs once every FPS cycle.

Check the WIKI: http://geck.gamesas.com/index.php/GetButtonPressed
User avatar
matt oneil
 
Posts: 3383
Joined: Tue Oct 09, 2007 12:54 am

Post » Sun Mar 06, 2011 7:02 am

You should set up your 'getbuttonpressed' differently, since in a GameMode block with no conditions It will ALWAYS try to intercept ALL button presses.

Yup, definately.. can cause all sorts of issues if you leave a GetButtonPressed unchecked in a gamemode block.

scn RecycleBinScript; Recycle Bin which converts items of one type to another; 1. Display as buttons.; 2. If has items needed to create, do it; otherwise display "error" messageshort Buttonshort tickerBegin onactivate  if IsActionRef player == 1    ; display message box of possible actions    ShowMessage RecycleMainMsg    set ticker to 1  endifEndBegin GameMode  if (ticker == 1)    set Button to GetButtonPressed    if ( Button == 0 )      ; ** Information Message on how the machine works **      ShowMessage RecycleInfoMsg      set Button to -1    endif    if ( Button == 1 )      if ~itemcount is < required amount -1        ~display generic failed message      else         ~display generic success message        ~remove required item(s)        ~add new item(s)      endif      set Button to -1    endif    if ( Button == 2 )         ...    set Button to -1    endif    Set ticker to 0  endifEnd

User avatar
City Swagga
 
Posts: 3498
Joined: Sat May 12, 2007 1:04 am

Post » Sun Mar 06, 2011 5:42 am

Thanks, that worked and I now see why it didn't before. I'll mark my first post as solved. :)
User avatar
CHARLODDE
 
Posts: 3408
Joined: Mon Apr 23, 2007 5:33 pm


Return to Fallout 3