catching a phrase to reset a timer

Posted by Scouse on Mon 24 Jan 2005 12:10 AM — 18 posts, 72,982 views.

#0
Im trying to remember how to capture a line from the world to reset a timer.
I need to be able to match on more than one line (propbably 12 or 13) so it should be expandable . I know this is easy , a trigger can do it , I just cant remember how :(
also , how do i set the timer so that the timer sends me my tic warning 5 seconds before it tics ?


thanks
Scouse
#1
erm , i just re read it , i dont mean 12 or 13 lines in a row , I mean for example ..

The night has begun. would be one line .
The sun rises in the east . would be another etc , etc
USA #2
Put them all into a trigger (as regexps) with | in between them. You can also use a variable and a trigger to do it, which is easier if you need to change it frequently. Details about that can be found here:
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=4603

To reset a timer, you just call ResetTimer(TimerName).

As for tics, it depends on the timing, you can use the trigger offset to give you a "five second warning" assuming you can syncronize the timer with the server. (Set the timer for 1 minute, with a 5 second offset, if the tics are one minute apart, but youll need a trigger to get it in synch when you connect (and keep it if the server lags, or whatnot)).
#3
heh , I got up to page 35 before I discovered most of what you said :)
appreciate the help tho :)
erm , world reset timer goes to command line im assuming ?
USA #4
Page 35 of what?

No, it goes in a script. Or something that eventually gets to the script engine. So either a subroutine in a script file, or the send box with sendto script.
#5
page 35 of questions in this forum :P

so , now the question becomes , how do I reset the timer with what ive triggered from the mud ?
ie , where do I send what ive go to ? and what would the script be ?
#6
WOOT !
I figured it out ...

enabled vbscript
trigger catches "The day has begun" etc
/world.resettimer Tictimer ( where tictimer is the name i gave it ) gets sent to world
tictimer resets :)
simplicity itself no wi know how lol :D

Thanks for the help flannel
USA #7
The 'real' way of doing it is change the "send to" to script, and then remove your script prefix (/).

And actually, you'd have to send to execute for your current set up to work.
#8
^(* bellows 'Midnight, *|The night has begun.|Saving all threads *|The ratter bellows 'Twelve *)

ok , thats what ive got for a trigger , but now when i try and switch it to a regular expression , it says error occured at column 3 .

I switched it as ya said to send to script .

Ste
USA #9
Regexps are different than normal triggers.

In a regexp * is a quantifier, not a wildcard.

You need to replace * with .*
You also might try using the convert to regexp function for each line (or for all of them, but then youll have to go through un-escaping the pipes(|)).

A couple of your other characters need to be escaped as well. Such as the periods, you escape it with a slash.
\. will match on "."

You can read up on Regexp syntax in teh VBScript Docs, or plenty of other places, Nick uses PCRE which is a standard form.

Edit:
If you're creating this from an alias, you can use the MakeRegularExpression function to convert things to a regexp before you append them. You don't need to worry about this I dont think, since I believe you're hard coding the trigger. But just so you know.
Amended on Tue 25 Jan 2005 07:04 PM by Flannel
USA #10
Hi, Im not great at programming, all I know is html and Vbasic From about... 13 years ago or so? Anyways, not asking for you guys to do the work for me, but if you could point me to the right starting points, I think this is the best place to ask what im looking for.

K, I want a 60 sec tic timer that gives me a 10 second tic warning through the method of a tell in the mud using the command "Gtell <<<-!Tic in 10 seconds!->>>"

I need the commands that reset the ticcer/sink it to the mud to be allong the lines of

"dakina closes her prayer book" but instead of dakina, I need it to work if anyone in the room closes the book, also same for the gender,

And that would be something the mud would output (I think Im using all the terms correctly at the moment)

Can you help me with how I would set this up? Where I would find how I can learn to set this up? ive set allot of things in mushclient so far and am really likeing it, espessially since I've attached sounds to actions, but this is probable the desiding facter here on figuring out not only tic timers, but also what I think are called wild cards or variables.

Thanks for the time.
Australia Forum Administrator #11
My initial reaction is that you need a trigger that matches on something like:


* closes * prayer book



That does a "send to script" along the lines of:


DoAfter (50, "Gtell <<<-!Tic in 10 seconds!->>>")


See: http://www.gammon.com.au/scripts/doc.php?function=DoAfter

It seems to me that if you want a 10-second warning before 60 seconds is up, you need a 50-second timer.
USA #12
OK, dont know if I explained it well. lets try again.

A tick is 60 seconds, because the mud is laggy and tics can exceed 60 seconds sometimes, I need triggers to reset my tick timmer such as


"the sun lights the sky"
"closes * spellbook"
"Closes * prayer book"
"you are hungry"
"you are thirsty"

Im not sure how to put this into the timer so it resets the count to 60 seconds from one of these events occuring.

I think the way to get my 10 second warning is to have a 60 second timer with a 10 second offset command to the mud of gtell tic in 10ish seconds.


Im just not sure how?where to insert the triggers that effect the timmer. i Downloaded the arctic mud timmer made by someone or the other thats listed on this sight, its a jave script file with xmp (I think) as the file type. I currently have it active on the mud but its not working correctly, I think because I dont have it set right in the timmer file or something, but dont know java script so dont know how to add to it or correct it.


A sample of what I want to see on the mud is:

123h 123v 1x 1c news> (this is the command prompt)
You tell the group "tic in 10 seconds"
(10 seconds latter)
You close your prayer books with a content smile on your face.
tic timmer reset
(50 seconds latter)
You tell the group "Tic in 10 seconds" (and so fourth)
Australia Forum Administrator #13
Quote:

I think the way to get my 10 second warning is to have a 60 second timer with a 10 second offset command to the mud of gtell tic in 10ish seconds.


What was wrong with my idea of having the timer go off after 50 seconds?
USA #14
Are you saying have the timer be 50 seconds, or the offset? I thought what the offset does is warn you X seconds before timer ticks over
Australia Forum Administrator #15
No, it doesn't warn you of anything. All it does is offset the initial timer time. For example, say you wanted to say;


smile (wait 20 seconds)
laugh (wait 20 seconds)
clap (wait 20 seconds)


Now to do that you would add 3 timers, the first is "smile" with 60 second interval, and 0 seconds offset.

The second is "laugh" with 60 second interval, and 40 seconds offset.

The third is "clap" with 60 second interval, and 20 seconds offset.

Now each emote is done once a minute, but "staggered" during that minute by the offset amount.

So, I am suggesting making the timer interval 50 seconds, as you really want to be warned 50 seconds after the event that sets the timer up.

The offset is subtracted from the fire time, so the larger the offset, the closer to the "reset point" the timer fires.
Amended on Thu 30 Nov 2006 04:25 AM by Nick Gammon
USA #16
Ok, so I think I might get it,
I want to the tick to keep firing every 60 seconds, I do the offset 50 seconds, so it fires the gtell 50 seconds after the action that reset the timmer? Right?

Ok, now, how do I use this jscript file I have to reset the timmer, do I have to specifie in the file the timmer name, or add the file in the script section of the timmer somehow, or should a script file be compleatly independant of the timmer, and just make the timmer entirerly in the script file?

(I found a websight that teaches jscript for free so Im in the process of updating the timmer for arctic mud thats listed on the arctic part of the mushclient forum)

Ok, thanks, sorry to be such a pain.
Australia Forum Administrator #17
Quote:

I want to the tick to keep firing every 60 seconds, I do the offset 50 seconds, so it fires the gtell 50 seconds after the action that reset the timmer? Right?


After checking the code the offset is subtracted, so if you have a 60-second timer, but want it to fire 50 seconds after being reset, then the offset will be 10 seconds.

To reset the timer, use ResetTimer, see:

http://www.gammon.com.au/scripts/doc.php?function=ResetTimer