Register forum user name Search FAQ

Gammon Forum

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 ➜ Plugin Hyperlink to call Script

Plugin Hyperlink to call Script

It is now over 60 days since the last post. This thread is closed.     Refresh page


Posted by Angstrom   (2 posts)  Bio
Date Tue 19 Jan 2010 03:16 PM (UTC)
Message

Hi,

My goal is to create a self-contained plugin to navigate inventory / item information in a database. My thought is to use Hyperlinks in the plugin to call its scripts to generate the output.

For example, at startup the plugin has links:
<Bag1> <Bag2> <Bag3>

If I click on the link for Bag1, it calls a Subroutine in the same plugin to output the contents of Bag1 from a database.

I can't get the Hyperlink to call a subroutine part working though. I can set up a link from the main World to call into the plugin, but whenever the link is from the plugin to the plugin, it creates an error message.

Code snippet:
function OnPluginEnable()
local w = get_a_world (worldname, folder)
local linkstr = "!!4e5bdf861f5ca39c6e4b8a8e:ListLocations()"
w:Hyperlink(linkstr, "test", "", "yellow", "black", false)

Error message I get is:
Plugin "4e5bdf861f5ca39c6e4b8a8e" is not installed

If I change the link to appear in the main world, it works fine. Any thoughts on my overall approach, and ideas why the plugin is having trouble referencing itself? I added my plugin id to the trusted plugin list, in case it was a security issue. I'm using 4.43.

Thanks,
Dave
Top

Posted by Nick Gammon   Australia  (23,173 posts)  Bio   Forum Administrator
Date Reply #1 on Tue 19 Jan 2010 09:16 PM (UTC)
Message
Ah I think I see. Your second world (w) does not have the plugin in it, so in the world with the hyperlink in it, it can't find the plugin.

In other words, the world file with the hyperlink in it, is the one which the plugin has to be in. Now if you are trying to make something happen in the "main" world then the world with the hyperlink in it needs to have some sort of "helper" plugin that redirects the information back to the main world (eg. by using get_a_world).

Alternatively, keep everything in the one world and use miniwindows, which is what I tend to do these days.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
Top

Posted by Angstrom   (2 posts)  Bio
Date Reply #2 on Wed 20 Jan 2010 12:14 AM (UTC)
Message

Not 100% self-contained, but the helper function did the trick.

Thank you!
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.


13,419 views.

It is now over 60 days since the last post. This thread is closed.     Refresh page

Go to topic:           Search the forum


[Go to top] top

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.