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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  VBscript
. . -> [Subject]  Timers.

Timers.

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


Posted by Sleaker   (24 posts)  [Biography] bio
Date Sat 24 Aug 2002 06:05 AM (UTC)
Message
Was wondering how to use the VBS Timer to log a time

trigger:
TOWER: * is under attack at *.

Sub TowerTimer(thename, theoutput, theparameters)
<-- want it to start a Timer here counting up.


End Sub

I also want it to be able to have multiple timers going off at once for each first *. but not to reset for the same *, I don't want the Sub to do anything with the second *, only the first.
Got questions, or don'tunderstand what I'm asking? please ask :D I need the help hehe
[Go to top] top

Posted by Nick Gammon   Australia  (22,990 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Sat 24 Aug 2002 06:29 AM (UTC)
Message
What do you want the timer to do? Send a message to the MUD? To you? Do something else? Can you give a short example? Meanwhile, look at the script functions web page, under AddTimer (and also look at DoAfter).

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Sleaker   (24 posts)  [Biography] bio
Date Reply #2 on Sat 24 Aug 2002 06:40 AM (UTC)
Message
I want a VBS Timer not a MUSHCLient TImer.. I want one that just starts counting seconds up and up until another trigger goes off. then after that trigger goes off I want it to tell how many seconds it took for the second trigger to happen.
[Go to top] top

Posted by Magnum   Canada  (580 posts)  [Biography] bio
Date Reply #3 on Sat 24 Aug 2002 04:00 PM (UTC)
Message

Function TimeDiff (StartTime, EndTime)
	Dim Hours, Minutes, Seconds
	Seconds = DateDiff("s", StartTime, EndTime)
	If Seconds > 90000 Then Seconds = 90000
	If Seconds < 0 Then Seconds = 0
	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
	TimeDiff = Hours & ":" & Minutes & ":" & Seconds
End Function

Sub Grab_GodShield (thename, theoutput, arrWildcards)
	SS_GS = Now()
	SC_GS = arrWildcards(2)
End Sub

Sub Display_End_Godshield (thename, theoutput, arrWildcards)
	Dim TimeStamp
	If SS_GS <> Empty Then
		SD_GS = TimeDiff(SS_GS, Now())
		TimeStamp = " (" & SD_GS & " - " & SC_GS & ")."
	End If
	If World.GetVariable("InParty") Then
		World.EchoInput = vbsFalse
		LogSend "party emote no longer has a Godshield." & TimeStamp
	Else
		World.Note "END: GodShield" & TimeStamp
	End If
	SS_GS = Empty
	World.EchoInput = vbsTrue
End Sub

' SS - Spell Start time.
' SC - Spell Caster.
' SD - Spell Done time.

That is some of my own code that maintains a timestamp for the length of time a spell was up.

Get my plugins here: http://www.magnumsworld.com/muds/

Constantly proving I don't know what I am doing...
Magnum.
[Go to top] top

Posted by Sleaker   (24 posts)  [Biography] bio
Date Reply #4 on Mon 26 Aug 2002 12:18 AM (UTC)
Message
FOr Future reference don't use Cint(#) it rounds the numbers up. instead use Fix(#). it will round them down which is what I need.
[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.


20,573 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]