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.
 Entire forum ➜ MUSHclient ➜ VBscript ➜ Help with Speedwalk/Alias/Execute

Help with Speedwalk/Alias/Execute

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


Posted by EZe   (3 posts)  Bio
Date Tue 07 Jun 2005 08:38 PM (UTC)
Message
I have an alias which sets of a script. The script then reads a file and Queues each line as an execution. The problem is that the script for each executed line is being executed BEFORE the command is executed in the speedwalk.

If you're confused look at my messy code which will confuse you even more.

This sub executes the lines from a quest file

Sub OnQuest (strAliasName, strOutput, arrWildCards)

dim fromplace
dim toplace
dim textfile
dim line
dim i
dim togo
dim todo
dim dir
dim opp
fromplace = arrWildCards (1)

textfile = "D:\Oceradan\Scripts\Routes\Quests\"+fromplace

world.setvariable "waitquest","no"
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists (textfile) Then
world.note "File exists"
Set objFile = objFSO.OpenTextFile(textfile, 1)
i =1
world.send "accept"
do until objFile.AtEndOfStream
world.SpeedWalkDelay = 750
dir = objFile.ReadLine
world.queue world.execute (dir),1
i=i+1
loop
world.SpeedWalkDelay = 500
world.queue world.execute ("reverse " + arrWildCards (1)),1
Else
world.note "ERROR! QUEST DOES NOT EXIST (check spelling?)"
End If

world.note textfile

end sub

this sub is called in a script from the directions alias (regexp the directions) and sets the last direction

sub setldir (thename, theoutput, thewildcards)
world.setvariable "lastdir", thewildcards(1)
world.send thewildcards(1)

end sub



Basically what I want to do is to set the last direction as the direction comes off the speedwalk. If anybody has an easier way to do this let me know please
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #1 on Tue 07 Jun 2005 09:25 PM (UTC)
Message
So, what's the problem?

You have two aliases, one is being triggered from the queue (and the execute) and then .... after that I lost you.

What's being executed before what? What's the problem with the second alias? Since I think your first one is working.

And what are the aliases you're using?

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by EZe   (3 posts)  Bio
Date Reply #2 on Tue 07 Jun 2005 09:32 PM (UTC)
Message
I'll try to make it clearer...

I have a sub called "OnQuest" which reads a text file
each line is queued as an execution using this line

dir = file.getline
world.queue world.execute(dir),1

this reads the direction fine, but when I put the directions
in an alias, so that whenever you type (or execute) a direction it calls

world.setvariable "lastdir",wildcard(1)

When I execute OnQuest it queues all these aliases, but executes the scripts they call immediately

so it sets all the directions immediately instead of as each direction(alias) in the queue is called
Top

Posted by Flannel   USA  (1,230 posts)  Bio
Date Reply #3 on Tue 07 Jun 2005 10:03 PM (UTC)

Amended on Tue 07 Jun 2005 10:05 PM (UTC) by Flannel

Message
Oh, right.

The speedwalk queue is sent directly to the world, so you can't trigger aliases off of it, nor can you use the script prefix to send things to the scripting engine.

And, your execute commands are evaluated because they aren't a string. If you had:
queue "/execute note ""this would note""",1
then that WOULD have worked (only with the script prefix, not without), except that the queue doesn't ever see a command parser.

In nick's example, the evaluatespeedwalk is proccessed, and then the resulting string is pushed onto the queue.

So unfortunately, you'll have to think of another way to get that done.
A plugin callback seems bulky and awkward, although that would be the most straightforward and unintrusive (as it wouldn't require any other changes).

~Flannel

Messiah of Rose
Eternity's Trials.

Clones are people two.
Top

Posted by EZe   (3 posts)  Bio
Date Reply #4 on Wed 08 Jun 2005 12:02 PM (UTC)
Message
Thanks I went with the plugin callback and it works a charm

:D
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.


14,808 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.