Timers.

Posted by Sleaker on Sat 24 Aug 2002 06:05 AM — 5 posts, 27,525 views.

#0
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
Australia Forum Administrator #1
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).
#2
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.
Canada #3

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.
#4
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.