|
Yodous Apprentice
Joined: 23 Jun 2004 Posts: 105 Location: Poland
|
Posted: Sun Sep 27, 2009 11:11 pm
#BUTTON Syntax |
Hi.
I want to make some script for dynamic creating buttons (with this I could change their positions etc by this script).
But I have some problem. The code:
Code: |
$iter = 0
$startX = 1
$startY = 1
$btnHeight = 23
$panel = 4
#WHILE ($iter<10) {
$currY = %eval($startX + $iter*23);
$currID = %concat("btnTeamNum", @fillString($iter,2))
#BUTTON myId {Caption I: $iter} {#sa Test} {} {} {} {} {} {0} {20} {$btnHeight} {0} {$currY} {1} {15} {11} {} {} {} {} {} {$currID} {$panel}
#AD $iter 1
} |
Looks like local variables arent evaluate inside the {} bracers. Any ideas?
Best regards
Yodous |
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Mon Sep 28, 2009 3:01 pm |
#BUTTON is a carry over from zMUD and wasn't really designed to work with local variables. Zugg may be able to update this, but in general the #BUTTON command is very complex and is generally discourage. Think of it as a deprecated command. If you need to do you buttons dynamically then you can consider using the Lua Scripting interface.
If you describe the problem you're trying to solve (i.e. why do you want to dynamically create buttons) maybe we can offer an alternate solution. |
|
_________________ Asati di tempari! |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Mon Sep 28, 2009 3:56 pm |
You can create the #BUTTON command within a string variable, concat the local variable, then use #EXEC to execute the string with the button command.
But I agree with Tech that you should probably just use the Lua scripting interface since that gives you access to the actual button object itself and then you can just change the Height and position properties of the button directly. |
|
|
|
Yodous Apprentice
Joined: 23 Jun 2004 Posts: 105 Location: Poland
|
Posted: Mon Sep 28, 2009 10:41 pm |
Re Tech:
I just wanted to do some fine GUI based on my experience and sometimes I have to move a lots of buttons (that are put in some order) for some points to the left/right/top/bottom and doing it by hand is a big time eater :)
I've done it with generating XML via simple Java program and past it into the XML tab.
Re Zugg:
Thx, I have to look into this Lua stuff and cMud :) |
|
Last edited by Yodous on Thu Oct 01, 2009 2:08 am; edited 1 time in total |
|
|
|
Zugg MASTER
Joined: 25 Sep 2000 Posts: 23379 Location: Colorado, USA
|
Posted: Tue Sep 29, 2009 3:32 pm |
The 3.10 BETA version has added some feature to buttons, notably the ability to have undocked buttons floating over the main MUD window, and also the ability to drag/drop buttons to a new location with the mouse. If you are moving buttons, the drag/drop feature might be useful for you.
|
|
|
|
Tech GURU
Joined: 18 Oct 2000 Posts: 2733 Location: Atlanta, USA
|
Posted: Tue Sep 29, 2009 5:11 pm |
In addition if your moving buttons (depending on exactly what you mean) you may be better off by changing the the tool bar definition for the at button.
|
|
_________________ Asati di tempari! |
|
|
|
|
|