Recording Speedwalks

Posted by Oligo on Tue 23 Apr 2013 04:25 PM — 5 posts, 18,780 views.

#0
I dug around the forums and it's prob something obvious, but is there a way to record the path I recently walked as a speedwalk?

The equivalent of the tintin #savepath function.

For example, if I go , east, north, east, east, east.

It will save that as e;n;e;e;e; or something ?

The EvaluateSpeedwalk() seems to be more for the execution than the recording of a speedwalk.
Australia Forum Administrator #1
Write a plugin and use something like the OnPluginCommandEntered callback to record what you recently entered.

#2
I got started down this path of creating a plugin to duplicate Wintin functionality I'm used to with your help in pointing me in the right direction of the OnPluginCommandEntered() callback. However, I'm trying to use an alias to AddAlias and it doesn't seem to create an alias in my MCL file. Is the plugin scope independent of the .MCL scope? Can an AddAlias call in the plugin add an alias in the .MCL?

Because the below doesn't seem to work:



  <alias
   match="^#savepath(\s+(.+))?$"
   enabled="y"
   regexp="y"
   send_to="12"
   sequence="100"
  >
  <send>
      Note("in savepath: arg: "..Trim("%2")..", speedwalk: "..GetVariable("speedwalk_path_current"))
	  AddAlias("food_alias", "eat", "eat food", alias_flag.Enabled, "")
      AddAlias(Trim("%2"),Trim("%2"), "Execute("..GetVariable("speedwalk_path_current")..")",bit.bor(alias_flag.Enabled,alias_flag.RegularExpression),"")
  </send>
  </alias>



<script>
<![CDATA[
function OnPluginCommandEntered(sText)
  if (string.sub(sText,1,1) == "n"
	or string.sub(sText,1,1) == "e"
	or string.sub(sText,1,1) == "s"
	or string.sub(sText,1,1) == "w"
	or string.sub(sText,1,1) == "u"
	or string.sub(sText,1,1) == "d") then
	if (#GetVariable("speedwalk_path_current") > 0) then
		SetVariable("speedwalk_path_current",GetVariable("speedwalk_path_current")..";"..sText)
	else
		SetVariable("speedwalk_path_current",sText)
	end
  end 
end
]]>
</script>
Amended on Fri 26 Apr 2013 11:51 PM by Oligo
Australia Forum Administrator #3
The main world script space, and each plugin script space, are separate. This was done by design so plugins could be written in different languages (eg. VBscript, JScript, Lua).
#4
Is there a method where I don't need to use a plugin and can still access the command entered much like the plugin callback OnPluginCommandEntered()?


Or what do you recommend is the best solution if I want to have aliases saved to my .MCL file programatically and the contents of the aliases are based upon input commands captured?