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 ➜ Creating a Tick Timer Using "resettimer" and trigger

Creating a Tick Timer Using "resettimer" and trigger

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


Posted by Ged   (5 posts)  Bio
Date Sun 09 Sep 2012 11:50 PM (UTC)
Message
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
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 11 Sep 2012 12:56 AM (UTC)
Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Ged   (5 posts)  Bio
Date Reply #2 on Wed 12 Sep 2012 02:58 AM (UTC)
Message
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?
Top

Posted by Fiendish   USA  (2,555 posts)  Bio   Global Moderator
Date Reply #3 on Wed 12 Sep 2012 04:21 AM (UTC)
Message
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.

https://github.com/fiendish/aardwolfclientpackage
Top

Posted by Manacle   (28 posts)  Bio
Date Reply #4 on Wed 12 Sep 2012 08:44 AM (UTC)
Message
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.
Top

Posted by Ged   (5 posts)  Bio
Date Reply #5 on Sun 23 Sep 2012 02:22 AM (UTC)
Message
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.

Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #6 on Sun 23 Sep 2012 03:50 AM (UTC)
Message
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>

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #7 on Sun 23 Sep 2012 03:54 AM (UTC)

Amended on Sun 23 Sep 2012 03:55 AM (UTC) by Nick Gammon

Message
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.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Ged   (5 posts)  Bio
Date Reply #8 on Tue 25 Sep 2012 01:41 AM (UTC)
Message
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.
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #9 on Tue 25 Sep 2012 11:14 PM (UTC)
Message
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?

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Ged   (5 posts)  Bio
Date Reply #10 on Sat 29 Sep 2012 09:57 PM (UTC)
Message
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?
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #11 on Sat 29 Sep 2012 11:33 PM (UTC)
Message

<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.

- 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.


41,323 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.