|
Christopher Beginner
Joined: 01 May 2004 Posts: 11 Location: USA
|
Posted: Wed May 05, 2004 7:03 am
Trigger(s) randomly stop working |
My hp/sp scanner and tick timer is as such:
hp: (%d)?(%d)? sp: (%d)?(%d)?
With a command line:
#gag
hp=%1
hpmax=%2
sp=%3
spmax=%4
#math hpercent {(%1*100)/%2}
#math spercent {(%3*100)/%4}
#math tick {@sp-@sp_old}
#IF (%3>@sp_old+200 & @tick<650) {
tick_calc
tick_start=%ctime
sp_old=%3
#ALARM {+10} {
#SAY "=========>"TICK IN 20 SECONDS"<========="
#color yellowgreen
}
#ALARM {+23} {
#SAY "=============>"TICK IN 5 SECONDS"<============="
#color 12
#t- sp_check
}
} {#if (%3>@sp_old+200) {
#say Ticked: [%eval( @sp-@sp_old)]
sp_old=%3
} {sp_old=%3}}
The problem is every once in awhile, usually while I'm editing triggers, but sometimes when I'm just playing, or even when I'm idle but connected, the trigger stops functioning, I notice this because the gag stops working and my status bar stops updating properly. If I close out of the window or Zmud, everything seems to reset properly. I'm running 7.05 and I was wondering if anyone else has been having these problems with the new version.
Thanks in advance. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Thu May 06, 2004 7:21 pm |
Triggers don't stop functioning without a cause.
One reason a specific trigger would stop firing is that its trigger pattern is no longer being sent from the MUD. Something similar to its pattern might be sent, but triggers only fire on exact matches.
Another potential cause is that you've disabled either the trigger or its class using #T- and haven't reenabled it.
I can't give you any specific advice because you've left out too many details, including samples of the MUD output, scripts for your status line and an alias called by the trigger, and the contents of an entire class. It seems quite possible that the actual problem is wherever your #T+ sp_check command is at. |
|
|
|
Christopher Beginner
Joined: 01 May 2004 Posts: 11 Location: USA
|
Posted: Fri May 07, 2004 5:09 pm |
Sorry for the carelessness, I'd forgotten about the built-in alias calls. The compete script is:
#gag
hp=%1
hpmax=%2
sp=%3
spmax=%4
#math hpercent {(%1*100)/%2}
#math spercent {(%3*100)/%4}
#math tick {@sp-@sp_old}
#IF (%3>@sp_old+200 & @tick<650) {
tick_end=%ctime
#math tick_time @tick_end-@tick_start
#if ((@tick_time>0) & (@tick_time<50) & (@tick<750)) {
tick_list=%additem( @tick_time, @tick_list)
#forall @tick_list {tick_avg=%eval( @tick_avg+%i)}
#math tick_avg {@tick_avg/(%numwords( @tick_list, "|"))}
#if (@tick_time<@tick_min) {tick_min=@tick_time}
#if (@tick_time>@tick_max) {tick_max=@tick_time}
}
#say Ticked: "["@tick"]" - Tick Avg/Min/Max: <@tick_avg>/<@tick_min>/<@tick_max> - Tick: "["@tick_time"]"
tick_start=%ctime
sp_old=%3
#ALARM {+10} {
#SAY "=========>"TICK IN 20 SECONDS"<========="
#color yellowgreen
}
#ALARM {+23} {
#SAY "=============>"TICK IN 5 SECONDS"<============="
#color 12
}
} {#if (%3>@sp_old+200) {
#say Ticked: [%eval( @sp-@sp_old)]
sp_old=%3
} {sp_old=%3}}
The mud output is:
hp: 1078(1078) sp: 2460(2460)
And the trigger:
hp: (%n)?(%n)? sp: (%n)?(%n)?
I've removed the #t- lines because they were doing something non-related. I tested this and again, it works for awhile, with some considerable lag because of the computations involved, and then stops working. I'm trying to replicate the errors, but I think its probably in the way I'm doing calculations that lags Zmud and then causes it to just stop working. |
|
|
|
Christopher Beginner
Joined: 01 May 2004 Posts: 11 Location: USA
|
Posted: Fri May 07, 2004 5:21 pm |
Incidentally, what I mean by lag is that the #gag command works perfectly until I actually tick, so I don't see any of the smaller hp/sp adjustments, but if I'm looking at the screen, when I tick, I see this:
hp: 1078(1078) sp: 2437(2460)
for a random number of seconds before the line gets 'replaced' with my "Ticked: []" spam:
Ticked: [202] - Tick Avg/Min/Max: 32/1/49 - Tick: [30]
Its very bizarre. |
|
|
|
nexela Wizard
Joined: 15 Jan 2002 Posts: 1644 Location: USA
|
Posted: Fri May 07, 2004 8:07 pm |
A few guesses that might/might not affect anything as I didn't fully try to understand the trigger :P
is the prompt option enabled on the trigger,
give your alarms Names ie #ALARM "name" {+23} {whatever here}
Try testing it by Disabling all other triggers and turning on the SHOW TRIGGERS options in Prefs
When trying to debug triggers removing #GAG might help you too
Quite possibly your computations could be slewing it up |
|
|
|
Christopher Beginner
Joined: 01 May 2004 Posts: 11 Location: USA
|
Posted: Sat May 08, 2004 3:42 pm |
Just as a follow up, one fix I made was clearing the accumulated tick lengths in the tick_list variable. Apparently I had over 1500 items in there, which slowed Zmud down to a crawl computationally. I didn't think it would, but when I reset that variable, most of my slow down problems disappeared.
It wasn't the #t- or #t+ or the #alarms as far as I could tell as I bug checked, it was simply that the variable and averaging process had each gotten so big that zmud choked on it, and in doing so, stopped reacting to that trigger and other triggers. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Sat May 08, 2004 5:07 pm |
A less time-consuming method of keeping averages:
#ADD tick_total @tick_time
#ADD tick_count 1
#MATH tick_avg (@tick_total/@tick_count)
You do know there's a builtin tick timer, don't you? |
|
|
|
Christopher Beginner
Joined: 01 May 2004 Posts: 11 Location: USA
|
Posted: Mon May 10, 2004 12:41 am |
Thanks Lightbulb,
I know there's a built-in tick timer, the problem is that I don't know how to use it on a mud that's doesn't have consistent ticks. I guess I'll think about it some more. If anyone has any suggestions for using the built-in tick timer, I'd love to hear them.
The pattern after I tick is:
hp: (%n)?(%n)? sp: (%n)?(%n)?
and I recognize when I tick by making sure the sp change is more than 200 but less than 650. |
|
|
|
LightBulb MASTER
Joined: 28 Nov 2000 Posts: 4817 Location: USA
|
Posted: Mon May 10, 2004 4:27 am |
Check the sp change before setting variables. The timer itself will do its best to sync with whatever ticks you detect. I don't know how well it will work, but it's worth a try.
Pattern: hp: (%n)?(%n)? sp: (%n)?(%n)?
Value:
#IF (((%3 - @sp) > 200) AND ((%3 - @sp) < 650)) {#TS}
hp = %1
hpmax = %2
sp = %3
spmax = %4 |
|
|
|
|
|