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 ➜ BroadcastPlugin/OnPluginBroadcast problem with v4.62

BroadcastPlugin/OnPluginBroadcast problem with v4.62

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


Posted by Seriley   (42 posts)  Bio
Date Tue 28 Sep 2010 03:25 PM (UTC)
Message
When I upgraded to 4.62 from 4.61, I lost my health bar miniwindow. I've isolated the problem to the health bar plugin not receiving the broadcast from the plugin that processes the character data.

Using Debug ("summary") I can see that the health bar plugin does receive broadcasts from other plugins.

I removed MUSHClient v4.62 and reinstalled v4.61 and the health bar plugin works fine. The miniwindow is there.

Please let me know what additional information I can provide.
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #1 on Tue 28 Sep 2010 05:51 PM (UTC)

Amended on Tue 28 Sep 2010 06:06 PM (UTC) by Worstje

Message
I will look into the issue, although I haven't found the guilty commit yet. Nick would probably be able to find it faster.

Can you show your code? I just ran a test case on the official binary as well as one I built myself, and it worked on both.

The plugin I used to test is below. I tested the command using the Immediate function (Ctrl+I) and calling BroadcastPlugin() from there. That should work, but if it doesn't for you, I am quite intruiged.

Template:saveplugin=TestReceiveBroadcast To save and install the TestReceiveBroadcast plugin do this:
  1. Copy between the lines below (to the Clipboard)
  2. Open a text editor (such as Notepad) and paste the plugin into it
  3. Save to disk on your PC, preferably in your plugins directory, as TestReceiveBroadcast.xml
  4. Go to the MUSHclient File menu -> Plugins
  5. Click "Add"
  6. Choose the file TestReceiveBroadcast.xml (which you just saved in step 3) as a plugin
  7. Click "Close"


<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE muclient>
<!-- Saved on dinsdag, september 28, 2010, 7:54  -->
<!-- MuClient version 4.62 -->

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

<muclient>
<plugin
   name="TestReceiveBroadcast"
   author="Worstje"
   id="e4e99e5c87166aa107944dce"
   language="Lua"
   purpose="Tests the OnPluginBroadcast callback."
   date_written="2010-09-28 19:52:20"
   requires="4.12"
   version="1.0"
   >

</plugin>

<script>
<![CDATA[
function OnPluginBroadcast (msg, id, name, text)
  Note ("msg = " .. msg)
  Note ("id = " .. id)
  Note ("name = " .. name)

  Note ("text = " .. text)
end

]]>
</script>

</muclient>
Top

Posted by Seriley   (42 posts)  Bio
Date Reply #2 on Tue 28 Sep 2010 08:21 PM (UTC)
Message
Thanks, Worstje.

I used your plugin in both versions.

Its output reveals the problem:

Version 4.61

msg = 1
id = 8202bdf6e4d339ae6cae06e5
name = Achaea_Vitals
text =
msg = 1
id = 4a33087c6b66ca6c4611afed
name = Achaea_GMCP_Logger
text = H:1669/1669 M:1708/2002 E:7245/7245 W:8910/8910 NL:37/100

===========================================

Version 4.62

msg = 1
id = MISSING!
name = MISSING!
text =
msg = 1
id = 4a33087c6b66ca6c4611afed
name = Achaea_GMCP_Logger
text = H:1669/1669 M:1708/2002 E:7245/7245 W:8910/8910 NL:37/100

The Achaea_Vitals plugin is patterned after one of Nick's where the data is not sent in the text itself, but stored in variables (require "var") and retrieved using the GetPluginVariableList when the Broadcast is received.

Sending

function build_stats (s)
   local tempstats = {}

   for item in string.gmatch(s, "%d+") do
      tempstats [#tempstats + 1] = item
   end

   -- Load into plugin table for others to use
   var.hp = tempstats [1]
   var.max_hp = tempstats [2]
   var.mana = tempstats [3]
   var.max_mana = tempstats [4]
   var.endu = tempstats [5]
   var.max_endu = tempstats [6]
   var.wp = tempstats [7]
   var.max_wp = tempstats [8]
   var.tnl = tempstats [9]
   var.max_tnl = tempstats [10]

   BroadcastPlugin (1, "")
end -- build_status


Receiving


function OnPluginBroadcast (msg, id, name, text)
  if msg == 1 and id == "8202bdf6e4d339ae6cae06e5" then
  
     -- get all variables
     stats = GetPluginVariableList("8202bdf6e4d339ae6cae06e5")

     draw_bar ()
   
  end -- stats changed
end


I also tested the sending plugin with Broadcast(1, "test") and the text shows up nicely with your reporting program...just no id and/or name info.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #3 on Tue 28 Sep 2010 09:32 PM (UTC)
Message
Ah yes, well plugins had major work. Should be easy enough to find.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #4 on Tue 28 Sep 2010 09:42 PM (UTC)
Message
Worstje, have you any suggestions here? In your suggested changes to the CTextView, in all the confusion I didn't test writing (again) and now when I use the internal notepad to save a notepad window (like the plugin above) and read it back in, I only get a single character.

Should I put back the code here?

http://github.com/nickgammon/mushclient/commit/5e97cdfde237

Or do you have another suggestion?


- Nick Gammon

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

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #5 on Tue 28 Sep 2010 09:53 PM (UTC)

Amended on Tue 28 Sep 2010 09:54 PM (UTC) by Worstje

Message
Yeah you should put that back. (Sorry about the delay, was confirming the bug and such on my build.)
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #6 on Tue 28 Sep 2010 09:58 PM (UTC)
Message
Seriley said:

Thanks, Worstje.

I used your plugin in both versions.



I can't reproduce the problem with a simple plugin that broadcasts. Is it possible the plugin that does the broadcast is also doing it in response to a broadcast? For example, the GMCP stuff broadcasts a GMCP message, your plugin decodes that message, and then re-broadcasts the decoded message?

- Nick Gammon

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

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #7 on Tue 28 Sep 2010 09:59 PM (UTC)
Message
I was wondering that too.
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #8 on Tue 28 Sep 2010 10:04 PM (UTC)
Message
I think there is a bug in rebroadcasting - the current plugin is set to NULL on BroadcastPlugin - in itself this isn't a major issue, except that the receiving plugin no longer knows its plugin ID, and a rebroadcast will then fail with these symptoms.


Also - the released 4.62 doesn't work with "find" in the notepad. So unfortunately the changes we ended up with are basically the buggy ones I had a while back, just with a different test around them. Saving is wrong, and finding is wrong.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #9 on Tue 28 Sep 2010 10:14 PM (UTC)
Message
I also note that this causes a loop:


function OnPluginBroadcast (msg, id, name, text)
  Note ("msg = " .. msg)
  Note ("id = " .. id)
  Note ("name = " .. name)

  Note ("text = " .. text)
  BroadcastPlugin (1, "")  --> loop here
  
end



I have changed version 4.63 to not allow BroadcastPlugin to broadcast to itself.

- Nick Gammon

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

Posted by Seriley   (42 posts)  Bio
Date Reply #10 on Tue 28 Sep 2010 10:25 PM (UTC)
Message
Yes. You guys are both right. Achaea_Vitals plugin is a middleman.

Achaea_GMCP_Logger -> Achaea_Vitals -> Achaea_Healthbar

This was an interim solution while I was playing with the other information that IRE provides.

Thank you both for your response
Top

Posted by Worstje   Netherlands  (899 posts)  Bio
Date Reply #11 on Tue 28 Sep 2010 10:27 PM (UTC)

Amended on Tue 28 Sep 2010 10:29 PM (UTC) by Worstje

Message
Nick Gammon said:

Also - the released 4.62 doesn't work with "find" in the notepad. So unfortunately the changes we ended up with are basically the buggy ones I had a while back, just with a different test around them. Saving is wrong, and finding is wrong.


For your viewing 'pleasure', I have put all VS2010 CEditView code regarding find and replace on pastebin. I'd go through the details and such myself, but I haven't got a clue where it goes wrong for you, and I'd have a hard time debugging an issue I don't have as well. Copy/paste as you see fit, or if you spot a more surgical solution to your problems, do that.

http://pastebin.com/s0k6HfcD
Top

Posted by Nick Gammon   Australia  (23,133 posts)  Bio   Forum Administrator
Date Reply #12 on Tue 28 Sep 2010 10:50 PM (UTC)
Message
Seriley said:

Yes. You guys are both right. Achaea_Vitals plugin is a middleman.


For what it's worth, the new CallPlugin syntax (for Lua) introduced in version 4.55 lets you pass multiple arguments of any type, and get multiple return codes. Thus it could be a viable, faster and easier alternative to doing BroadcastPlugin.

- Nick Gammon

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

Posted by Seriley   (42 posts)  Bio
Date Reply #13 on Tue 28 Sep 2010 10:52 PM (UTC)
Message
Thanks, Nick. I will look into that
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.


40,082 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.