Calling a function within a plugin

Posted by Bennett Brauer on Wed 11 Sep 2002 08:41 AM — 2 posts, 13,540 views.

#0
I use a lot of scripts do simple things and save on typing. I installed them in a plugin and now I am unable to call them. Using this function as an example,
.
.
.
sub e
world.send "get bread backpack"
world.send "eat bread"
end sub
.
.
.

Before I could type /e to execute the function. However, now I cannot. So my question is, is there any way to directly call them (my functions) without making an alias for each?
Thanks in advance.
Australia Forum Administrator #1
Yes, you could make one alias that is a general "function executer". Here is an example:


<aliases>
  <alias
   script="onExecute"
   match="~*"
   enabled="y"
  >
  </alias>
</aliases>

sub onExecute (aliasname, aliasstring, wildcards)
  ExecuteGlobal wildcards (1)
end sub


By using "ExecuteGlobal" on the alias wildcard, we pass down the function name to be executed into the plugin and execute it from there. In my example I used "~" as the "script character", so you would type:


~e


This assumes "sub e" is also in the plugin. Of course, by changing the alias you can make a different initial character (eg. "/"). Then you could make the "global scope" scripting character something else (eg. "//") by setting that in the scripting configuration dialog.