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
➜ Lua
➜ Two things: Timestamps and health loss
|
Two things: Timestamps and health loss
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Pages: 1
2
3
| Posted by
| Nick Gammon
Australia (23,169 posts) Bio
Forum Administrator |
| Date
| Reply #30 on Wed 22 Aug 2007 09:31 PM (UTC) |
| Message
|
Quote:
Under Authors it states "Simimi/NickGammon/ShaunBiggs" I hope that is right and proper with the two of you?
That is fine with me. :) |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Simimi
(40 posts) Bio
|
| Date
| Reply #31 on Wed 22 Aug 2007 10:10 PM (UTC) |
| Message
| | So happy to hear it! Thanks for all of the help, it is greatly appreciated by the... looks like 5 people now using this plugin! | | Top |
|
| Posted by
| Shaun Biggs
USA (644 posts) Bio
|
| Date
| Reply #32 on Wed 22 Aug 2007 10:31 PM (UTC) |
| Message
|
Quote: Under Authors it states "Simimi/NickGammon/ShaunBiggs" I hope that is right and proper with the two of you?
Hey, I'm up for claiming even partial credit for anything that works :p |
It is much easier to fight for one's ideals than to live up to them. | | Top |
|
| Posted by
| Shaun Biggs
USA (644 posts) Bio
|
| Date
| Reply #33 on Wed 22 Aug 2007 10:34 PM (UTC) |
| Message
|
Quote: Is there a way to possibly set this up in VBscript? I would just need the Time with the milliseconds if possible.
Stolen from aspalliance.com:
Quote: To time to millisecond accuracy you need to use a little known VBScript function called, of all things, Timer(). The Timer() function returns the number of milliseconds between 00:00 (12:00 AM Midnight) and the time it's called.
Dim dblTimer
dblTimer = Timer()
For i=0 to 100000
Next
Response.Write PrintInterval(Timer() - dblTimer)
|
It is much easier to fight for one's ideals than to live up to them. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,169 posts) Bio
Forum Administrator |
| Date
| Reply #34 on Wed 22 Aug 2007 11:09 PM (UTC) |
| Message
| Paul DiLascia from Microsoft Systems Journal used to put an amusing disclaimer in his source:
// If this code works, it was written by Paul DiLascia.
// If not, I don't know who wrote it.
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Shaun Biggs
USA (644 posts) Bio
|
| Date
| Reply #35 on Thu 23 Aug 2007 12:11 AM (UTC) |
| Message
| Heh, good policy. On the other side of the spectrum Linus Torvalds:
Quote: I'm basically a very lazy person who likes to get credit for things other people actually do. |
It is much easier to fight for one's ideals than to live up to them. | | Top |
|
| Posted by
| Natasi
(79 posts) Bio
|
| Date
| Reply #36 on Thu 23 Aug 2007 01:33 AM (UTC) |
| Message
| Hmm, I used that call and this is what I got:
Script error
World: Aetolia
Execution of line 12 column 3
Immediate execution
Type mismatch: 'PrintInterval'
What am I doing wrong? | | Top |
|
| Posted by
| Rakon
USA (123 posts) Bio
|
| Date
| Reply #37 on Thu 23 Aug 2007 02:57 AM (UTC) |
| Message
| Gore:
That prompt script looks very....very familiar.
Possibly ever looked at, or have my or Batista's MUSHclient system?? |
Yes, I am a criminal.
My crime is that of curiosity.
My crime is that of judging people by what they say and think, not what they look like.
My crime is that of outsmarting you, something that you will never forgive me for. | | Top |
|
| Posted by
| Gore
(207 posts) Bio
|
| Date
| Reply #38 on Sat 25 Aug 2007 06:08 PM (UTC) |
| Message
| | No, I asked you for help for my achaean one, it's daelok =p | | Top |
|
| Posted by
| Natasi
(79 posts) Bio
|
| Date
| Reply #39 on Sun 21 Oct 2007 04:07 AM (UTC) |
| Message
| Using this code, I am able to get the seconds and milliseconds just fine, but they do not transfer over to minutes if that much time has passed. Also, sometimes the milliseconds expand out 6 spaces, which is annoying. Does anyone know how I can adjust this?
Example of what it looks like: <72.233719>
Example of what I want it to look like: <1:12:23>
Dim dblTimer
dblTimer = Timer()
For i=0 to 100000
Next
note "<" &(Timer() - dblTimer) & ">" | | Top |
|
| Posted by
| Nick Gammon
Australia (23,169 posts) Bio
Forum Administrator |
| Date
| Reply #40 on Sun 21 Oct 2007 04:27 AM (UTC) Amended on Sun 21 Oct 2007 04:30 AM (UTC) by Nick Gammon
|
| Message
| The basic idea is to take the number and divide by 60 to give minutes, then take the integer amount (I forget the exact function name, it might be Floor or Int) and then multiply it back. To take your example:
72.233719 / 6 = 1.20389531667
Take integer amount = 1 (ie. 1 minute)
Multiply it back: 1 * 60 = 60 (ie. that minute was 60 seconds)
Subtract from original: 72.233719 - 60 = 12.233719
That is now your seconds and fractions of a second.
There is a formatting function or you could multiply by 100 and divide back, eg.
12.233719 * 100 = 1,223.3719
Take integer amount = 1,223
Divide by 100 again: 1,223 / 100 = 12.23
That got rid of the other decimal places.
If you happen to have more than 60 minutes you can repeat the technique to get hours. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Natasi
(79 posts) Bio
|
| Date
| Reply #41 on Tue 23 Oct 2007 04:12 AM (UTC) |
| Message
| | I'm sorry Nick, I seem to be really bad at math, as I've tried all the setups I can and I either get a really large negative or the decimal moves way to far over. Would you mind showing me the correct way to put this into the note to show the minutes:seconds:milliseconds? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,169 posts) Bio
Forum Administrator |
| Date
| Reply #42 on Tue 23 Oct 2007 11:13 AM (UTC) |
| Message
| | Can you show us the code you used? Then we can see where the error crept in. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Natasi
(79 posts) Bio
|
| Date
| Reply #43 on Tue 23 Oct 2007 01:30 PM (UTC) |
| Message
| This is the code I used to get this: 2.1837
which is the 2 seconds and 1837th of a second.
note "" & (Timer() - dblTimer)
Dim dblTimer
dblTimer = Timer()
For i=0 to 100000
Next
The reason I have it with the note first is so it resets the timer after every note. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,169 posts) Bio
Forum Administrator |
| Date
| Reply #44 on Wed 24 Oct 2007 05:58 AM (UTC) |
| Message
|
Quote:
This is the code I used to get this: 2.1837
which is the 2 seconds and 1837th of a second.
Well not really, that is .1837 of a second, which is not 1/1837, they are different numbers.
I can't see in this code where you have tried to follow my suggestion of dividing by 60, or taking the integer and fractional value.
|
- 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.
151,252 views.
This is page 3, subject is 3 pages long:
1
2
3
It is now over 60 days since the last post. This thread is closed.
Refresh page
top