|
jjdafoe Newbie
Joined: 22 Dec 2008 Posts: 2
|
Posted: Wed Dec 31, 2008 1:05 am
Creating button states |
Can I create new button states for an existing multi state button from the command line???
|
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Dec 31, 2008 2:37 am |
Nope, use the UI. Whatever you were trying to do using a script can probably be done a different way, though.
|
|
|
|
jjdafoe Newbie
Joined: 22 Dec 2008 Posts: 2
|
Posted: Wed Dec 31, 2008 3:11 am |
Well here's what I'm trying to do.
I'm playing Federation II and I'm trying to work with my commodities.
I have a button set up to "buy @goods" a button setup to "sell @goods" another set up to "check price @goods".
I have a multi state button called @goods (so it displays the current value of the variable) setup to manage the variable "goods"... each state changes "#VAR goods {state caption}" (note I'm not using {state caption} as a variable I'm just using it here to describe my button states)
I also have a menu option that "#VAR goods %selword"
Now there are a bucket load of commodities in the game and I probably won't use all of them as many of them don't have a high profit turn around. But it would make my life a heck of a lot easier if I could use that menu option to populate my multistate button with a script that looked something like:
1 #VAR goods %selword
2 #addstate id @goods {#VAR goods @goods}
where id is the button id # the first @goods expands and populates the state caption and the following string populates the commands to run. (The second @goods also expanding before saving to the state)
If you have any suggestions on how to accomplish something similar in a different way let me know. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Wed Dec 31, 2008 4:08 am |
Hmm... There just aren't the tools for editing button states in this manner - perhaps it's something you could do with the COM interface, but that's probably more effort than it's worth.
If it were me, I'd do this with MXP. You can do some quite good-looking stuff with MXP and its <send> tag is ideal for this sort of thing. I'd do something like this:
#additem goodslist coal
#additem goodslist potash
#additem goodslist iron
#forall %sort(@goodslist) {#mxp {<send 'goodset %i'>Set %i as current good.</send>}}
Where the alias goodset just does #var goods %1.
(Incidentally, this alias is potentially a VERY BAD IDEA and I probably shouldn't do it, but my MUD doesn't use MXP and doesn't let people send it to me, so it doesn't really matter. Letting the MUD - and potentially people playing the MUD, if the MUD doesn't strip the <> characters properly from sent text - set the value of a variable isn't a good plan, and that's why the #var command isn't supported in MXP. But in this limited example where you can only set one quite inconsequential variable, it should be alright.)
Anyway, this is the best way I've found for editing variable-sized lists. If the list gets really big you can make a table to display more than one on a line, and you can use colours and whatnot to pretty it up. Hopefully you'll find it useful in some way. |
|
|
|
|
|