Menu Question

Ask and answer questions about making games and related topics. Unrelated topics go in that other forum.

Moderators: marionline, SDHawk

Post Reply
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

Menu Question

Post by Taco Bot »

Hee hee, here I am again with another question!

Is there any way to make a line in a menu that can't be highlighted? As in, the cursor just skips over it when it's doing its thang. If so, how?
Sent from my iPhone
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

I'm afraid not. That is definitely the #1 most obvious feature that ought to be added to customisable menus. It has been for a long time, so I don't want to make any promises...
Last edited by TMC on Fri May 27, 2016 7:01 am, edited 1 time in total.
User avatar
kylekrack
Liquid Metal Slime
Posts: 1240
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

If you want interesting UI, I suggest creating a slice collection for your menu anyway. It's one of the simple things you can do to make a game look just a little bit nicer overall. There's so much more you can do with a menu than just have it pop up instantly center screen.
My pronouns are they/them
Ps. I love my wife
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

Post by Taco Bot »

So I've read over the slices tutorial, and I can do some basic stuff with single slices and plotscripting, but making a menu with slices eludes me.
Sent from my iPhone
User avatar
kylekrack
Liquid Metal Slime
Posts: 1240
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

You open a menu as usual, but you set "no box" on and load a slice collection with it. So you'd have a script that loads a slice collection to a variable, maybe global, then open menu(#). Make a close script and set it to the menu's on-close script, which should free the slice collection.

That's the basics of it. I'm sure you'll have more specific questions as well. Let me know if any of that didn't make sense.
My pronouns are they/them
Ps. I love my wife
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

Post by Taco Bot »

That makes sense, just actually building a slice collection with scrollbars, selectable options, etc. seems a little bit daunting.
Sent from my iPhone
TMC
Metal King Slime
Posts: 4308
Joined: Sun Apr 10, 2011 9:19 am

Post by TMC »

Actually, kylekrack was suggesting just displaying a slice collection behind a regular menu.

This is completely optional, but once you have a slice collection like that you can run a script which modifies it depending on what menu item is selected. That's easy to do using select slices; you can use the following script for any such menu. How it works is that it checks which menu item is selected, and sets the corresponding child of the slice with lookup code "menu select slice", which needs to be a Select slice.

Using this, you could even give all the menu items blank names and display everything using the slice collection. For example the collection could just be a set of backdrops, one per menu item.

Code: Select all

plotscript, slice augmented menu, begin
  # Assume the menu is already open
  variable (menu, collection, selection)
  collection := load slice collection(1)   # Change the collection ID
  menu := top menu
  while (menu is open(menu)) do (
    # selection is equal to 0 for the first menu item, 1 for second, etc
    selection := menu item true slot(selected menu item(menu))
    # Toggle which child of "menu select slice" is visible: first child for first menu item, etc.
    set select slice index(lookup slice(sli: menu select slice), selection)
    wait
  )
  free slice(collection)
end
I haven't tested this script.

Edit: Ha, I went to add a link to this script to the wiki, and found that I had written one before, here. This one is simpler and more modern.
Last edited by TMC on Sun Dec 18, 2016 11:34 pm, edited 3 times in total.
User avatar
Taco Bot
Meat, Cheese, and Silicon
Posts: 484
Joined: Fri Jul 18, 2014 12:15 am
Location: Santa Cruz
Contact:

Post by Taco Bot »

Oh, cool! That's a lot simpler than what I was thinking. That'll work fabulously!
Sent from my iPhone
User avatar
kylekrack
Liquid Metal Slime
Posts: 1240
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

I would offer a tech demo I've made that plays with graphically based menus, but last time I ran I got massive errors, possibly due to the update, but more likely because I changed something and then forgot about it.

That being said, I've dealt with this stuff before, and I know it can raise a lot of questions and confusion as you start scripting it. Looks like TMC has a really solid example there, though.
My pronouns are they/them
Ps. I love my wife
User avatar
Bob the Hamster
Lord of the Slimes
Posts: 7658
Joined: Tue Oct 16, 2007 2:34 pm
Location: Hamster Republic (Ontario Enclave)
Contact:

Post by Bob the Hamster »

kylekrack wrote:I would offer a tech demo I've made that plays with graphically based menus, but last time I ran I got massive errors, possibly due to the update, but more likely because I changed something and then forgot about it.
Probably warnings about things which may be incorrect but don't stop the script from working

When you play from the "Test Game" in custom, you are in "debug" mode, and it will show you all the errors

When you play in "release" mode, all but the very worst errors are hidden.
User avatar
kylekrack
Liquid Metal Slime
Posts: 1240
Joined: Mon Jun 16, 2014 8:58 am
Location: USA
Contact:

Post by kylekrack »

Interesting. I will try that out next time I get the chance. Either way, I'd like the menu system to be as tight as possible, but maybe that can help me discover where the fatal errors are and where the trivial ones are.
My pronouns are they/them
Ps. I love my wife
Post Reply