I'm wondering if it is possible to get the currently selected item from a menu.
And not get it after it is choosen (that can be done by tags etc.), but just when it is selected.
I'd like to have the player choose something and display all the options on the screen.
The items are displayed as slices in a row, the selected item should move up and back down.
Plotscripting dictionary say about open menu fuction:
1) How can I get to know this retun value?open menu (ID, allow duplicate)
Opens the menu specified by ID. You can also use the constants defined in your HSI file in the form menu:name. The menu will be opened on top of any menus that are already open. The optional second argument allow duplicates can be true if you want to be able to open more than one copy of the same menu at the same time. The return value is a menu handle that you should store in a variable for use with other menu-related commands.
2) Is there a better way to get the selected (not yet choosen) menu?
Code: Select all
#need this menu's return value and don't know how to get it! :(
#PetMenu := open menu (3,0)
variable(starfish)
variable(jellyfish)
variable(orangefish)
variable(octopus)
variable(guy)
if (menu is open(PetMenu))
(
#number,palette
starfish := load walkabout sprite (33, 41)
jellyfish := load walkabout sprite (34, 42)
orangefish := load walkabout sprite (35, 43)
octopus := load walkabout sprite (36, 44)
guy := load walkabout sprite (13, 1)
put sprite(starfish, 20, 20)
put sprite(jellyfish, 50, 20)
put sprite(orangefish, 80, 20)
put sprite(octopus, 110, 20)
put sprite(guy, 140, 20)
ChooseStar:= first menu item(PetMenu)
ChooseJelly:= next menu item(PetMenu)
ChooseOrange:= next menu item(PetMenu)
ChooseOcto:= next menu item(PetMenu)
ChooseGuy:= next menu item(PetMenu)
if (selected menu item(PetMenu) == ChooseStar) then
(
#moves the slice 10 up
move slice to (starfish, 10, 20,7)
wait (3)
move slice to (starfish, 20, 20,14)
wait (3)
)
else if
(selected menu item(PetMenu) == ChooseJelly) then
(
#moves the slice 10 up
move slice to (jellyfish, 40, 20,7)
wait (3)
move slice to (jellyfish, 50, 20,14)
wait (3)
)
# add others here
)
else
free sprite (starfish)
free sprite (jellyfish)
free sprite (orangefish)
free sprite (octopus)
free sprite (guy)
Thanks for you help! =D
If you have advice on how to 'handle' this better, please let me know. ;)