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

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » zMUD General Discussion
Oddyfish
Newbie


Joined: 13 Jun 2004
Posts: 9
Location: United Kingdom

PostPosted: Sun Jun 13, 2004 11:55 pm   

#BUTTON and friends
 
Ok - I'm trying to make a script that creates and destroys buttons as and when it needs to. This is proving to be almost impossible.

Here is what I have (the bottom, more interesting half - without the DBase stuff, that works fine)

Code:

#WHILE (<font color="blue">@wepcount</font id="blue"> <font color="green"><=</font id="green"> <font color="blue">%numitems</font id="blue">( <font color="blue">@availmoves</font id="blue">)) {
  #MATH butvals <font color="blue">@wepcount</font id="blue">+100
  <font color="blue">newcommand</font id="blue"> <font color="green">=</font id="green"> <font color="blue">%item</font id="blue">( <font color="blue">@availmoves</font id="blue">, <font color="blue">@wepcount</font id="blue">) ~~<font color="blue">@target</font id="blue"> with <font color="blue">@weapon</font id="blue">
  <font color="blue">newname</font id="blue"> <font color="green">=</font id="green"> <font color="blue">%item</font id="blue">( <font color="blue">@availmoves</font id="blue">, <font color="blue">@wepcount</font id="blue">)
  #BUTTON <font color="blue">@butvals</font id="blue"> {<font color="blue">%item</font id="blue">( <font color="blue">@availmoves</font id="blue">, <font color="blue">@wepcount</font id="blue">)} {<<font color="blue">@newcommand</font id="blue">>} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} "" {} {} {} {2}
  #ECHO <font color="blue">@wepcount</font id="blue"> - <font color="blue">@newcommand</font id="blue">
  #ADD wepcount 1
  }


Coloured for your conveniance. What I'm trying to do here is make the buttons with seperate commands (From the @availmoves string list) and designate the button the ID @butvals.

What IS happening is I'm getting X different buttons, all in the right place, with the correct name - but they have the same command in them and !!NO ID!!

The No ID part is important because I can't #UNBUTTON them if I don't know what they're called.
Reply with quote
Vijilante
SubAdmin


Joined: 18 Nov 2001
Posts: 5182

PostPosted: Mon Jun 14, 2004 3:12 am   
 
Try it this way. I believe using button 0 makes a new button. Test it in a blank settings file first though to make sure it doesn't do anything bad.
#BUTTON 0 {%item( @availmoves, @wepcount)} {<@newcommand>} {} {} {} {} {} {} {} {} {} {} {} {} {} {} {} "" {} {} {@butvals} {2}
Reply with quote
Oddyfish
Newbie


Joined: 13 Jun 2004
Posts: 9
Location: United Kingdom

PostPosted: Mon Jun 14, 2004 3:17 pm   
 
Right - I've scrapped the above code - it was too long-winded and messy.

Here's what I have now - but for some reason I now seen unable to query the DBase. It just can't find my records anymore.

Code:

weapon = %prompt( "", "New weapon of choice?")
#DBLOAD we
#FORALL %query( &name=@weapon, moves) {availmoves = &specials}
#ECHO Available moves are @availmoves
#DBRESET
#DBCLOSE
availmoves = %replace( @availmoves, ", ", "|")
#FORALL @attacks {#NOOP %btnenable( %i, 0)}
#FORALL @availmoves {#NOOP %btnenable( %i, 1)}
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » zMUD 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