disabling menu control

Make games! Discuss those games here.

Moderators: Bob the Hamster, marionline, SDHawk

User avatar
Willy Elektrix
Liquid Metal Slime
Posts: 910
Joined: Sun Aug 15, 2010 11:30 pm

disabling menu control

Post by Willy Elektrix »

I want to use a custom menu to display the heroes stats. However, I want to disable the player's control of that menu so that they can't move the cursor around and highlight different menu items. In other words, it will be formatted like a menu, but function like a text box.

The menu bitset "disable player control of menu" doesn't seem useful since the player is unable to cancel the menu while that is open.

Is there a command script which I can use to disable the arrow keys so the player cannot highlight different menu items. Or is there an even better approach to do this?
User avatar
Spoonweaver
Liquid Metal King Slime
Posts: 6247
Joined: Mon Dec 08, 2008 7:07 am
Location: Home
Contact:

Post by Spoonweaver »

I feel like there should just be a willy's scripting/functionality problems thread.

Anyways, if the menu is just going to act like a text box, use a textbox. Otherwise, you'll need to provide more information about what you're actually talking about. Screenshots included.
User avatar
Willy Elektrix
Liquid Metal Slime
Posts: 910
Joined: Sun Aug 15, 2010 11:30 pm

Post by Willy Elektrix »

Spoonweaver wrote:Anyways, if the menu is just going to act like a text box, use a textbox. Otherwise, you'll need to provide more information about what you're actually talking about. Screenshots included.
A text box has a limit to the number of lines it contains. A menu is much more useful in this regard.

I'm not sure what to show an image of that would help explain the problem. I've attached a picture of my custom menu from custom.exe.

I want the menu to look like that, but forbid the player to control it other than to cancel it. Originally I had tried to enable the "disable player control of menu" bitset. Then I had written a script like this:

Code: Select all

plotscript, statwindow, begin
open menu (1)
while(top menu == 1) do (
if (key is pressed (key: esc), or, key is pressed (key: space)) then (close menu (1))
wait (1)
)
end
However, that doesn't seem to work. Probably because "disable player control" turns off the esc and spacebar, but I'm not sure.
Attachments
voidmenu.png
voidmenu.png (2.66 KiB) Viewed 2842 times
User avatar
Spoonweaver
Liquid Metal King Slime
Posts: 6247
Joined: Mon Dec 08, 2008 7:07 am
Location: Home
Contact:

Post by Spoonweaver »

try this

Code: Select all

plotscript, statwindow, begin
variable (Spoonhelpedme)
Spoonhelpedme:=0
open menu (1)
while(Spoonhelpedme == 0) do (
if (key is pressed (key: esc), or, key is pressed (key: space)) then (close menu (1),Spoonhelpedme:=1)
wait (1)
)
end
User avatar
Gizmog
Metal King Slime
Posts: 2615
Joined: Tue Feb 19, 2008 5:41 am

Post by Gizmog »

I'm not sure if this is exactly what you'd want, but couldn't you just make it so each menu option had a tag that ensured it was never "Enabled"? They'd still be able to move the menu selector up and down, but they wouldn't be able to do anything, just hit escape to go back. Would save you a lot of needless scripting or shenanigans.

I guess what I mean is, why is it so important they can't move the cursor if it can't do anything?
Last edited by Gizmog on Mon Oct 06, 2014 1:39 am, edited 1 time in total.
User avatar
FnrrfYgmSchnish
Metal Slime
Posts: 721
Joined: Thu Jun 18, 2009 4:37 am
Location: Middle of Nowhere, VA

Post by FnrrfYgmSchnish »

Isn't it possible to set menu items as "not selectable?" I haven't fiddled with menus a whole lot, but I do know that option exists somewhere--maybe it's only for a specific type of menu item so it might not work in this case.
FYS:AHS -- Swapping out some step-on NPCs for zones + each step script
Puckamon -- Not until the reserve party is expanded.[/size]
User avatar
Willy Elektrix
Liquid Metal Slime
Posts: 910
Joined: Sun Aug 15, 2010 11:30 pm

Post by Willy Elektrix »

I ended up working around this problem in a complete different way.

Now, when the player presses ESC to open the main menu, it simultaneously opens the stats menu right beside the main menu. Since the stats menu is not the top menu, it cannot be manipulated. However, the stats are visible whenever the main menu opens. It also saves the player a step to view his stats.

I'm very pleased.
User avatar
FnrrfYgmSchnish
Metal Slime
Posts: 721
Joined: Thu Jun 18, 2009 4:37 am
Location: Middle of Nowhere, VA

Post by FnrrfYgmSchnish »

Hey, nice workaround. Kinda reminds me of how the Final Fantasy games (well, the ones I've played anyway) have a screen-covering menu that has both its "Main Menu" stuff and your party's HP/MP/name/etc. at the same time.
FYS:AHS -- Swapping out some step-on NPCs for zones + each step script
Puckamon -- Not until the reserve party is expanded.[/size]
User avatar
Mystic
Metal Slime
Posts: 322
Joined: Wed Jul 23, 2008 4:32 am

Post by Mystic »

Although you have solved this, is there a reason you're not using slices for this? That would have been a pretty easy thing to do, I think. Slices can basically be big text boxes, if you want. You can also put pictures in there, too, so your stats can have icons.
User avatar
Willy Elektrix
Liquid Metal Slime
Posts: 910
Joined: Sun Aug 15, 2010 11:30 pm

Post by Willy Elektrix »

Mystic wrote:Although you have solved this, is there a reason you're not using slices for this? That would have been a pretty easy thing to do, I think. Slices can basically be big text boxes, if you want. You can also put pictures in there, too, so your stats can have icons.
If I couldn't figure this out, my intent was to learn how to use slices. I'm slow to adopt new things, so I haven't really dug into slices much yet.
User avatar
kylekrack
Liquid Metal Slime
Posts: 1188
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

A good start to slices seems to just be to play around in the "Edit Slice Collections" section of the editor. I spent a lot of time just making pretty layouts of boxes and stuff to help me conceptualize what slices are and how they interact. Once you make it look good, you basically just set a variable equal to "load slice collection(0)" and it pops up. I don't know if that's the best way to learn, but that's the way I did it. Just spent time with it.
My pronouns are they/them
Ps. I love my wife
TMC
Metal King Slime
Posts: 4101
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

It's pretty much intended that you learn about slices by playing around with them in the editor. However the editor could be a lot more user friendly.

Regarding Willy's original question, the script that you posted was wrong. "top menu" returns a menu handle, not a menu ID number. Those are different things: a handle is just an opaque number like an npc reference. Writing "while (top menu)" or "while (menu is open(1))" instead should have worked, as would Spoonweaver's script. And of course don't forget the menu bit to allow scripts.
User avatar
Willy Elektrix
Liquid Metal Slime
Posts: 910
Joined: Sun Aug 15, 2010 11:30 pm

Post by Willy Elektrix »

TMC wrote:Regarding Willy's original question, the script that you posted was wrong. "top menu" returns a menu handle, not a menu ID number. Those are different things: a handle is just an opaque number like an npc reference. Writing "while (top menu)" or "while (menu is open(1))" instead should have worked, as would Spoonweaver's script. And of course don't forget the menu bit to allow scripts.
I eventually figured this out, but another problem emerged. Using the ENTER key to open and close the menu required a lot of finicky WAIT statements. Otherwise, the menu would open and then immediately close. However, using the statements could cause the menu to stall briefly if it was opened and closed quickly. In other words, it wasn't very smooth.
User avatar
Spoonweaver
Liquid Metal King Slime
Posts: 6247
Joined: Mon Dec 08, 2008 7:07 am
Location: Home
Contact:

Post by Spoonweaver »

Willy Elektrix wrote:I eventually figured this out, but another problem emerged. Using the ENTER key to open and close the menu required a lot of finicky WAIT statements. Otherwise, the menu would open and then immediately close. However, using the statements could cause the menu to stall briefly if it was opened and closed quickly. In other words, it wasn't very smooth.
Easily fixed with a short wait command. I like to go with 8, which is a half second.

Code: Select all

plotscript, statwindow, begin
variable (Spoonhelpedme)
Spoonhelpedme:=0
open menu (1)

wait (8)

while(Spoonhelpedme == 0) do (
if (key is pressed (key: esc), or, key is pressed (key: space)) then (close menu (1),Spoonhelpedme:=1)
wait (1)
)
end
[/quote]
TMC
Metal King Slime
Posts: 4101
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

I don't understand why pressing enter here would be a problem, but maybe it was because there was more to the script.

If you have problems with things double triggering it is almost certainly because you are using "keyispressed(key:enter)" when you should be using "keyval(key:enter) > 1" instead.
Post Reply