Notice: Any messages purporting to come from this site telling you that your password has expired, or that you need to verify your details, confirm your email, resolve issues, making threats, or asking for money, are
spam. We do not email users with any such messages. If you have lost your password you can obtain a new one by using the
password reset link.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ General
➜ Tick Timer trouble
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Gobbo
(5 posts) Bio
|
Date
| Sat 10 Oct 2015 06:49 AM (UTC) Amended on Sat 10 Oct 2015 07:30 AM (UTC) by Gobbo
|
Message
| I know very little about writing script but I pulled this off of the forum where I play. Been changing stuff around all night to get it to work and nothing. Basically, I dont know if the trigger is firing off correctly. The timer doesn't get reset so I am guessing not, but once I start it I get the "TICK IN 7 SECONDS!" spam every 34 seconds until I turn it off.
Trigger said:
<triggers>
<trigger
enabled="y"
group="Timer"
keep_evaluating="y"
match="^\&lt;(.*?)hp (.*?)m (.*?)mv (.*?):(.*?)(am|pm)\&gt;$"
name="TickTimer"
regexp="y"
sequence="100"
>
<send>now = "%5"
if(now ~= GetVariable('time')) then
ResetTimer('TickTimer')
SetVariable('time', "%5")
end -- if</send>
</trigger>
</triggers>
Timer said:
<timers>
<timer name="TickTimer" enabled="y" second="34.00" offset_second="0.00" send_to="12"
group="Tick" >
<send>Note("TICK IN 7 SECONDS!")
Note("TICK IN 7 SECONDS!")
Note("TICK IN 7 SECONDS!")</send>
</timer>
</timers>
Variable said:
<variables>
<variable name="time">8:30pm</variable>
</variables>
Here is what my screen looks like:
<74hp 131m 124mv 9:30pm>
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
A gully dwarf walks southeast.
<74hp 131m 124mv 9:30pm>
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
<74hp 131m 124mv 10:00pm>
A gray wolf cub walks southeast.
<74hp 131m 124mv 10:00pm>
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
A gully dwarf walks in.
<74hp 131m 124mv 10:30pm>
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
<74hp 131m 124mv 11:00pm>
All of those messages are exactly 34 seconds apart, instead of resetting like they should. | Top |
|
Posted by
| Gobbo
(5 posts) Bio
|
Date
| Reply #1 on Sat 10 Oct 2015 07:11 AM (UTC) |
Message
| Oh, I forgot to close the match once and ended up spitting the trigger code out into the world but as you can see now = 00 then it updates as the tick happens to = 30... My only guess is that for whatever reason my variable is not getting set properly and so the timer isn't resetting. Anyway, been at this for like 6 hours tonight, time for rest.
<74hp 131m 124mv 9:00am> Huh?
now = "00"
if(now ~= GetVariable('time')) then
ResetTimer('TickTimer')
SetVariable('time', "00")
end -- if
<74hp 131m 124mv 9:00am> Huh?
now = "00"
if(now ~= GetVariable('time')) then
ResetTimer('TickTimer')
SetVariable('time', "00")
end -- if
<74hp 131m 124mv 9:00am>
now = "00"
if(now ~= GetVariable('time')) then
ResetTimer('TickTimer')
SetVariable('time', "00")
end -- if
<74hp 131m 124mv 9:30am> Huh?
now = "30"
if(now ~= GetVariable('time')) then
ResetTimer('TickTimer')
SetVariable('time', "30")
end -- if
<74hp 131m 124mv 9:30am> Huh?
now = "30"
if(now ~= GetVariable('time')) then
ResetTimer('TickTimer')
SetVariable('time', "30")
end -- if
<74hp 131m 124mv 9:30am> Huh?
now = "30"
if(now ~= GetVariable('time')) then
ResetTimer('TickTimer')
SetVariable('time', "30")
end -- if | Top |
|
Posted by
| Gobbo
(5 posts) Bio
|
Date
| Reply #2 on Sat 10 Oct 2015 08:34 AM (UTC) Amended on Sat 10 Oct 2015 08:58 PM (UTC) by Nick Gammon
|
Message
| Sorry for the spam.. Read your XML guide to pasting so thought I'd try again. No luck.
<triggers>
<trigger
enabled="y"
group="Timer"
keep_evaluating="y"
match="^\<(.*?)\/(.*?)hp (.*?)\/(.*?)m (.*?)mv (.*?) (.*?) (.*?)\>$"
name="TickTimer"
regexp="y"
send_to="12"
sequence="100"
variable="health"
>
<send>now = "%8"
if(now ~= GetVariable('time')) then
ResetTimer('TickTimer')
SetVariable('time', "%8")
end -- tick</send>
</trigger>
</triggers>
<timers>
<timer name="TickTimer" enabled="y" second="34.00" offset_second="0.00" send_to="12"
group="Tick" >
<send>Note("TICK IN 7 SECONDS!")
Note("TICK IN 7 SECONDS!")
Note("TICK IN 7 SECONDS!")</send>
</timer>
</timers>
<variables>
<variable name="time">8:30pm</variable>
</variables>
Here is a trace of it the timer just firing every 34 seconds.
Prompt set to %h/%Hhp %m/%Mm %v/%Vmv %X %S %t %c %r %e
74/74hp 131/131m 124/124mv 136 Normal 12:30am
The Entrance to the Academy NS
74/74hp 131/131m 124/124mv 136 Normal 1:00am
The Entrance to the Academy NS
TRACE: Fired timer TickTimer
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
74/74hp 131/131m 124/124mv 136 Normal 1:30am
The Entrance to the Academy NS
TRACE: Fired timer TickTimer
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
TRACE: Fired timer TickTimer
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
74/74hp 131/131m 124/124mv 136 Normal 2:00am
The Entrance to the Academy NS
TRACE: Fired timer TickTimer
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
74/74hp 131/131m 124/124mv 136 Normal 2:30am
The Entrance to the Academy NS
TRACE: Fired timer TickTimer
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
TICK IN 7 SECONDS!
[EDIT] code tags added | Top |
|
Posted by
| Meerclar
USA (733 posts) Bio
|
Date
| Reply #3 on Sat 10 Oct 2015 12:58 PM (UTC) Amended on Sat 10 Oct 2015 01:03 PM (UTC) by Meerclar
|
Message
| Take a look at http://www.gammon.com.au/forum/?id=4956 for how to build in the 7 second delay before your reset. As for the spam every 34 seconds, that's exactly what you wrote the script to do so it's functioning properly in that regard. |
Meerclar - Lord of Cats
Coder, Builder, and Tormenter of Mortals
Stormbringer: Rebirth
storm-bringer.org:4500
www.storm-bringer.org | Top |
|
Posted by
| Gobbo
(5 posts) Bio
|
Date
| Reply #4 on Sat 10 Oct 2015 04:40 PM (UTC) |
Message
|
Meerclar said:
Take a look at http://www.gammon.com.au/forum/?id=4956 for how to build in the 7 second delay before your reset. As for the spam every 34 seconds, that's exactly what you wrote the script to do so it's functioning properly in that regard.
Yes but the Timer is supposed to reset here:
ResetTimer('TickTimer')
which would start it over. I know this script used to work, I think I have something messed up with the trigger itself because it isn't firing, if you look at the TRACE in the last post you can see that, only the timer is firing. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #5 on Sat 10 Oct 2015 09:00 PM (UTC) |
Message
| Your trigger is looking for < ... > but I don't see those symbols in your prompt. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
Posted by
| Gobbo
(5 posts) Bio
|
Date
| Reply #6 on Wed 21 Oct 2015 11:25 AM (UTC) Amended on Wed 21 Oct 2015 08:06 PM (UTC) by Nick Gammon
|
Message
| Thanks for the reply Nick. After doing some more testing and removing the ;lt ;gt and continuing to run trace I have the trigger now firing properly. That being said I still cannot get it to reset the timer.
edit: just figured it out, yes! Not sure why this wasn't changing the variable properly though.
edit2: Nevermind.. Yes it does work if I don't use any commands, but once my prompt is shown again it keeps resetting the timer. So I need to get that setvariable to work properly.
<triggers>
<trigger
enabled="y"
expand_variables="y"
group="Timer"
keep_evaluating="y"
match="(.*?)/(.*?)hp (.*?)/(.*?)mana (.*?)/(.*?)mv (.*?) (.*?) (.*?):(.*?)(am|pm)"
name="TickTimer"
regexp="y"
send_to="12"
sequence="100"
variable="health"
>
<send>now = "%10"
if(now ~= GetVariable('time')) then
ResetTimer('TickTimer')
end -- if</send>
</trigger>
</triggers>
SetVariable('time', "%10") <--- this was right below ResetTimer('TickTimer')
I just took that out and now it works. Any idea why it wasn't working though.. that is how the original person who made this had it written.
[EDIT] Added code tags. | Top |
|
Posted by
| Nick Gammon
Australia (23,158 posts) Bio
Forum Administrator |
Date
| Reply #7 on Wed 21 Oct 2015 08:09 PM (UTC) |
Message
| You don't really need "expand_variables="y"" because you are not expanding variables inside that trigger. Expanding variables looks like this:
Quote:
SetVariable('time', "%10") <--- this was right below ResetTimer('TickTimer')
Right below, or after the "end"? |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | Top |
|
The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).
To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.
23,836 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top