Which of course won't really work.. Compilers allow this because they can include headers or 'pre-declaration' in the code that specify what the parameters 'should' be, they also allow you to 'overload' them by making more than one definition in most objects oriented languages. Scripts don't use the first of these, since the engines that run them don't really care what 'order' the subs came in, while a compiler needs to run everything through an initial first pass to make sure all of the needed subs have been declared and actually exist. As for overloading... I am fairly sure that is out as well.
Now, going to the heart of the matter.. I don't see the point of this in triggers or aliases. All of the needed parameters are accessable within the array of wildcards and being able to explicitly give names for them is not a major problem since you can simply create variables and assign them the values of the appropriate wildcards as the first thing you do in the sub or function. All that declaring them explicitly in the call does is add extra code to the triggers and aliases that don't do anything new.
I do still thinks that the callplugin syntax needs somethign like this, since you can't pass an array (Though I thought in all scripting an array 'must' be a varient contianing varients...) and only being able to pass one parameter means playing some real annoying games that shouldn't be needed, not the least being that you litterally can't link your own plugin to someone elses without adding code to their's that takes the data needed for a sub with 3+ parameters and dissects it out of a string before calling the real sub. This is counter productive, since you can't call the 'real' sub directly and you have to edit someone elses code. :p
So trying again I would suggest:
CallPluginEx BSTR ID, BSTR Routine, BSTR Arguement, BSTR Delimiter, Bool CallType
Where CallType = FALSE sends the arguement normally and CallType = TRUE takes the Arguement, splits it using the delimiter and constructs a multi-parameter call.
i.e.
CallPluginEx "SomeID", "Mysub", ",", "Fred,Bob", TRUE
would result in mushclient calling the sub as:
SomeID.Mysub("Fred","Bob")
This does not send or require any 'arrays' and makes a lot more sense than having to have someone add an entire sub to do the same thing into a plugin just to integrate it properly and which does essentially the same thing. I don't mind telling someone that 'If you want to set the colors from your own script/plugin in mine the syntax is Setcolor(Type, Color).' I do have a problem with forcing people to muck around in other peoples code to use the existing single arguement call method. ;) Seeing how something works is fine, but breaking it while trying to make such a change, then posting here with a request to fix it is something to avoid. lol |