[Home] [Downloads] [Search] [Help/forum]

Gammon Software Solutions forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Plugins
. . -> [Subject]  BroadcastPlugin/OnPluginBroadcast problem with v4.62
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?
(New message)
Subject: BroadcastPlugin/OnPluginBroadcast problem with v4.62
Name:
Your forum user name.
Register forum user name
Password:
Your forum password.
Forgotten password?
Message:
Message to be posted (in English, please)
Maximum of 6000 characters. Text only please, no HTML.
Forum codes:
Check this if your message uses 'forum codes' or templates (auto-detected for new posts).
Forum codes Templates

Save this message ...


Subject review (reverse sequence)

Posted by Seriley   (42 posts)  [Biography] bio
Date Tue 28 Sep 2010 10:52 PM (UTC)  quote  ]
Message
Thanks, Nick. I will look into that
[Go to top] top

Posted by Nick Gammon   Australia  (19,613 posts)  [Biography] bio   Forum Administrator
Date Tue 28 Sep 2010 10:50 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Worstje   Netherlands  (867 posts)  [Biography] bio
Date Tue 28 Sep 2010 10:27 PM (UTC)  quote  ]

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
[Go to top] top

Posted by Seriley   (42 posts)  [Biography] bio
Date Tue 28 Sep 2010 10:25 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Nick Gammon   Australia  (19,613 posts)  [Biography] bio   Forum Administrator
Date Tue 28 Sep 2010 10:14 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Nick Gammon   Australia  (19,613 posts)  [Biography] bio   Forum Administrator
Date Tue 28 Sep 2010 10:04 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Worstje   Netherlands  (867 posts)  [Biography] bio
Date Tue 28 Sep 2010 09:59 PM (UTC)  quote  ]
Message
I was wondering that too.
[Go to top] top

Posted by Nick Gammon   Australia  (19,613 posts)  [Biography] bio   Forum Administrator
Date Tue 28 Sep 2010 09:58 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Worstje   Netherlands  (867 posts)  [Biography] bio
Date Tue 28 Sep 2010 09:53 PM (UTC)  quote  ]

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.)
[Go to top] top

Posted by Nick Gammon   Australia  (19,613 posts)  [Biography] bio   Forum Administrator
Date Tue 28 Sep 2010 09:42 PM (UTC)  quote  ]
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
[Go to top] top

Posted by Nick Gammon   Australia  (19,613 posts)  [Biography] bio   Forum Administrator
Date Tue 28 Sep 2010 09:32 PM (UTC)  quote  ]
Message
Ah yes, well plugins had major work. Should be easy enough to find.

- Nick Gammon

www.gammon.com.au, www.mushclient.com
[Go to top] top

Posted by Seriley   (42 posts)  [Biography] bio
Date Tue 28 Sep 2010 08:21 PM (UTC)  quote  ]
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.
[Go to top] top

Posted by Worstje   Netherlands  (867 posts)  [Biography] bio
Date Tue 28 Sep 2010 05:51 PM (UTC)  quote  ]

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>
[Go to top] top

Posted by Seriley   (42 posts)  [Biography] bio
Date Tue 28 Sep 2010 03:25 PM (UTC)  quote  ]
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.
[Go to top] 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.


4,593 views.

It is now over 60 days since the last post. This thread is closed.   [New subject]  Start a new subject   [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

[Home]

Written by Nick Gammon - 5K

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Web site powered by FutureQuest.Net]