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
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Mon Oct 13, 2003 8:23 am   

countdown timer
 


i am trying to make a button that is a countdown display

I use a button to trigger a spell effect, so i can add the amount of time i want to set the variable to to that button, but I am unsure how to manipulate it so that it becomes a count down timer.

can someone point me in the right direction

Naz
Reply with quote
Brujah
Wanderer


Joined: 13 Nov 2002
Posts: 88
Location: USA

PostPosted: Mon Oct 13, 2003 10:18 am   
 
not sure if thats even possible but if you provide more info im sure we can help you in some fashion.
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Oct 13, 2003 1:31 pm   
 
Include the variable in the button caption. After setting the variable to the desired number, use an alarm to decrease it.
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Mon Oct 13, 2003 5:11 pm   
 
quote:
Originally posted by LightBulb

Include the variable in the button caption. After setting the variable to the desired number, use an alarm to decrease it.




setting the variable and button caption i understand, but using the alarm to decrease it i am having trouble with

#CLASS {General|signscounter}
#ALIAS shieldscounter {#If (@shieldscounter >0) {#ALARM +1 {#add @shieldscounter (-1)}}}
#BUTTON 284 {@shieldscounter} {} {} {} {} {} {} {Size} {60} {17} {Pos} {3} {1138} {} {} {} {} "" {} {} {}
#CLASS 0


and use button to set @shieldcounter value when i use sign

#BUTTON 28 {Signs} {signs;#WIN Spelltracker {SHIELDS %time( t).};@shieldscounter = 200} {} {} {} {} {} {Size} {60} {17} {Pos} {0} {527} {124} {} {} {} "" {} {} {} {2}
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Oct 13, 2003 5:42 pm   
 
Don't use a one-time alarm. You want a repeating action. Use a repeating alarm. That's what I meant in my original suggestion.
#ALA *1 {#IF (@shieldscounter > 0) {#ADD shieldscounter -1} {#VAR shieldscounter 0}}
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Mon Oct 13, 2003 7:42 pm   
 
quote:
Originally posted by LightBulb

Don't use a one-time alarm. You want a repeating action. Use a repeating alarm. That's what I meant in my original suggestion.
#ALA *1 {#IF (@shieldscounter > 0) {#ADD shieldscounter -1} {#VAR shieldscounter 0}}




thats lightbulb that works a great.

I have a similar alarm that i use for my travel scripts


#ALARM {*1} {#IF (%numitems( @movement) AND (@rt = 0)) {
%item( @movement, 1)
#DELN movement 1
}}

but it wont run at the same time as the count down timer, is there anyway that it can be made to?

Naz
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Mon Oct 13, 2003 10:11 pm   
 
Give them IDs or combine them.
Reply with quote
Anabasis
Wanderer


Joined: 26 Jan 2001
Posts: 74

PostPosted: Tue Oct 14, 2003 3:39 pm   
 
You can also get the same effect with a conditional trigger that won't interfere with your existing alarm.

#TRIGGER (@shieldscounter>0) {} "" {notrig}
#COND {} {#ADD shieldscounter -1} {wait|param=1000}

Ana
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Tue Oct 14, 2003 5:33 pm   
 
quote:
Originally posted by LightBulb

Give them IDs or combine them.



i tried giving them both IDs using the ID in the options tab.
but it doesnt seem to fix the problem of not being able to run both.
I want to keep them as seperate scripts as i turn of the folder the travel alarm is in to control the script.
I carnt find any additional info in the help files to see what else i should be doing

Naz



#ALARM "colcounter" {*1} {#IF (@shieldscounter > 0) {#ADD shieldscounter -1} {#VAR shieldscounter 0}}

#ALARM "thetravelscript" {*1} {#IF (%numitems( @movement) AND (@rt = 0)) {%item( @movement, 1);#DELN movement 1}}
Reply with quote
mr_kent
Enchanter


Joined: 10 Oct 2000
Posts: 698

PostPosted: Tue Oct 14, 2003 8:33 pm   
 
quote:

#ALARM "colcounter" {*1} {#IF (@shieldscounter > 0) {#ADD shieldscounter -1} {#VAR shieldscounter 0}}

#ALARM "thetravelscript" {*1} {#IF (%numitems( @movement) AND (@rt = 0)) {%item( @movement, 1);#DELN movement 1}}



Since these alarms are both firing every second, why not just make one alarm that calls aliases?

#ALARM OneSecondCounter {*1} {#IF (%class(travelclass)) {Dothetravelscript};#IF (%class(colcounterclass)) {Dothegaugescript}}

#CLASS travelclass
#ALIAS Dothetravelscript {#IF (%numitems( @movement) AND (@rt = 0)) {%item( @movement, 1);#DELN movement 1}}
#CLASS 0

#CLASS colcounterclass
#ALIAS Dothegaugescript {#IF (@shieldscounter > 0) {#ADD shieldscounter -1} {#VAR shieldscounter 0}}
#CLASS 0
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Wed Oct 15, 2003 5:26 pm   
 
quote:
Originally posted by mr_kent
Since these alarms are both firing every second, why not just make one alarm that calls aliases?




here is what i tried, they both fire when run speratly but not still not at the same time

#CLASS {Travel|travelstuff|traveldisable}
#ALIAS Dothetravelscript {#IF (%numitems( @movement) AND (@rt = 0)) {%item( @movement, 1);#DELN movement 1}}
#CLASS 0

#CLASS {General|signscounter}
#ALIAS Dothegaugescript {#IF (@shieldscounter > 0) {#ADD shieldscounter -1} {#VAR shieldscounter 0}}
#CLASS 0

#CLASS {General|thecounter}
#ALARM "OneSecondCounter" {*1} {
#IF (%class( Travel|travelstuff|traveldisable)) {Dothetravelscript}
#IF (%class( General|signscounter)) {Dothegaugescript}
}
#CLASS 0
Reply with quote
LightBulb
MASTER


Joined: 28 Nov 2000
Posts: 4817
Location: USA

PostPosted: Fri Oct 17, 2003 3:59 am   
 
I pasted your script into a test window and ran it. It all works for me. It does seem like separate alarms would be simpler.
#CLASS {Travel|travelstuff|traveldisable}
#ALA "TravelCounter" {*1} {#IF (%numitems( @movement) AND (@rt = 0)) {%item( @movement, 1);#DELN movement 1}}
#CLASS {General|signscounter}
#ALA "ShieldCounter" {*1} {#IF (@shieldscounter > 1) {#ADD shieldscounter -1} {#VAR shieldscounter 0}}
#CLASS 0
Reply with quote
nazradin
Apprentice


Joined: 23 Mar 2003
Posts: 114
Location: New Zealand

PostPosted: Sun Oct 19, 2003 5:36 pm   
 
quote:
Originally posted by LightBulb

I pasted your script into a test window and ran it. It all works for me. It does seem like separate alarms would be simpler.
#CLASS {Travel|travelstuff|traveldisable}
#ALA "TravelCounter" {*1} {#IF (%numitems( @movement) AND (@rt = 0)) {%item( @movement, 1);#DELN movement 1}}
#CLASS {General|signscounter}
#ALA "ShieldCounter" {*1} {#IF (@shieldscounter > 1) {#ADD shieldscounter -1} {#VAR shieldscounter 0}}
#CLASS 0




thanks lightbulb that works great, i deleted and reentered all my 1 second alarms as alais running off 1 alarm but still couldnt get it to work that way, deleting everything and doing seperate alarms now works.

Thanks Naz
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