ScriptUO

Official ScriptUO EasyUO Scripts => Scripting Chat => Topic started by: 12TimesOver on January 19, 2009, 02:50:12 PM

Title: Menu talk
Post by: 12TimesOver on January 19, 2009, 02:50:12 PM
Question perhaps not worthy of an entire thread but nevertheless...

I'm working on a script that will benefit from the use of a multi-menu UI. As one piece of the setup is complete I want to retire the menu. I'm assuming that the "menu hide" command leaves the menu accessible thus in memory, is this correct? Any negative repercussions to using the menu hide then loading other menus?

As always, any input is greatly appreciated!

X
Title: Re: Menu talk
Post by: Tidus on January 20, 2009, 08:41:23 AM
If you menu hide and then load up a new menu using the same % ! values you will then auto change any values, otherwise, yes they are stored in memory for later use.  So that you can use multiple menus and each can ask a different question but the program will still remember a past choice.
Title: Re: Menu talk
Post by: TrailMyx on January 20, 2009, 08:52:47 AM
You just have to be careful with menus when you are thinking that EUO handles more than one at a time.  IT DOESN'T.  It's up to you and how you control the addition and deletion of the menu items.  Just keep in mind you are still talking about only one.  Here's a bit of code that'll demonstrate it:

(notice how you have 2 EUOButton1s now? - when you run showEUOMenu2)  :)

Code: [Select]
gosub showEUOMenu1
pause
gosub showEUOMenu2
pause
gosub showEUOMenu1
stop
sub showEUOMenu1
menu Clear
menu Window Title EUOMenu1
menu Window Color BtnFace
menu Window Size 228 138
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color WindowText
menu Button EUOButton1 36 40 75 25 EUOButton1
menu Show 421 270
return

sub showEUOMenu2
menu Window Title EUOMenu2
menu Window Color BtnFace
menu Window Size 228 138
menu Font Transparent #true
menu Font Align Right
menu Font Name MS Sans Serif
menu Font Size 8
menu Font Style
menu Font Color WindowText
menu Button EUOButton1 36 96 75 25 EUOButton1
menu Show 421 270
return
Title: Re: Menu talk
Post by: 12TimesOver on January 20, 2009, 09:01:27 AM
So am I understanding correctly that it's an exercise of simply keeping the object names in line correctly?

My example is first I want a small menu to display a simple dropdown list of options, option is chosen, OK is clicked, Menu is hidden, the next menu is called. This next menu would be a setup menu based on which option is chosen in the first menu, setup options selected, OK is clicked, variables saved, menu hidden, tracking menu called. This third menu will stay active.

If I make sure there are no name conflicts does this work?

Title: Re: Menu talk
Post by: Tidus on January 20, 2009, 09:05:29 AM
Yes,  A good example of this would be C2's Play That Funky Music Multi-Trainer. http://winuo.org/multi-trainers/1140-c2s-play-funky-music-multi-trainer.html (http://winuo.org/multi-trainers/1140-c2s-play-funky-music-multi-trainer.html)  You just need to make sure as you said before that nothing is repeated that is vital to the menu.
Title: Re: Menu talk
Post by: TrailMyx on January 20, 2009, 09:10:17 AM
Whenever I've done multiple menus, you just make it so they clear and redraw themselves completely.  To be honest, it doesn't make much difference as long as the supporting code knows what menu you are on.  It's embarrassing when you are assuming you are on your configuration menu, but your code has already graduated to the system menu.  I always put a variable in the menu drawing sub to keep the script up to date with what's displayed.

I actually started a menu drawing framework (actually started with my list management subs) that manages your menus.  I never finished that. 
Title: Re: Menu talk
Post by: 12TimesOver on January 20, 2009, 09:25:38 AM
Well cool guys, that helps a lot thanks!!