SpeedWalk command line character parser

Posted by WillFa on Wed 11 Mar 2009 08:04 PM — 6 posts, 23,770 views.

USA #0
Would it be possible to add an option for what the speedwalk character "SendTo"s?

At the moment the enable Speedwalking char is hard coded to be:

<aliases>
<alias
match="^\#(.*?)$"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>Send (EvaluateSpeedwalk("%1") )</send>
</alias>
</aliases>


It'd be nice to have the option for:

<aliases>
<alias
match="^\#(.*?)$"
enabled="y"
regexp="y"
send_to="12"
sequence="100"
>
<send>Execute (EvaluateSpeedwalk("%1") )</send>
</alias>
</aliases>

This would be really useful for times when you have n/north/s/south etc aliased...

(I realize I posted my own workaround... :) )

Thanks Nick



Australia Forum Administrator #1
I take it the problem is solved?
USA #2
well, no, not really...

if an alias sends to speedwalk, that still gets sent to world, not execute. trying to finish off a graphical mapper miniwindow plugin and speedwalks break it because some basic x,y,z position tracking is done by aliasing the commands for n|s|e|w|north... using a speedwalk bypasses those aliases.

so the basic problem is still speedwalks always send to world, not to execute.
Amended on Mon 16 Mar 2009 02:00 AM by WillFa
Netherlands #3
I assume you are using a plugin. If not, this suggestion won't work for you unless you migrate (which is really simple to do).

I found aliases quite limited in nature a few years ago for precisely this reason, as well as a few other 'side effects'. Generally, the rule I go by to explain it is: don't use aliases if you wish to track sent commands - only use them to make user input more convenient.

It might sound a bit vague, but it basically means you can use the OnPluginSent() plugin callback, combined with a simple Lua pattern or other matching method to do your tracking. A really simple version is as follows:

function OnPluginSent(text)
  if (text == "s") or (text == "south") then
    TrackSpeedWalk("south")
  elseif (text == "n") or (text == "south") then
    TrackSpeedWalk("north")
  ...
  ...
  ...
  end
end


TrackSpeedWalk() is obviously some handling function you yourself wrote to do your math and stuff. The code as a whole can obviously be improved with a table and whatnot. :)

The advantage of this method is that you won't have to adjust a dozen aliases in order to do your tracking properly. Some of those aliases might be in plugins. Other commands might have their input prevented alltogether by an OnPluginSend callback. If you think about it, tracking something by alias has a lot of ways it can go wrong that this method covers for.

On a sidenote, mind sharing your plugin? I've been pondering on making a graphical mapper for MUSH for a few weeks, and while I am pretty sure how I want to go about it, it would be nice if I could possibly steal some ideas from how you are going about it. :)
Amended on Mon 16 Mar 2009 02:44 AM by Worstje
USA #4
Great idea Worstje!

I have some rather complexe features in it, zoning, heuristics, A* pathing, named locations, map zooming, rescaling (for when w,s,e,n walks you around and into a house and not back to the same room), all in a sqlite db, and temp maps for dynamic zones.

I'm encountering some performance issues atm... I hope to be releasing soon.
Netherlands #5
.. sounds like you are pretty much doing everything I was planning for. Maybe I'll just steal it alltogether and forego writing my own. :D

By all means, please share.