Dynamically generated menus?
tebling
16 Nov 2004, 20:43I'd like to create a selection menu based on variable length data. For example, I have the following objects, which correspond to actions in the game:
...etc
You can see that each action has properties associated with it. Now I'd like to build a selection menu that allows the player to choose an action. The menu should have all the actions from these objects, and not "hard-code" them. Something like this:
I know this isn't legit code (I tried it!), but can you guys think of any way to handle this?
Thanks!
define object <action1>
properties <name=say hello; want=talk; fulfill=5>
end define
define object <action2>
properties <name=make smalltalk; want=talk; fulfill=15>
end define
define object <action3>
properties <name=converse; want=talk; fulfill=20>
end define...etc
You can see that each action has properties associated with it. Now I'd like to build a selection menu that allows the player to choose an action. The menu should have all the actions from these objects, and not "hard-code" them. Something like this:
define selection <want_fullfilment_menu>
info <Choose a type of action>
set numeric <action_num; 1>
repeat while exists <action%action_num%> {
choice <$objectproperty(action%action_num%; name)$> script
set numeric<action_num; %action_num% + 1>
}
end defineI know this isn't legit code (I tried it!), but can you guys think of any way to handle this?
Thanks!
007bond
17 Nov 2004, 05:24I would have to agree with you. Quest needs to allow u to set the menu items acording to a variable.
paul_one
17 Nov 2004, 12:33I have also wished this feature was available - I was making a "fighting" demo, and wanted this to create a nice interface for the user.
I suggest you list the commands with an index number, askin the user which action to take, then executing THAT action.
Using enter <>.
Still, some things are going to become annoying wince you'll need to have multiple IF's and hard-coding any actions you wish to take.
I do wish ASL had pass-by-reference, and the ability to call functions/actions/other variables by a alue in another....... BUT I do see the downside, as alot of error's would be occuring if used incorrectly.
Makes good things like this possible though.
I suggest you list the commands with an index number, askin the user which action to take, then executing THAT action.
Using enter <>.
Still, some things are going to become annoying wince you'll need to have multiple IF's and hard-coding any actions you wish to take.
I do wish ASL had pass-by-reference, and the ability to call functions/actions/other variables by a alue in another....... BUT I do see the downside, as alot of error's would be occuring if used incorrectly.
Makes good things like this possible though.