CallPlugin

Posted by MattMc on Sat 03 Jul 2004 03:23 AM — 6 posts, 21,550 views.

USA #0
Howdy,

Apperently the Callplugin function doesn't work when you are switching between two coding languages. Any ideas what will work to initiate a function in a different plugin that's in a different language?

Matt
Amended on Sat 03 Jul 2004 03:37 AM by MattMc
Australia Forum Administrator #1
I cannot reproduce this problem. It would have helped to specify the two languages involved, but here is a sample that uses CallPlugin to communicate from a plugin written in VBscript to one in Jscript.

Plugin "A"


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Saturday, July 03, 2004, 1:29 PM -->
<!-- MuClient version 3.50 -->

<!-- Plugin "test_a" generated by Plugin Wizard -->

<muclient>
<plugin
   name="test_a"
   author="Nick Gammon"
   id="6cef965ac6f6795a4ec1c8b6"
   language="VBscript"
   purpose="Testing CallPlugin"
   date_written="2004-07-03 13:28:20"
   requires="3.50"
   version="1.0"
   >

</plugin>


<!--  Aliases  -->

<aliases>
  <alias
   script="OnTest"
   match="test *"
   enabled="y"
   echo_alias="y"
   sequence="100"
  >
  </alias>
</aliases>

<!--  Script  -->


<script>
<![CDATA[
Sub OnTest (name, line, wildcards)
Dim result

  result = CallPlugin ("925d9a020086429f5c8a3c4b", "DoNote", wildcards (1))

  if result <> 0 then
    world.Note "Got result " & CStr (result) & " from CallPlugin"
  end if

End Sub


]]>
</script>


</muclient>



Plugin "B"



<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on Saturday, July 03, 2004, 1:33 PM -->
<!-- MuClient version 3.50 -->

<!-- Plugin "test_b" generated by Plugin Wizard -->

<muclient>
<plugin
   name="test_b"
   author="Nick Gammon"
   id="925d9a020086429f5c8a3c4b"
   language="JScript"
   purpose="Test being called from CallPlugin"
   date_written="2004-07-03 13:31:29"
   requires="3.50"
   version="1.0"
   >

</plugin>


<!--  Script  -->


<script>
<![CDATA[
function DoNote (sText)
   {
   world.Note ("DoNote: " + sText);
   }

]]>
</script>


</muclient>



When I install both plugins, and then type: "test hello" (which is caught by an alias in Plugin "A"), I see this:


test hello
DoNote: hello


Thus, the "hello" was passed from Plugin "A" to Plugin "B" via CallPlugin.

Amended on Sat 03 Jul 2004 03:42 AM by Nick Gammon
USA #2
Hi, thanks for the quick reply.

I'm using Vbasic to Perl (because I'm using a perl socket which I finally got to work (thanks nasa)).

_All_ of my triggers and scripts are in Vbasic, so I'm trying to transfer data over to the Perl plugin to get it to open the sockets and pull the info.

An example of what's not working:

[In Vbasic plugin]

sub SaleDone (sName, sLine, strwildcards)
... lots here ...
world.note "Going to DoAuction now"
yawn = CallPlugin ("8db4b008917c1c0d0ede17df", "DoAuction", "Datatobelogged")
end sub

[In Perl plugin]
sub GoAuction {
$world->note ("Goauction started");
... lots here ...
}

part of the Perl Plugin header is:
<plugin
   name="MiniBrowser"
   author="Matt and Nasa"
   id="8db4b008917c1c0d0ede17df"
   language="perlscript"
   purpose="Minibrowser"
   date_written="2003-06-29 22:16:38"
   requires="3.4"
   version="1.0"
   >

The output I get?
Going to DoAuction now

that's it.
Amended on Sat 03 Jul 2004 03:51 AM by MattMc
USA #3
Note: I don't need anything returned to the vbasic plugin, I just want it to initiate the other plugin which will open the socket, submit the data, close the socket, and echo the results there. There's no need to return anything to vbasic, and all my variables are stored so I don't need to pass data either.
Australia Forum Administrator #4
Well, for one thing, you are calling "DoAuction", however your function on Perl is GoAuction. That is not the same.

If that doesn't fix it, in the calling plugin, echo the value of "yawn" (the return code from the CallPlugin) so you can see what the error code is.
USA #5
Wow, maybe this is why you get paid the big bucks :P

lmao

Going to DoAuction now
Goauction started
Connection to internet initiated.
Hello, your query has been submited.
Connection internet closed.


I love you Nick.