Plugin Hyperlink to call Script

Posted by Angstrom on Tue 19 Jan 2010 03:16 PM — 3 posts, 14,048 views.

#0

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
Australia Forum Administrator #1
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.
#2

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

Thank you!