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
➜ Tips and tricks
➜ Timing an event
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| ErockMahan
(81 posts) Bio
|
Date
| Sat 20 Aug 2005 07:48 PM (UTC) |
Message
| I know, I know, this seems like it would be something covered elsewhere, but to be honest, I can't find it. I found a plugin that will time how long it takes to get to the next level, but I couldn't modify that plugin sufficiently for my needs.
I want to create an experience/time calculator. Meaning, when a fight beins, I want to start a timer that will stop when the fight ends, then divide the number of experience points by that time.
It would be helpful if the result could be appended to a notepad too, but if everything else is script oriented, I should be able to do that (thank you for help with that, by the way).
For the sake of examples, let's say that something simple happens at the beginning of every fight like:
The fight has begun!
and ends with:
You recieve * experience points.
Thanks for all your help! | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #1 on Sun 21 Aug 2005 05:39 AM (UTC) |
Message
| http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=3362
That talks about Now and Time and stuff (for VBScript, other scripts deal with time in different ways).
But it also talks about how it works (and there are a lot of links, I havent followed any of them though).
If youre doing it by a timer, you're thinking about it wrong. Timers are like alarm clocks, not a stopwatch.
To act as a stopwatch, you need to store the start time, and then get the end time, and subtract.
Which script language you use depends on how exact you want to be. Some languages deal with time in milliseconds, some in seconds.
I wrote a plugin to append time differences (its only a plugin because it needs to tweak packets before interpretation). You can use the logic (or the subroutine to calculate) to do what you want. It's in JScript (since it needed milliseconds).
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=5567 |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| ErockMahan
(81 posts) Bio
|
Date
| Reply #2 on Mon 22 Aug 2005 01:48 PM (UTC) |
Message
| Wow, it took a lot of reading and lots of trying things, but I got it. It didn't come from any one source, so my thanks goes to many people, including you and Nick Gammon.
Now I just need to tweak it to perfection. It's nice that it all works, but now I'd like to change it to round off to two decimal places instead of floating. Here is the more important part of the code I wrote:
AppendToNotepad "stuff",vbcrlf
AppendToNotepad "stuff","%1 xp"
dim durationA
dim durationB
dim durationC
durationA = datediff("s",getvariable("durationstart"),time)
World.SetVariable "durationA", durationA
durationB = (Fix(durationA / 60))
durationC = (durationA - (durationB * 60))
world.EchoInput = 0
world.send "gt the fight took " & durationB & "mins " & durationC & "secs "
world.send "gt that is about " & %1 / durationA & " xp/sec"
world.EchoInput = 1
Thanks :) | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #3 on Mon 22 Aug 2005 09:46 PM (UTC) |
Message
| You can use SendNoEcho instead of toggling the echo value.
And you can use the function Round to round. |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | 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.
18,846 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top