Page 1 of 1

Menu Question

Posted: Fri May 27, 2016 3:47 am
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?

Posted: Fri May 27, 2016 7:00 am
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...

Posted: Fri May 27, 2016 5:15 pm
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.

Posted: Wed Jun 01, 2016 5:13 pm
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.

Posted: Wed Jun 01, 2016 8:43 pm
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.

Posted: Wed Jun 01, 2016 10:24 pm
by Taco Bot
That makes sense, just actually building a slice collection with scrollbars, selectable options, etc. seems a little bit daunting.

Posted: Thu Jun 02, 2016 9:27 am
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.

Posted: Thu Jun 02, 2016 3:00 pm
by Taco Bot
Oh, cool! That's a lot simpler than what I was thinking. That'll work fabulously!

Posted: Thu Jun 02, 2016 8:00 pm
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.

Posted: Thu Jun 02, 2016 8:24 pm
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.

Posted: Fri Jun 03, 2016 2:30 am
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.