[Home] [Downloads] [Search] [Help/forum]


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  General
. . -> [Subject]  Tick Timer trouble

Tick Timer trouble

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Gobbo   (5 posts)  [Biography] 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="^\&amp;lt;(.*?)hp (.*?)m (.*?)mv (.*?):(.*?)(am|pm)\&amp;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.
[Go to top] top

Posted by Gobbo   (5 posts)  [Biography] 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
[Go to top] top

Posted by Gobbo   (5 posts)  [Biography] 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="^\&lt;(.*?)\/(.*?)hp (.*?)\/(.*?)m (.*?)mv (.*?) (.*?) (.*?)\&gt;$"
   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
[Go to top] top

Posted by Meerclar   USA  (733 posts)  [Biography] 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
[Go to top] top

Posted by Gobbo   (5 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] 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
[Go to top] top

Posted by Gobbo   (5 posts)  [Biography] 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.
[Go to top] top

Posted by Nick Gammon   Australia  (22,973 posts)  [Biography] 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:


foo = "@myvariable"


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
[Go to top] 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.


19,738 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at HostDash]