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
Draxx
Beginner


Joined: 24 Jan 2011
Posts: 11

PostPosted: Mon Feb 28, 2022 2:15 pm   

Timer display for spells cast at different powerlevels
 
Let's say you can cast a spell at various power levels, which will determine the duration of the spell effect.

Is there a way to set up various triggers so that when you cast the spell at different power levels, a small window with a countdown timer shows up, and then disappears when the countdown reaches zero seconds?

Of course the matching text for the trigger, and the timings for each powerlevel would have to be pre-defined.

I'd appreciate any guidance on how to do this, thanks.

For example :
cast 'sanctuary powerlevel 1' - duration = 60 secs
cast 'sanctuary powerlevel 2' - duration = 90 secs

And so on...

I do know that you can set up a trigger to just "tick" when the spell is going to end, but in this case, I would prefer an ongoing countdown timer, so that I can see when the spell is about to end, if I need to take some remedial action in the game.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4525
Location: Pensacola, FL, USA

PostPosted: Mon Feb 28, 2022 5:47 pm   
 
Possible, yes.

You would need to set a variable to the known duration

sanctuaryCountdown=60

You need an alarm to decrement all of these variables.

Code:
#ALARM "decrementor" -1 {
  #IF (@thisCountdown) {thisCountdown=(@thisCountdown-1)}
  #IF (@thatCountdown) {thatCountdown=(@thatCountdown-1)}
  }


And finally, you need to define the status window to display the info

#STWIN {%if(@this, %concat("This: ", @this)) %cr%if(@that, %concat("That: ", @that))}
_________________
Discord: Shalimar#3679
Reply with quote
Draxx
Beginner


Joined: 24 Jan 2011
Posts: 11

PostPosted: Tue Mar 01, 2022 8:48 am   
 
Hey Shalimar,
Thanks for the help, but I don't understand how to set up the triggers you've mentioned above.

Could you please elaborate a little more on how I can set this up?

For the sake of clarity, here are the triggers for when I cast the Sanctuary spell:
You utter the words, "sanc power1" (where the spell duration is 60 seconds)
You utter the words, "sanc power2" (where the spell duration is 90 seconds)
You utter the words, "sanc power3" (where the spell duration is 120 seconds)

Then, I can set up the triggers as:
#TRIGGER {^You utter the words, "sanc power1"} {#VAR SancTimer 60}
#TRIGGER {^You utter the words, "sanc power2"} {#VAR SancTimer 90}
#TRIGGER {^You utter the words, "sanc power3"} {#VAR SancTimer 120}

Then, when the spell actually gets cast, I want the timer to start, which is triggered by:
#TRIGGER {^You skin starts glowing.} {#ALARM "ST" -1 {SancTimer=(@SancTimer-1)}
#STWIN {#CONCAT(@SancTimer) %cr}

But this is creating multiple problems:
a) The timer doesn't stop when it gets to 0.
b) The separate window doesn't close when the timer gets to 0.
c) Even if I close the window manually, the timer keeps counting backwards in the mainscreen's statusbar.
d) Despite all of these issues, if I cast the spell again, the separate window opens up and shows 2 timers counting down.

I'd appreciate your guidance, thanks.
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4525
Location: Pensacola, FL, USA

PostPosted: Tue Mar 01, 2022 5:10 pm   
 
a. The alarm I made in my previous example should handle -ALL- of the various countdowns. It accounts for stopping at 0. Edit it to add the extra spell variables.
b. The individual spells should fade from the window when they reach 0 with my sample code. I would suggest docking the window in your layout.
c. A given status object can display on the bar or in the window, or both. Uncheck the bar if you only want to see it in the window.
d. You don't want to keep issuing the #STWIN command like that (you aren't matching my sample code so it won't look the same)
You want to edit the existing #STWIN object until all the spells you care to track are included. It should only show those spells not currently at 0

Are you using zMUD or CMUD?
_________________
Discord: Shalimar#3679
Reply with quote
shalimar
GURU


Joined: 04 Aug 2002
Posts: 4525
Location: Pensacola, FL, USA

PostPosted: Wed Mar 02, 2022 3:11 pm   
 
As to the trigger, rather than have four triggers simplify it to a single two-state trigger:

#TRIGGER {^You utter the words, "sanc power(%d)"} {}
#COND {^Your skin starts glowing.} {sancTimer=(30+(30*%t1))}
_________________
Discord: Shalimar#3679
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