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
➜ Lua
➜ Executing Alias from plugin loaded using ImportXML
|
Executing Alias from plugin loaded using ImportXML
|
It is now over 60 days since the last post. This thread is closed.
Refresh page
| Posted by
| Apriebe
(6 posts) Bio
|
| Date
| Thu 29 Sep 2011 04:08 PM (UTC) |
| Message
| Hi everyone,
On install, my plugin creates a bunch of aliases for directions from an xml file. These directions are then displayed in a miniwindow and given a hotspot, when a user clicks on the hotspot, the plugin should call the alias.
I have got it working right now like so:
function goto_area(flags, hotspot_id)
iStatus, alname, almatch, alresponse, alflags, alscriptname = GetAlias(hotspot_id)
Execute(almatch)
end -- function
The hotspot_id is the string name of the alias. I can execute aliases that already exist (ones setup through the GUI) by simply doing "Execute(alias_name)", why does this not seem to be possible for aliases loaded via ImportXML? I would I think I could simply do the above code like so:
function goto_area(flags, hotspot_id)
Execute(hotspot_id)
end -- function
Thanks for the help!
Andrew | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #1 on Fri 30 Sep 2011 12:19 PM (UTC) |
| Message
| Huh? The alias name is not what calls it. That is the match text. For example:
Name: foo
Match: Nick eats chocolate
If you do:
That isn't the same as:
Execute "Nick eats chocolate"
|
- Nick Gammon
www.gammon.com.au, www.mushclient.com | | Top |
|
| Posted by
| Apriebe
(6 posts) Bio
|
| Date
| Reply #2 on Fri 30 Sep 2011 09:41 PM (UTC) |
| Message
| It seems the reason for my confusion is that my almatch variable is returning the send text. For example I have an alias:
<alias enabled="y" group="directions" name="Along_The_Forest_Path" match="Along_The_Forest_Path">
<send>#7 w;sw;s;s</send>
</alias>
alname is set to the name variable, but why is almatch returning the text between <send></send>? | | Top |
|
| Posted by
| Nick Gammon
Australia (23,173 posts) Bio
Forum Administrator |
| Date
| Reply #3 on Sun 02 Oct 2011 12:59 AM (UTC) |
| Message
| Looks like the documentation is wrong, sorry.
It should read:
local iStatus
local almatch
local alresponse
local alflags
local alscriptname
iStatus, almatch, alresponse, alflags, alscriptname =
GetAlias ("myalias")
print (iStatus, almatch, alresponse, alflags, alscriptname)
In other words, it doesn't return the name. After all, you ask for it by name, so it hardly needs to return the name to you. |
- 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.
14,566 views.
It is now over 60 days since the last post. This thread is closed.
Refresh page
top