Interesting problem...

Posted by David Berthiaume on Wed 14 Sep 2005 08:27 AM — 6 posts, 27,062 views.

#0
All right. Haven't been here in a while, and I can't quite figure out how to do this on my own, I've tried everything that I can think of. Perhaps I'm just missing it.


I have an alias called start

The script in the alias is quite simple.
Speedwalkdelay = "@CharacterInfoSpellSpeed"
for count = 1 to @CharacterInfoSpellCount
 Queue "c " & "@CharacterInfoSetSpell", True
next
The problem is I want at the end of the loop, I want it to queue up an execute to restart it.

I've tried, Execute "start" that doesn't work. then I realized that wouldn't queue it. So I tried...

Queue "" & Execute* "start", True

But I got an error saying that there was an expected end arguement or something thing...

Anyways, I'm baffled.

* Note, I did search the forums and I know about the Execute issue with VBscript, I went back and tried it with world.execute, but still no luck)
Amended on Wed 14 Sep 2005 08:57 AM by David Berthiaume
Russia #1
You want to queue an Execute call? Don't think that'll work at all. Speedwalk text is treated pretty much the same way world.Send is, so trying to execute an alias from the speedwalk by trying to make it perform an Execute call won't work. What you can do though is define some standard prefix for speedwalk commands that are actually aliases, and then use OnPluginSend callback to catch these commands and redirect them to world.Execute.

Something like "SpeedwalkExec:*", where * is replaced by the command you want executed. Then have a plugin sitting there with:


dim exec_command
set exec_command = new RegExp
exec_command.pattern = "(SpeedwalkExec\:)(.*)"

function OnPluginSend(strText)
   set Matches = exec_command.execute(strText)
   set Match = Matches(0)
   if Match.SubMatches(0) = "SpeedwalkExec:" then
      world.Execute Match.SubMatches(1)
      OnPluginSend = vbFalse
   else
      OnPLuginSend = vbTrue
   end if
end function


Or better yet, use something with string slicing. Lua will do:


function OnPluginSend(strText)
   if string.sub(strText, 1, 14) == "SpeedwalkExec:" then
     Execute(string.sub(strText, 15, -1)
     return false
   else
     return true
   end
end

end

Then you just need to add "SpeedwalkExec:start" to the end of the queue to have it call an alias.

#2
I solved the problem, not the way I wanted too, but I did. I would prefer to do it all in one alias instead of relying on a queued say to set off a trigger.

Unfortunately I am not very well versed in using plugins, infact, I don't have the slightest damned idea how to do what you suggested.
Russia #3
The way I make "one-shot" plugins like that is start a new empty world. Open File->Plugin Wizard. Fill in the first form, then uncheck all options on all tabs, go to the Script tab, select the language, copy/paste my tiny script in there. Save. Go to my main world and install the saved plugin there.
USA #4
Or you could use a DoAfterSpecial, to call a script.

The queue will not work though, since it just sends to the world (no interpretation).
#5
Did exactly what you said, made new world, created the plugin, and got this:

Error number: -2146828283
Event: Execution of line 7 column 4
Description: Invalid procedure call or argument
Called by: Function/Sub: OnPluginSend called by Plugin SpeedwalkExecute
Reason: Executing plugin SpeedwalkExecute sub OnPluginSend