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.
Due to spam on this forum, all posts now need moderator approval.
Entire forum
➜ MUSHclient
➜ Plugins
➜ Calling a function within a plugin
|
Calling a function within a plugin
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Bennett Brauer
(1 post) Bio
|
| Date
| Wed 11 Sep 2002 08:41 AM (UTC) |
| Message
| 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. | | Top |
|
| Posted by
| Nick Gammon
Australia (23,165 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Wed 11 Sep 2002 10:35 PM (UTC) |
| Message
| 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. |
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | 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.
12,257 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top