Calling functions on the command line

Posted by Jalax on Fri 09 May 2003 10:08 PM — 4 posts, 17,771 views.

#0
Hi all. I've recently been trying out MushClient over the last few days and I must say I'm impressed, I'll definitely be registering it soon.

I have a query regarding plugins that I can't seem to find in the help files. I'm not sure if I'm just looking in the wrong place, or just doing something stupid.

I found a mushclient script on the web that I wanted to try out, it was written around 2 years ago before the plugin support was added. Adding it as my script file works, and I can call the functions in it from the command line like the script suggests. If I make it into a plugin using the plugin wizard, trying to call the functions directly from the command line results in:

'ident' is undefined
Line in error:

If I add an alias that calls the function and use the alias instead, it works.

Is this meant to happen, or am I doing something really silly?
USA #1
This is normal, unfortunately. The only way to call something (besides an alias) that is in a plugin is through CallPlugin, but it doesn't allow you to call things that require more than a single arguement. i.e.:

Some_Function (variable) <- Can be called using CallPlugin.

Some_Function (variable1, variable2) <- Can't be called.

This is of course a major pain when the original code itself direct called another sub like the second one as a way to avoid code duplication. :p
Australia Forum Administrator #2
There is more than one "script space" - this was part of the plugin design. For instance, multiple plugin writers might have chosen the same variable names, or same routine names.

Thus, the only things that can directly call scripts in a plugin, are aliases (or other things, like triggers, timers, other functions) in the same plugin. As a workaround for people that wanted to make "utility" plugins the CallPlugin function was provided, which lets one plugin call another.

However you could always make a single alias that does something like: execute (arg) (Exec in VBscript I think, but I am doing it from memory), then that alias could execute anything in the plugin's script space.
Amended on Sat 10 May 2003 04:21 AM by Nick Gammon
#3
Thanks, that makes sense.