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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Tips and tricks
. . -> [Subject]  Timestamps

Timestamps

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


Posted by Daniel Phillips   (3 posts)  [Biography] bio
Date Tue 31 May 2005 08:41 PM (UTC)
Message
Is there a way to trigger timestamps on MUSHclient?

I'd like to trigger such actions as...

You hurl a knife a Dingus

You regain your balance.

You jab Dingus

Your mind is now focused.

and many other things of that nature. I would enjoy it if there was set up to look much like[minute:second:milliseconds] if at all possible.

Muchas Nachos!
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #1 on Tue 31 May 2005 08:49 PM (UTC)

Amended on Tue 31 May 2005 08:50 PM (UTC) by Flannel

Message
What do you want?

You mean send things at certain times? or do you want to trigger those things, and then display the times they occurred?

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Tsinghahla   Sweden  (14 posts)  [Biography] bio
Date Reply #2 on Wed 01 Jun 2005 09:05 PM (UTC)
Message
Hmm..like..

Quote:
[Start Timestamp]

Jab Flannel-/00:00:00

You have recovered balance-/02:35:17

Throw dagger at Flannel-/03:58:12

You have recovered balance-/05:58:12

[End Timestamp]


Say, "It takes me 2.35 second to regain balance after a jab"

Like that?

[Go to top] top

Posted by Daniel Phillips   (3 posts)  [Biography] bio
Date Reply #3 on Wed 01 Jun 2005 09:34 PM (UTC)
Message
Tsinghahla hit it right on the head. That is exactly what I want.

Something to determine the time it takes to jab and regain focus.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #4 on Wed 01 Jun 2005 10:29 PM (UTC)
Message
So, what resets the timers?

And then do what with that information?
Do you want it to display the time on each line?
Or do you want it to just note it? or put it in the status line? or what?

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Tsinghahla   Sweden  (14 posts)  [Biography] bio
Date Reply #5 on Wed 01 Jun 2005 10:46 PM (UTC)
Message

on zMUD its just with %time.
%time(ss.zz) is seconds.microseconds
%time(nn:ss.zz) is minutes:seconds.microseconds
%time(hh:nn:ss.zz) is hours:minutes:seconds.microseconds

And I guess you want aliases to turn it on/off and reset it evertime you turn it off?

I believe this is what he's looking for.

No idea how to make it though, but more information to people who knows, if it's doable.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #6 on Wed 01 Jun 2005 10:57 PM (UTC)
Message
If he just wants to know times between events, he doesn't need to go through much of anything.

If he wants to append the timestamp, he has to go through a plugin, and actually edit the line. Which will also have the ill effect of making his current triggers stop working (unless he includes the time in them).

So, it's definitely doable, I'm just trying to figure out if he needs timestamps on each activity, or if he just needs to know a span of time.

Lines already store their timestamp, and he can also simply create a trigger/alias to reset the timer (which would just store a time) and then just have whatever triggers just subtract their time from the stored time, and display that in the status bar, or in a note, or whatever else.

He can even reset the 'connected' time to zero, if he wants a running total.

Like I said though, pre/post fixing a timestamp is infact possible, and not that hard at all either. But it will have adverse affects that reverberate through all the triggers (and having to keep two versions, or an optional time, since you’ll want to be able to match regardless of whether the timestamp is on).

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Daniel Phillips   (3 posts)  [Biography] bio
Date Reply #7 on Fri 03 Jun 2005 07:42 PM (UTC)
Message
All I want is something to print the time in minutes seconds and milliseconds at the end of a given line. Zmud does it with the %time command and I just throw along a #echo to show me on the main screen. I honestly didn't think it was that hard to understand whe way I put it but I guess I was wrong. I just want it to print the current minute second and millisecond, I can use math to figure out the difference from there.
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #8 on Sat 04 Jun 2005 06:49 AM (UTC)
Message
Here's a plugin to append timestamps to lines (I still think there are better ways to get it done, but whatever):
<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Friday, June 03, 2005, 10:00 PM -->
<!-- MuClient version 3.66 -->

<!-- Plugin "Timestamp" generated by Plugin Wizard -->

<!--
The reason this is in JScript is because it's the only language in which it's easy to deal with milliseconds.

This is an ugly plugin, because it destroys all sembalance of order in the lines.
I suggest adding color to the timestamp (for the append) do that with the
ANSI function (since we're dealing with packets, you need to insert ANSI sequences).
It's in the OnPluginPacketRecieved function, the only line that does much in that function,
easy enough to find.

I do suggest if you're only using it for a couple of lines, that you just omit a line, and renote it
(or just note the time afterwards or whatnot).
This plugin has functions to do only that as well.
Check the :now alias for a pretty cut and dry example.
Also, you can include hours by toggling the comments in the GetTime function as well.
-->

<muclient>
<plugin
   name="Timestamp"
   author="Flannel"
   id="89596abf2cfcc625086f8255"
   language="JScript"
   purpose="Keep track of times between lines and optionally append a timestamp"
   save_state="y"
   date_written="2005-06-03 21:58:32"
   requires="3.59"
   version="1.0"
   >
<description trim="y">
<![CDATA[
timestamp:on - turn timestamping on
timestamp:off - turn timestamping off
timestamp:reset - reset the start time
timestamp:now - note the current time
timestamp:help - display this page
]]>
</description>

</plugin>


<!--  Get our standard constants -->

<include name="constants.js"/>

<!--  Aliases  -->

<aliases>
  <alias
   name="Reset"
   match="^timestamp:reset$"
   enabled="y"
   regexp="y"
   send_to="12"
   ignore_case="y"
   keep_evaluating="y"
   sequence="100"
  >
  <send>var now = new Date();
setvariable("zerotime", now.getTime());
note("Timestamp Reset to Zero");</send>
  </alias>
  <alias
   name="Toggle"
   match="^timestamp:(on|off)$"
   enabled="y"
   regexp="y"
   send_to="12"
   ignore_case="y"
   keep_evaluating="y"
   sequence="100"
  >
  <send>var toggle = "%1".toLowerCase();
if (toggle == "on")
{
  setvariable("enabled",1);
  note("Timestamp Enabled");
}
else if (toggle == "off")
{
  setvariable("enabled",0);
  note("Timestamp Disabled");
}</send>
  </alias>
  <alias
   name="Now"
   match="^timestamp:now$"
   enabled="y"
   regexp="y"
   send_to="12"
   omit_from_output="y"
   ignore_case="y"
   keep_evaluating="y"
   sequence="100"
  >
  <send>note(GetTime());</send>
  </alias>
</aliases>

<!--  Variables  -->

<variables>
</variables>

<!--  Script  -->


<script>
<![CDATA[

function OnPluginPacketReceived (s)
{
  if (GetVariable("enabled") == 1)
  {
    s = s.replace(/(\r\n|\r|\n)/g," - " + GetTime() + "$1");
  }
  return(s);
}

function FormatNumber (i,d)
{ //i is integer, d is digits (min)
  //returns a string
  var str = i.toString();
  var digits = str.length;
  for (var j = digits; j < d;j++)
  {
    str = "0" + str;
  }
  return (str);
}

function GetTime ()
{
  var now = new Date();
  var then = getvariable("zerotime");
  var diff = now.getTime()-then;
  var mill = diff % 1000;
  diff = Math.round(diff / 1000);
  var sec = diff % 60;
  diff = Math.round(diff / 60);
  /* //if you want hours, uncomment this
   * var min = diff % 60;
   * diff = Math.round(diff / 60);
   * note(diff + ":" + FormatNumber(min,2) + ":" + FormatNumber(sec,2) + "." + FormatNumber(mill,3));
   */
  return (diff + ":" + FormatNumber(sec,2) + "." + FormatNumber(mill,3));
}
]]>
</script>


<!--  Plugin help  -->

<aliases>
  <alias
   script="OnHelp"
   match="^timestamp:help$"
   enabled="y"
   regexp="y"
   ignore_case="y"
  >
  </alias>
</aliases>

<script>
<![CDATA[
function OnHelp (sName, sLine, wildcards)
  {
  world.Note (world.GetPluginInfo (world.GetPluginID, 3));
  }
]]>
</script>

</muclient>

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[Go to top] top

Posted by Aheram   (23 posts)  [Biography] bio
Date Reply #9 on Sun 12 Jun 2005 02:30 PM (UTC)
Message
Does he mean TIMESTAMP or does he just want to know the duration?
[Go to top] top

Posted by Flannel   USA  (1,230 posts)  [Biography] bio
Date Reply #10 on Sun 12 Jun 2005 06:18 PM (UTC)
Message
He wants it stamped, the line appended with a time, but he wants to be able to zero it. So yeah, it really is a 'timer' type thing, but it's stamped onto the line.

If you want the time itself stamped, the plugin should be easy enough to modify (it actually makes the whole thing a lot simpler).

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
[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.


26,781 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]