Menu Script
-
Min and max decide how many buttons there can be. It's quite complicated, and I think this is one of those scripts you're either gonna get, or not:
#Initialisation if frame==1; setVar("lrepeat",0); setVar("rrepeat",0); setVar("main_select",1); end; min=1 max=2 #key 'events' if key("left")==0; setVar("lrepeat",1); elsif getVar("lrepeat")==1; setVar("main_m",getVar("main_m")-1); setVar("lrepeat",0); end; if key("right")==0; setVar("rrepeat",1); elsif getVar("rrepeat")==1; setVar("main_m",getVar("main_m")+1); setVar("rrepeat",0); end; if key("up")==1; setVar("main_select",getVar("main_m")); end; #Menu behaviour if getVar("main_m")<min; setVar("main_m",max); elsif getVar("main_m")>max; setVar("main_m",min); end;
It's used in this collab between me and Rogue: http://sketchup.google.com/3dwarehouse/details?mid=146cdf2b1a52c8cc234bd3546e70124a#
-
WACOV, YOU HAVE OUTDONE YOURSELF!
-
THAT'S GREAT.
-
...I've been trying to incorperate a menu using actual ruby, and although it's easy...
prompts = ["What do you want to control?"] defaults = ["Car"] list = ["Car|Boat|man"] results = UI.inputbox prompts, defaults, list, "MODEL USE SELECTION."
ΓNote, that up there is an example, and I'm not making anything that uses boats, cars and people at the time.... I can't figure out how to properly incorporate it with the current workings of the onTick box. It will never get rid of the UI box, and a new one comes up as soon as you exit the old one: there's no apparent way to set it to a key in SP.
-
Oh, BTM, that's boring! Menus in 3D, with little moving bits and nice effects, that's the way to go!
-
... But messageboxes and inputboxes are more practical, and less complicated to make. They also allow for input, like of you wanted to make a box that goes to a certain position depending on what you type in a field
... Once again, the problem with inputboxes (not messageboxes; they work fine) is that they automatically work every frame, and I can't get them to stop!
... Also, a 2 way switch can be easier, remember the one I posted a while back? (no link, sorry)
-
What do you mean it happens every frame? Even if you do something like...
if(frame==100); UI.message_box...;end
-
Ah! You're right! I guess I was writing it out wrong when I tried to get it to pop up when a key is pressed.
-
You know the key detection system I use? That'd work for this.
Advertisement