Creating a Tick Timer Using "resettimer" and trigger

Posted by Ged on Sun 09 Sep 2012 11:50 PM — 12 posts, 43,516 views.

#0
Hi,

I'm completely new to scripting or coding, and I'd like help how to make a tick timer, and in doing so, maybe I'll learn the basics and make other fun triggers.

Right now I'm trying to make a trigger that tracks ticks in the MUD. The ticks are about 60 seconds, although never the same. My plan was to make a 60 second timer, and then a trigger that resets the timer each time a spell wears of (You feel less protected).

So here are some of my questions. For my timer, how do I set the name that the trigger will use? Is it the "label", "script", "group", or "variable" field?

As for the trigger itself...I have no clue where to start! I tried to put "You feel less protected" in the "trigger" field and in "send:" I put "ResetTimer("ticktimer")". I put "send to:" to "lua".

It's not working at all. Any pointers?

Thanks in advance for your time.



Ged
Australia Forum Administrator #1
Let's see the whole thing:

Template:copying
For advice on how to copy aliases, timers or triggers from within MUSHclient, and paste them into a forum message, please see Copying XML.


And copy and paste the exact MUD output.
#2
This is the trigger I use to periodically reset the timer since each tick is not exact in length (it's around 60 seconds).


<triggers>
  <trigger
   enabled="y"
   match="You are hungry."
   send_to="12"
   sequence="100"
  >
  <send>ResetTimer("ticktimer")
</send>
  </trigger>
</triggers>


This is the timer itself.



<timers>
  <timer name="ticktimer" enabled="y" minute="1" second="0.00" offset_second="0.00"    variable="ticktimer"
>
  <send>&lt;tic&gt; &lt;tic&gt; &lt;tic&gt;</send>

  </timer>
</timers>


What does "MUD output" mean?
USA Global Moderator #3
Ged said:
What does "MUD output" mean?


MUD n.
A computer program, usually running over the Internet, that allows multiple users to participate in virtual-reality role-playing games.

output n.
The information produced by a computer.
#4
Ged said:

What does "MUD output" mean?


Fiendish said:

MUD n.
A computer program, usually running over the Internet, that allows multiple users to participate in virtual-reality role-playing games.

output n.
The information produced by a computer.


He sometimes forgets to treat those of us who don't speak his exact language with patience, but it's okay; we're tough.

What Nick meant is to please post _exactly_ what message(s) your game sends to indicate that a spell has worn off.
#5
Ah, thanks for putting it in layman's terms.

The outputs I'd use are:

You feel less righteous.
You feel less protected.
You feel weaker.
You are hungry.

Basically, I want to reset the 60 second ticktimer when any of these messages are output by the game.

Australia Forum Administrator #6
First, don't you just want to see the tick in the output window? So how about making it "send to output"?


<timers>
  <timer name="ticktimer" 
         enabled="y" 
         minute="1" 
         send_to="2"
>
  <send>&lt;tic&gt; &lt;tic&gt; &lt;tic&gt;</send>

  </timer>
</timers>
Australia Forum Administrator #7
Ged said:

The outputs I'd use are:

You feel less righteous.
You feel less protected.
You feel weaker.
You are hungry.


I tested your trigger with:



You are hungry.


It reset back to 1 minute to go. So it works. But is this literally the MUD output? I asked for the MUD output, you said "The outputs I'd use are ...".

What I mean is, to copy and paste actual MUD output (preferably in context) so it looks real.

eg.


The Shining Emerald
A locked display box dominates this particular shop.  Under the glass
of the box are a myriad of gems, each lying gently upon a miniscule cushion.
Hanging from the walls are various paintings, while sculptures take up the
rest of the floor space.  To the east is Darkhaven's courier, while an
opening in the tent to the north leads back out onto Market Street.
Exits: north east.
The jeweler smiles warmly.
<24hp 145m 110mv>
You are hungry.
<24hp 145m 110mv>


You see? What you actually see on the screen. Maybe there's a space after "hungry". Maybe there is a prompt, like:


<24hp 145m 110mv> You are hungry.


By asking for the actual MUD output I can test your trigger against what you actually see.
Amended on Sun 23 Sep 2012 03:55 AM by Nick Gammon
#8
First of all, thank you for the patience and the prompt reply.

Quote:
But is this literally the MUD output?

Yes, these are the literal outputs.

Quote:
I asked for the MUD output, you said "The outputs I'd use are ...".

Well, I figured to ask using just one output as an example and then I would use what I learned to make the timer reset from these other triggers.

Quote:
What I mean is, to copy and paste actual MUD output (preferably in context) so it looks real.



There are 5 visible players connected.
With a boot time high of 9 players.

< 349hp 250mana 191mv > 
You are hungry.
You are thirsty.

< 349hp 250mana 196mv > 
Ged steps out of his private chamber.

< 349hp 250mana 196mv > 
Tenar steps out of her private chamber.
Australia Forum Administrator #9
That should work. Try adding a note to confirm the timer was reset:


<triggers>
  <trigger
   enabled="y"
   match="You are hungry."
   send_to="12"
   sequence="100"
  >
  <send>
ResetTimer("ticktimer")
Note ("Tick timer reset.")
</send>
  </trigger>
</triggers>


Check all triggers are enabled. Also is there another trigger that might match on "You are hungry."?

I saw this on your posted data:


There are 5 visible players connected.
With a boot time high of 9 players.
< 349hp 250mana 191mv > 
You are hungry.
Tick timer reset.
You are thirsty.
< 349hp 250mana 196mv > 
Ged steps out of his private chamber.
< 349hp 250mana 196mv > 
Tenar steps out of her private chamber.



Go to the Game menu -> Trace (turn that on).

Then you should see:


< 349hp 250mana 191mv > 
You are hungry.
TRACE: Matched trigger "You are hungry."
Tick timer reset.
You are thirsty.


If not, did it match a different trigger?
#10
Quote:
Then you should see:


< 349hp 250mana 191mv > 
You are hungry.
TRACE: Matched trigger "You are hungry."
Tick timer reset.
You are thirsty.


If not, did it match a different trigger?


I tested it and it matches! Okay, so my next question is:

For the timer itself:



<timers>
  <timer name="ticktimer" enabled="y" minute="1" second="0.00" offset_second="0.00"    send_to="2"
   variable="ticktimer"
>
  <send>TICK</send>

  </timer>
</timers>


I basically just have it send the message "TICK". I would like to instead send a message of the time when the tick occurs, like, "Tick: 5:57:12". Is that possible?
Australia Forum Administrator #11

<timers>
  <timer name="ticktimer" 
        enabled="y" 
        minute="1"
        send_to="12"
>
  <send>print ("Tick:", os.date ())</send>

  </timer>
</timers>



Template:pasting
For advice on how to copy the above, and paste it into MUSHclient, please see Pasting XML.