|
jackwest Novice
Joined: 01 Jan 2009 Posts: 35
|
Posted: Sat Jan 10, 2009 9:44 pm
how do i write complex buttons using the #button command? |
so the helps state the button syntax is
#BUTTON id|number Off-caption On-command On-caption Off-command Value-expression Variable-name Bitmap-filename AutoSize Width Height AutoPos Top Left Off-color On-color Button-Kind Bitmap-margin Classname Options ToolTip ID PanelNum
what i was wondering... if i want to define several of those parameters but not all, do i have to go through and put values into every syntax? and when do i use {} and not? i want some parameters like classname and panelnum, does that mean i have to define every parameter before those? i can make the buttons through the gui but i'm trying to make a trigger which creates the button if it doesnt already exist.
jack |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sat Jan 10, 2009 11:43 pm |
Er... you really want to stay away from the #button command. It's dire. Depending on what you want to do, there's almost certainly a better way to do it.
|
|
|
|
jackwest Novice
Joined: 01 Jan 2009 Posts: 35
|
Posted: Sun Jan 11, 2009 12:02 am |
for each spell i have a #class. when i list all spells on my character it checks those spells against the classes. if the spell is new, it creates a new class, new variables, and ideally 2 buttons, one with the spell name and the other with the duration. when the spell duration drops below a minimum the button changes colour. when the spell drops the duration button turns into a cast button which will recast if click. and a few other things as well.
i've already done something similiar which creates a new #class and #buttons etc when i log in a new character. the only issue i'm having here is the options are a lot more complex and i cant work out the correct syntax. i've spent most of the morning going through the helps, reading back into this forum etc. the problem is the example given in the manual
Code: |
#BU test {Test Button} {look} |
but it isnt very helpful when dealing with the 20 odd options available. |
|
|
|
calesta Apprentice
Joined: 07 Dec 2008 Posts: 102 Location: New Hampshire, USA
|
Posted: Sun Jan 11, 2009 12:12 am |
It is possible to use in some instances... I think there are a lot of things where the syntax is either so arcane it's just about impossible to figure out or there are a bunch of bugs where the #button command can't be used to create certain types of buttons (I can't get multistate ones to work at all for example). But... if you really want to play around some more, here is the code I used to create a Menu type button:
Code: |
#button SailTo "Sail To" {SailToSubMenu} {} {} {} {} {} {} {} {} {} {} {} {} {} {Menu} {} SailToMenu |
I also get settings being created outside of any window/module too however, and they are always related to the package that creates this button... so I wouldn't be surprised if the #button command has bugs in it that are the culprit. I also pretty consistently get access violations when trying to delete buttons that have been created using the #button command, so I would recommend finding another alternative if possible. I've been meaning to get rid of it in mine and use something else instead to see if most of the access violation and phantom settings problems I have been seeing go away without this ugliness. |
|
|
|
Fang Xianfu GURU
Joined: 26 Jan 2004 Posts: 5155 Location: United Kingdom
|
Posted: Sun Jan 11, 2009 3:24 am |
The #button syntax was basically added for the text import/export in zMUD - it wasn't really expected that anyone would create buttons with the command line or with a script, simply because buttons have too many options to make it a simple matter. Generally, you should use the UI to create buttons.
|
|
|
|
Vijilante SubAdmin
Joined: 18 Nov 2001 Posts: 5182
|
Posted: Tue Jan 13, 2009 1:45 am |
I would also suggest getting away from creating new classes. It is much more efficient to turn classes on and off with #T+ and #T-. What you should do is set the variable within the class using either the full #VAR command or the class character syntax; then enable the class. Doing it this way saves 1 draw on each button in the class that is using the variables. You can also set the variables to Use Default to make changing them faster.
|
|
_________________ The only good questions are the ones we have never answered before.
Search the Forums |
|
|
|
|
|