Guide to using GMCP

Post Reply
User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

Guide to using GMCP

Post 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!

Casimar
Posts: 22
Joined: Sun Nov 07, 2010 3:47 pm

Re: Guide to using GMCP

Post 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 :? )

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Guide to using GMCP

Post by Vadi »

GMCP is infact ATCP2

User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

Re: Guide to using GMCP

Post 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?

User avatar
Vadi
Posts: 5035
Joined: Sat Mar 14, 2009 3:13 pm

Re: Guide to using GMCP

Post by Vadi »

Sameish

User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

Re: Guide to using GMCP

Post 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?

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: Guide to using GMCP

Post 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...

User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

Re: Guide to using GMCP

Post by Jules »

ACK! Double post! See below.
Last edited by Jules on Thu Dec 02, 2010 2:44 am, edited 1 time in total.

User avatar
Jules
Posts: 118
Joined: Sun Oct 11, 2009 5:41 pm
Location: Plymouth State University - Sophomore

Re: Guide to using GMCP

Post 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!

User avatar
tsuujin
Posts: 695
Joined: Fri Feb 26, 2010 12:59 am
Location: California
Contact:

Re: Guide to using GMCP

Post by tsuujin »

you should probably look into the GMCP module tracker that I wrote for Vadi which, I believe, is now imbedded into Mudlet.

Post Reply