How does Menu Mode work?

Post » Thu Oct 21, 2010 11:43 am

So far I've been working only with a Game Mode script but I'm thinking that Menu Mode might be better for another idea I have. Am I correct in thinking that using that block type will only run the script once each time you access that particular menu, or does it cycle through every 5 seconds like Game Mode does? Also, is there a way of stipulating that the script should run only after the menu closes?
User avatar
Nick Swan
 
Posts: 3511
Joined: Sat Dec 01, 2007 1:34 pm

Post » Thu Oct 21, 2010 12:05 pm

menu mode is kinda weird, if it is put on an object, then when that object is activated in your inventory the script will run, if it is a script quest then I believe that it will always run like gamemode, but you can make it process once if you put

short once
begin menumode #
if once == 0
set once to 1
command
endif
end
User avatar
Natasha Callaghan
 
Posts: 3523
Joined: Sat Dec 09, 2006 7:44 pm

Post » Thu Oct 21, 2010 11:15 am

So that doesn't work like DoOnce though does it? Because I don't want the script to fire only once and that's it. I'd like it to be able to update a value if the conditions have changed, rather than just being a one time only thing. So everytime the menu was opened the script would run, change the value according to the current conditions, then stop cycling after that. It will be a Quest script.
User avatar
ZzZz
 
Posts: 3396
Joined: Sat Jul 08, 2006 9:56 pm

Post » Thu Oct 21, 2010 2:56 pm

So that doesn't work like DoOnce though does it? Because I don't want the script to fire only once and that's it. I'd like it to be able to update a value if the conditions have changed, rather than just being a one time only thing. So everytime the menu was opened the script would run, change the value according to the current conditions, then stop cycling after that. It will be a Quest script.

I am pretty sure it ran more than once, becuase I had an object that was begin menumode, and it was supposed to get an object and I ended up with 17 of them
User avatar
Lucy
 
Posts: 3362
Joined: Sun Sep 10, 2006 4:55 am

Post » Thu Oct 21, 2010 8:33 pm

I am pretty sure it ran more than once, becuase I had an object that was begin menumode, and it was supposed to get an object and I ended up with 17 of them


Now see, that's exactly the problem I'm trying to avoid. I had a script available set on a GameMode script that ran every 1/10 of a second, and the value I was trying change by 20, for a total of 220, ended up being 59,000+. While I don't want to have just a one time thing like you get with the Bobblehead script using the DoOnce command, I don't want it to keep cycling through either.
User avatar
brandon frier
 
Posts: 3422
Joined: Wed Oct 17, 2007 8:47 pm

Post » Thu Oct 21, 2010 5:08 pm

Due to the way menumode works, it's absolutely perfect for some things, and absolutely the wrong choice for others. Many parts of the game that handle instant/constant updating of stuff, like changes to dialog or inventory counts to name a couple, do not run when in menumode... They are disabled in this crippled mode, so certain kinds of changes made while in menumode won't register correctly until menumode is exited and a frame of gamemode runs to relook at everything. Menumode runs constantly (just like gamemode does) but only while the menu is still active. Successive menumodes, like one ShowMessage immediately following another, WILL have at least one frame of gamemode run in between them.
You can set a script up to detect when menumode has been closed by changing a variable to 1 when the menu opens, and include an "if (MenuMode == 0) && (Variable == 1)" statement in the gamemode block to run a certain piece of code inside that IF condition. Change the variable back to 0 in the end of the IF block so that section of code only runs once.
More info here: http://geck.gamesas.com/index.php/MenuMode_%28Function%29
User avatar
Project
 
Posts: 3490
Joined: Fri May 04, 2007 7:58 am

Post » Thu Oct 21, 2010 6:46 pm

Thanks for the info. I did however get things working like I wanted them to. It turns out that it wasn't just because the script was looping, but that I was forcing a loop by calling up a direct AV both to establish a modifier then in a SetAV command. All I needed to do was use a numerical value for the modifier so the SetAV command wouldn't keep looping with the GetAV command I was using for the modifier. It wasn't the game engine that was causing the problem, just my sloppy scripting.
User avatar
Nany Smith
 
Posts: 3419
Joined: Sat Mar 17, 2007 5:36 pm


Return to Fallout 3