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
Rebel
Novice


Joined: 29 Oct 2007
Posts: 33

PostPosted: Wed Dec 31, 2008 10:34 am   

First button - how do I add a timer to it?
 
I have a command - "Thump", that I can use, and then I have to wait 60 seconds before I can use it again.
This seems a good use for a button - I would appreciate advice on how to make such a button work.
Ideally I think the button should change colour after the time period is up so that I know I can use that command again.
Is this possible?
Reply with quote
Qaiia
Wanderer


Joined: 06 Apr 2007
Posts: 59

PostPosted: Wed Dec 31, 2008 1:50 pm   
 
Code:
<button name="ThumpButton" transparent="false" color="navy" textcolor="white" priority="1510" id="151">
  <caption>Thump!</caption>
  <value>#SENDRAW {thump}
#SHOW "Thumping!"
#CALL %btnenable(ThumpButton,0)
#CALL %btncol(ThumpButton, black, grey)
#ALARM +60 {
  #CALL %btnenable(ThumpButton,1)
  #CALL %btncol(ThumpButton, white, navy)
  #SHOW "Thumping enabled!"
  }</value>
</button>
_________________
Citrus: The Juicy Alternative

Last edited by Qaiia on Wed Dec 31, 2008 3:33 pm; edited 7 times in total
Reply with quote
calesta
Apprentice


Joined: 07 Dec 2008
Posts: 102
Location: New Hampshire, USA

PostPosted: Wed Dec 31, 2008 1:55 pm   
 
You could do something like this:
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <button name="BtnThump" priority="10" copy="yes">
    <caption>Thump</caption>
    <value>#show Thumping
#call %btnenable(BtnThump,0)
#alarm +60 {
  #show Can thump again
  #call %btnenable(BtnThump,1)
}</value>
  </button>
</cmud>

You should just be able to copy that XML and paste it into the package editor to see what the button looks like.
Reply with quote
Qaiia
Wanderer


Joined: 06 Apr 2007
Posts: 59

PostPosted: Wed Dec 31, 2008 2:03 pm   
 
Heh, you could combine both of these for the dynamic button coloring as well as on-screen messaging.

edit: change my code posting to add on-screen messaging.
_________________
Citrus: The Juicy Alternative
Reply with quote
Rebel
Novice


Joined: 29 Oct 2007
Posts: 33

PostPosted: Wed Dec 31, 2008 2:17 pm   Ermmm - where do I begin
 
If I copy your code - can you tell me where I put it in the Package Editor?
I create a new button....then what?

Sorry to seem so stupid - thanks for all your help
Reply with quote
Qaiia
Wanderer


Joined: 06 Apr 2007
Posts: 59

PostPosted: Wed Dec 31, 2008 2:20 pm   
 
Create a new button, then click the XML tab at the bottom and copy the XML above into the text editor and save it.

Be sure to get the most recent copy that I posted, I made a couple minor changes.
_________________
Citrus: The Juicy Alternative
Reply with quote
Qaiia
Wanderer


Joined: 06 Apr 2007
Posts: 59

PostPosted: Wed Dec 31, 2008 2:21 pm   
 
Oh, you may have to go into the button options tab to tell it which toolbar to display on.
_________________
Citrus: The Juicy Alternative
Reply with quote
Rebel
Novice


Joined: 29 Oct 2007
Posts: 33

PostPosted: Wed Dec 31, 2008 3:12 pm   
 
hmm - can't get button color to have any effect - %btncol seems to do nothing when i call it
Any ideas?
Reply with quote
Qaiia
Wanderer


Joined: 06 Apr 2007
Posts: 59

PostPosted: Wed Dec 31, 2008 3:27 pm   
 
You shouldn't have a problem if you paste in the code I posted above... it works just fine.

edit: Never mind, I guess you can't #CALL two functions inline... I added two more #CALL commands to perform the button coloring. See if that works.

The button should change color back to the original color when the #ALARM is up anyway.
_________________
Citrus: The Juicy Alternative
Reply with quote
Rebel
Novice


Joined: 29 Oct 2007
Posts: 33

PostPosted: Wed Dec 31, 2008 3:51 pm   
 
Many thanks - fine now
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