Delay function in VBScript

Posted by Heathen on Thu 09 Sep 2004 05:44 PM — 4 posts, 25,772 views.

#0
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
USA #1
Why dont you just use the speedwalk queue? Its delay is in ms.
#2
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
#3
Just found the world.queue function, works like a charm.

Thanks,

-Heathen