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.
Entire forum
➜ MUSHclient
➜ General
➜ ability to find out spell duration at any given time
ability to find out spell duration at any given time
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
Posted by
| Guest1
USA (256 posts) |
Date
| Sat 11 Oct 2003 12:59 AM (UTC) Amended on Sat 11 Oct 2003 08:11 AM (UTC) by Guest1
|
Message
| Had a look at a couple of old threads but didn't really cover what I want.
I want to set up a trigger so when a spell starts, it will fire a timer of some sort which records how long the spell has been running (usually wouldn't be more than 10 mins max), so that at any time I can type in an alias to get a report of how long the spell has been running so far at that point..
What would be ideal is if there was something in GetTimerInfo that would give me that time (in minutes + seconds) since it fired, but don't see that it can.
The other options seem pretty involved, like maybe having the timer add 1 to a numerical variable every second and then the alias would check the variable, but dunno if I want a timer firing and resetting a variable every second slowing other processes down..
Any other suggestions that aren't too involved? I saw something about getting the current real time off the PC at startup and seting it as a variable somehow, and then using an alias to call current real time and somehow it working out the difference, but farked if I know how to pull the real time off the pc..
How about a command that pulls the time connected to world that shows in the status bar? There must be a way to get that info and use it.. maybe..
p.s. I'm using vb for my scripts | Top |
|
Posted by
| Flannel
USA (1,230 posts) Bio
|
Date
| Reply #1 on Sat 11 Oct 2003 09:21 AM (UTC) |
Message
| Its real easy, theres a function called "now"
for example, to note the current time, you type this:
/note now
well, assuming your script prefix is /
That should be all you need... theres also a function for time, called... time
(Now returns date as well)
There are also Hour, Minute, second, year, etc. and for those, you would do: Minute(now), this is all tons better documented in the Windows Script documentation (a link can be found on the same page with the link to the scripting engines) |
~Flannel
Messiah of Rose
Eternity's Trials.
Clones are people two. | Top |
|
Posted by
| Poromenos
Greece (1,037 posts) Bio
|
Date
| Reply #2 on Sat 11 Oct 2003 12:39 PM (UTC) |
Message
| Just get a trigger that fires on each spell to store VBScript's "Timer" on a variable, and do a OldTimer - Timer to get seconds since the trigger fired. |
Vidi, Vici, Veni.
http://porocrom.poromenos.org/ Read it! | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #3 on Sat 11 Oct 2003 07:15 PM (UTC) Amended on Sat 11 Oct 2003 07:33 PM (UTC) by Guest1
|
Message
| Thanks Flannel.. unfortunately I couldn't find anything about the 'now' function on the page that you referred to
http://www.gammon.com.au/scripts/function.php
I entered '/note time' etc and yeah it gave me the time as a world note which is all very nice but didn't do much else for me.
Poromenos, yup that is exactly what I want, but as I originally posted, I can't seem to find what exactly calls that vbtimer to store it as a variable and, well I'm repeating myself now.
I've got a bad flu atm, guess I'm not thinking straight. I'll go back to the script help files once again or just give up.
addon:
this thread should help me
http://www.gammon.com.au/forum/bbshowpost.php?bbsubject_id=719
altho it's 2 years old.. | Top |
|
Posted by
| Shadowfyr
USA (1,788 posts) Bio
|
Date
| Reply #4 on Sat 11 Oct 2003 07:57 PM (UTC) Amended on Sat 11 Oct 2003 07:59 PM (UTC) by Shadowfyr
|
Message
| You might want to look for the 'help' files for windows scripting. You can get them from:
http://download.microsoft.com/download/winscript56/Install/5.6/W982KMeXP/EN-US/scrdoc56en.exe
Assuming they haven't changed the link at Microsoft again. They have a nasty habit of doing so. These help files cover VBScript, JScript and WSH. The 'now' function people have mentioned in built in to the script engine, which is why it is not listed in the Mushclient commands. Basically, when your spell starts you set a variable to now:
setvariable "Myspell", now
then when it falls you would do something like:
note datediff("s",getavariable("Myspell"),now)
Datediff is also a VBScript command, and not listed among Mushclient's commands. JScript, Perl and Python would all have some equivalent form of both 'now' and 'datediff' in them. | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #5 on Sat 11 Oct 2003 09:12 PM (UTC) Amended on Sat 11 Oct 2003 09:14 PM (UTC) by Guest1
|
Message
| ahhh ok thanks Shadowfyr.. 'fraid I'm not firing on all cylinders atm *bangs head against wall a few times*
..so once I set the trigger up, I can just use
note datediff("s",getavariable("Myspell"),now)
via an alias at any time to get an update on the time taken so far at that moment since the spell started, and then send it as a group tell. The reason behind this is that the mud I play on has basically removed 'ticks' altogether and also made spell durations variable within certain parameters, in the process making life as a tank hell.
cheers | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #6 on Sat 11 Oct 2003 09:44 PM (UTC) |
Message
| Great it all works and grouptells duration in seconds.. now to just convert it to minutes and seconds instead for the grouptell.. | Top |
|
Posted by
| Guest1
USA (256 posts) |
Date
| Reply #7 on Sat 11 Oct 2003 11:04 PM (UTC) Amended on Sat 11 Oct 2003 11:05 PM (UTC) by Guest1
|
Message
| Ok if anyone is interested, this is how I did it (even if it is a mickey mouse way around it, it works)
triggers on 'You are surrounded by a radiant light.'
which calls a script called aegis_up which sets a variable called 'durationstart'
sub aegis_up
World.SetVariable "durationstart", time
end sub
at anytime I can type the alias 'ld' (lite duration) to see how long it's been running for. The alias calls a script called 'getduration'..
sub getduration
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 "grouptell :: spell has been up for " & durationB & "mins " & durationC & "secs "
world.EchoInput = 1
end sub
seems to work so far... :) | Top |
|
Posted by
| Magnum
Canada (580 posts) Bio
|
Date
| Reply #8 on Wed 15 Oct 2003 12:38 AM (UTC) |
Message
| Yeah, I do something similar, although mine looks way longer:
Function TimeFormat (Seconds)
Dim Hours, Minutes
Seconds = CLng(Seconds)
Minutes = Seconds / 60
Minutes = Fix(Minutes)
Seconds = Seconds - (Minutes * 60)
Hours = Minutes / 60
Hours = Fix(Hours)
Minutes = Minutes - (Hours * 60)
Seconds = CStr(Seconds)
Minutes = CStr(Minutes)
Hours = CStr(Hours)
If Len(Seconds) = 1 Then Seconds = "0" + Seconds
If Len(Minutes) = 1 Then Minutes = "0" + Minutes
If Len(Hours) = 1 Then Hours = "0" + Hours
TimeFormat = Hours & ":" & Minutes & ":" & Seconds
End Function
Function TimeDiff (StartTime, EndTime)
Dim Hours, Minutes, Seconds
Seconds = DateDiff("s", StartTime, EndTime)
If Seconds > 2147483647 Then Seconds = 2147483647
If Seconds < 0 Then Seconds = 0
TimeDiff = TimeFormat(Seconds)
End Function
|
Get my plugins here: http://www.magnumsworld.com/muds/
Constantly proving I don't know what I am doing...
Magnum. | Top |
|
Posted by
| Nick Gammon
Australia (23,120 posts) Bio
Forum Administrator |
Date
| Reply #9 on Sat 18 Oct 2003 10:31 PM (UTC) |
Message
| See:
http://www.gammon.com.au/scripts/doc.php?function=GetTimerInfo
You can get the date/time it fired, when it will fire next and how many seconds until it fires next. The last one (how many seconds till it fires next) is a pretty good indicator of how long the spell has to go. |
- 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.
29,817 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top