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 ➜ Delay function in VBScript

Delay function in VBScript

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


Posted by Heathen   (8 posts)  Bio
Date Thu 09 Sep 2004 05:44 PM (UTC)
Message
I'm doing a simple 'read from file and output to mud' script, that's no problem at all, however, I want to be able to add a delay between each line being sent to the MUD, however, I'd like to be able to do it by milliseconds rather than seconds (which is what I'm doing at the moment). Here's what I have right now:

Alias: readfile * *

dim nST, nTT, nX
dim objFS
dim objTS
dim file
set objFS = CreateObject("Scripting.FileSystemObject")

if objFS.FileExists(world.getinfo (57) & "%1") then

set objTS = objFS.OpenTextFile(world.getinfo (57) & "%1")

do until objTS.AtEndOfStream

world.sendimmediate objTS.ReadLine

nST=Second(Now)
nTT=nST + %2
if nTT>=60 then nTT=nTT-60
do
nST=Second(Now)
loop until nST>=nTT

loop

else

world.colournote "red", "black", "This file doesn't exist in your worlds folder."

end if

(Send to script of course)

Any thoughts? I've seen several examples in VB using the rundll32 library to put the application in freeze for a certain amount of time but not only do they not work, that's not exactly what I'm after.

Thanks,

-Heathen
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #1 on Thu 09 Sep 2004 06:30 PM (UTC)
Message
Why dont you just use the speedwalk queue? Its delay is in ms.

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by Heathen   (8 posts)  Bio
Date Reply #2 on Thu 09 Sep 2004 06:34 PM (UTC)
Message
Because what I'm reading in is a script file which frequently uses ( ) symbols and errors out the speedwalk system. I tried what you sugested without success for that reason :-\

-Heathen
Top

Posted by Heathen   (8 posts)  Bio
Date Reply #3 on Thu 09 Sep 2004 07:09 PM (UTC)
Message
Just found the world.queue function, works like a charm.

Thanks,

-Heathen
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.


25,062 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.