Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
Yodous
Apprentice


Joined: 23 Jun 2004
Posts: 105
Location: Poland

PostPosted: 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
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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.
Reply with quote
Yodous
Apprentice


Joined: 23 Jun 2004
Posts: 105
Location: Poland

PostPosted: 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
Reply with quote
Zugg
MASTER


Joined: 25 Sep 2000
Posts: 23379
Location: Colorado, USA

PostPosted: 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.
Reply with quote
Tech
GURU


Joined: 18 Oct 2000
Posts: 2733
Location: Atlanta, USA

PostPosted: 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!
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net