Page 1 of 1

Guide to using GMCP

Posted: Wed Dec 01, 2010 8:48 pm
by Jules
Hey all! I'm back! (ish)

After a long break due to working and school, I have returned to the wonderful place that is Mudlet! Thankfully, as I have seen, Mudlet has continued to evolve into the best client ever! Good job, everyone!!

Now, one new evolution that I have stumbled across is GMCP, which was being talked about slightly before I left for the summer. As I understand it, GMCP is much like ATCP was.... Except slightly different. Thus, I'm asking for help on the subject.

Is there a set of free scripts or a formal guide located anywhere that references how to effectively use GMCP within Mudlet, or at all? I'd like for it to replace ATCP in my scripts, if that's at all possible. And since I have forgotten most of how to do all of that, I figure it's a great way to start out by learning the latest and greatest technology! Again, thank you for the help!

Re: Guide to using GMCP

Posted: Wed Dec 01, 2010 9:54 pm
by Casimar
this is quite good, especially for IRE games...
http://www.mudbytes.net/index.php?a=top ... 185#p48185


*edit
Mudstandards looks promising, if GMCP is actually another name for ATCP2 (which I don't think it is :? )

Re: Guide to using GMCP

Posted: Wed Dec 01, 2010 11:18 pm
by Vadi
GMCP is infact ATCP2

Re: Guide to using GMCP

Posted: Wed Dec 01, 2010 11:44 pm
by Jules
Vadi wrote:GMCP is infact ATCP2
Oh sweet. So I take it that I can use the GMCP modules in the sameish way that I used ATCP?

Re: Guide to using GMCP

Posted: Thu Dec 02, 2010 12:44 am
by Vadi
Sameish

Re: Guide to using GMCP

Posted: Thu Dec 02, 2010 1:04 am
by Jules
Alright. Well, I decided to run a display(gmcp) function so I could see what sort of information was being captured from me, and there seems to be a lot! Now, I have your demo script, Vadi, from how to use ATCP appropriately and how to capture those values. I only really want the values saved in the Stats table, so how would I go about capturing them? Making another event-driven function to capture everything? And if so, what would that function need to be called? CharVitals? CharStats? Stats?

Re: Guide to using GMCP

Posted: Thu Dec 02, 2010 2:20 am
by tsuujin
Here's how I do the vitals parsing. Script, registered to gmcp.Char.Vitals event:
Code: [show] | [select all] lua
function parseVitals(event,args)
	-- Parse the arguments from CharVitals, which are all in <stat>:<curr>/<max> format
	local convChart = {["H"]="health",["M"]="mana",["E"]="endurance",["W"]="willpower",["NL"]="xp"}

	for word in gmcp.Char.Vitals.string:gmatch("[A-Z]+:%d+/%d+") do
		-- string is now broken down into individual parts. Rematch for specific parts.
		local stat = convChart[word:match("[A-Z]+")]
		local curr = word:match("(%d+)/")
		local max = word:match("/(%d+)")
		vitals.set(stat,curr,max)
	end
end
At some point I'll probably clean it up to use the table values instead of the string parser, but given I've had the string parser written for a long time and it still works...

Re: Guide to using GMCP

Posted: Thu Dec 02, 2010 2:42 am
by Jules
ACK! Double post! See below.

Re: Guide to using GMCP

Posted: Thu Dec 02, 2010 2:44 am
by Jules
Oo very good! Now, what did you have to do to register the gmcp.Char.Vitals event? Add in a custom event titled gmcp.Char.Vitals and bam, done? That's the only issue I'm having, other than that my parser should work. Thank you, Tsuujin!

EDIT: I fixed what was wrong. There's a bug in Mudlet 1.2p6 for Windows where you can't add a new Event Handler after removing one. I have to switch to a new script, then switch back to add it in again. Thanks again for the help, Tsuujin!

Re: Guide to using GMCP

Posted: Thu Dec 02, 2010 3:06 am
by tsuujin
you should probably look into the GMCP module tracker that I wrote for Vadi which, I believe, is now imbedded into Mudlet.