Shorlen2006-09-17 04:01:20
QUOTE(Abethor @ Sep 16 2006, 10:36 PM) 332094
And I've written a little Alias for Nexus to get my demesne effects timed. It works great. Thanks for the help, Shorlen!
Welcome! You might also want to count silently to yourself to track how soon your demesne is going to hit, and just before it hits, hitting them with something, since the stun from jellies will keep them from doing anything about it immediately.
Shorlen2006-09-18 00:35:56
A little bit of code I wrote to track when my druidic demesne is about to hit. The first value is the swarm/treelife timer, and the second value is the thorns timer. All other demsne skills should strike with one or the other.
#alias showtime {
  time=1
  #alarm "timealarm" 1 {time=%eval( %mod( %eval( (10+@time)-1), 10))}
  #t+ demesnetime
  demesne
}
#alias stoptime {
  #alarm "timealarm" +1 {}
  #t- demesnetime
}
#CLASS {demesnetime}
#TRIGGER {^Swarm%s(%d)} {time=%mod( %1, 10)}
#TRIGGER {^Flying insects suddenly swarm %w, covering %w with} {time=0}
#STAT {| Demesne: @time / %mod( %eval( @time+1), 10) |}
#CLASS 0
CODE
#alias showtime {
  time=1
  #alarm "timealarm" 1 {time=%eval( %mod( %eval( (10+@time)-1), 10))}
  #t+ demesnetime
  demesne
}
#alias stoptime {
  #alarm "timealarm" +1 {}
  #t- demesnetime
}
#CLASS {demesnetime}
#TRIGGER {^Swarm%s(%d)} {time=%mod( %1, 10)}
#TRIGGER {^Flying insects suddenly swarm %w, covering %w with} {time=0}
#STAT {| Demesne: @time / %mod( %eval( @time+1), 10) |}
#CLASS 0
Abethor2006-09-19 03:13:22
QUOTE(Shorlen @ Sep 17 2006, 07:35 PM) 332505
A little bit of code I wrote to track when my druidic demesne is about to hit. The first value is the swarm/treelife timer, and the second value is the thorns timer. All other demsne skills should strike with one or the other.
CODE
#alias showtime {
  time=1
  #alarm "timealarm" 1 {time=%eval( %mod( %eval( (10+@time)-1), 10))}
  #t+ demesnetime
  demesne
}
#alias stoptime {
  #alarm "timealarm" +1 {}
  #t- demesnetime
}
#CLASS {demesnetime}
#TRIGGER {^Swarm%s(%d)} {time=%mod( %1, 10)}
#TRIGGER {^Flying insects suddenly swarm %w, covering %w with} {time=0}
#STAT {| Demesne: @time / %mod( %eval( @time+1), 10) |}
#CLASS 0
Wow....I don't really know much about coding, I'm taking a class on it now, but this looks really deep.
Shorlen2006-09-19 06:56:32
QUOTE(Abethor @ Sep 18 2006, 11:13 PM) 333019
Wow....I don't really know much about coding, I'm taking a class on it now, but this looks really deep.
Not really... that's rather simple, actually.
(This is an alias called showtime)
#alias showtime {
(this sets the variable "time" to 1)
time=1
(this creates a timer called "timealarm" that fires every second and subtracts 1 from time. However, if time is 0, it makes time 9 instead of -1 using the modulus operator, which divides and returns the remainder. So, if time was 4, (10+4)-1 is 13. 13 mod 10 = 3, because 13/10 leaves a remainder of 3. If time was 0, (10+0)-1 is 9. 9 mod 10 is 9. The reason for the adding of 10 is because zMUD considers -1 mod 10 equal to -1, not 9 like it should.)
#alarm "timealarm" 1 {time=%eval( %mod( %eval( (10+@time)-1), 10))}
(this turns on the class folder named "demesnetime")
#t+ demesnetime
(this runs the "demesne" command which looks at the time remaining on your demesne effects)
demesne
}
#alias stoptime {
(this makes "timealarm" into a timer that fires only one one second from now, effectively deleting the timer in a second. It's the simplest way I've found to delete timers, though there's probably a better way)
#alarm "timealarm" +1 {}
(this disables the demesnetime class folder)
#t- demesnetime
}
(this is the demesnetime class folder)
#CLASS {demesnetime}
(this says, when you check DEMESNE and see when Swarm is going to hit next, set the "time" variable equal to the time before it hits. Effects hit when the one's digit of the time remaining is 0. So, again, a simple use of the modulus function. mod 10 gets the one's digit.)
#TRIGGER {^Swarm%s(%d)} {time=%mod( %1, 10)}
(this says, when this swarm demesne effect hits, set the time variable to 0, the value that means "swarm just hit")
#TRIGGER {^Flying insects suddenly swarm %w, covering %w with} {time=0}
(display in the status bar just above the input line how long until the demesne fires. @time is the time Swarm/Treelife/Pollen/Spores hit for me. Then, display the time the other effects (thorns, storm, squirrels) fire, which is time+1 for me. Mod 10, of course, so that 9+1 shows up as 0. %eval just, among other things, evaluates an expression and returns the result. So %eval(9+1) returns 10.
#STAT {| Demesne: @time / %mod( %eval( @time+1), 10) |}
(close the class)
#CLASS 0
If you thought that was complicated, don't even look at my curing system, or even my prompt trigger