Register forum user name Search FAQ

Gammon Forum

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 ➜ VBscript ➜ Timers.

Timers.

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


Posted by Sleaker   (24 posts)  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
Top

Posted by Nick Gammon   Australia  (23,158 posts)  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
Top

Posted by Sleaker   (24 posts)  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.
Top

Posted by Magnum   Canada  (580 posts)  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.
Top

Posted by Sleaker   (24 posts)  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.
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.


22,923 views.

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

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.