Register forum user name Search FAQ

Gammon Forum

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 ➜ Timer problem

Timer problem

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


Posted by Shinth   (10 posts)  Bio
Date Mon 06 Aug 2007 06:20 AM (UTC)
Message
I am having troubles with a temporary timer that is created inside a trigger, I just can't get it to work. The timer is

AddTimer ("fst_drink",0,0,1,"",timer_flag.Enabled + Timer_flag.OneShot,"resdrink(fst_drink)")

and the function

function resdrink(name)
Note "Enters Function"
if name == fst_drink then
	Note "Checks name"
	if GetVariable("flag_drink") == "1" then 
		SetVariable("flag_drink", "0")
		Note "Checks variable and changes it"
	end
end
end

I have put the little notes to check if the function works.
The weird thing is, if I call the function from the immediate window, it works great, but it doesn't work from the timer. I have checked the send to script option in the trigger window, so that isn't the problem. Any help would be much apreciated.
Top

Posted by Shaun Biggs   USA  (644 posts)  Bio
Date Reply #1 on Mon 06 Aug 2007 07:00 AM (UTC)

Amended on Mon 06 Aug 2007 07:06 AM (UTC) by Shaun Biggs

Message
If that's how you're adding it through the script, then the timer doesn't send to script. For that to work properly, either change the send_to with SetTimerOption, or better yet, add the trigger with the ImportXML function


ImportXML
[[
<timers>
  <timer name="fst_drink"
         enabled="y" 
         second="1" 
         send_to="12"
         one_shot="y" >
  <send>resdrink(fst_drink)</send>
  </timer>
</timers>
]]


It is much easier to fight for one's ideals than to live up to them.
Top

Posted by Shinth   (10 posts)  Bio
Date Reply #2 on Mon 06 Aug 2007 08:57 AM (UTC)

Amended on Wed 08 Aug 2007 01:34 AM (UTC) by Nick Gammon

Message
I've got it to work, the problem was that I couldn't send the name of the timer to the function it called.
Edit: the correct timer, in case someone finds it useful:

AddTimer ("fst_drink",0,0,1,"",timer_flag.Enabled + 
Timer_flag.OneShot,"resdrink")

and the function

function resdrink(name,output,wildcards)
  if GetVariable("flag_drink") == "1" then 
	SetVariable("flag_drink", "0")
  end
end
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.


12,345 views.

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

Go to topic:           Search the forum


[Go to top] top

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