GMCP Group module for aardwolf

Posted by Khannon on Tue 11 Feb 2020 04:01 PM — 4 posts, 17,705 views.

#0
I'm trying to draw members from the group to be used in wildcards in other functions, but I'm not sure how to achieve that.


function OnPluginBroadcast (msg, id, name, text)
    if id == "3e7dedbe37e44942dd46d264" then 

        if (text == "group") then
            res, gmcparg = CallPlugin("3e7dedbe37e44942dd46d264","gmcpval","group")
		
        end
    end
end

function mobCount2 (name, line, wildcards)
	
	if wildcards[2] == "members" then
        mobCounter = mobCounter + 1
    end
end
#1
Good lord, I thought saving message doesn't actually 'post' message I'm sorry for duplicates if you could remove duplicates... that would be great. Clearly I'm not succeeding at anything today.
#2

group_data = 0
function OnPluginBroadcast (msg, id, name, text)
    if id == "3e7dedbe37e44942dd46d264" then 

        if (text == "group") then
            res, gmcparg = CallPlugin("3e7dedbe37e44942dd46d264","gmcpval","group")
		luastmt = "data = " .. gmcparg --- Convert the serialized string back into a lua table.
        assert (loadstring (luastmt or "")) ()
        
        group_data = data -- This is the 'Global' that you need to fill
        end
    end
end

function mobCount2 (name, line, wildcards)
	local group_data = group_data
        -- Hand waving to get a concise list of names from the group_data table
        -- need to do some iteration, something like the following
        for _,name in ipairs(modified_group_data) do
          --compare them
          if wildcards[2] == name then
            print("Matched")
            mobCounter = mobCounter + 1
          else
            print("No Match")
          end
        end
--	if wildcards[2] == "members" then
--        mobCounter = mobCounter + 1
    end
end


This should help you out with the syntax. Mind you this was written hasitly and might have its own flaws. The important parts that you were missing were getting the data out of the gmcpval call. Now that you know how to put the data into a table, via the loadstring statement, you should be able to continue developing. I would suggest that you read the following.

http://www.aardwolf.com/wiki/index.php/Clients/MushclientGMCP

http://www.aardwolf.com/wiki/index.php/Clients/GMCP


As I have told you on Aardwolf. Please read and understand these.
USA Global Moderator #3
Quote:
I would suggest that you read the following.

http://www.aardwolf.com/wiki/index.php/Clients/MushclientGMCP

If you're using the Aardwolf MUSHclient Package, then you really need to be reading https://github.com/fiendish/aardwolfclientpackage/wiki/Using-GMCP and *not* the Aardwolf wiki page, just like it says right at the top of the Aardwolf wiki page.