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


Register forum user name Search FAQ

Gammon Forum

[Folder]  Entire forum
-> [Folder]  MUSHclient
. -> [Folder]  Lua
. . -> [Subject]  GMCP and Lusternia

GMCP and Lusternia

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


Posted by Dyron   (17 posts)  [Biography] bio
Date Mon 11 Feb 2013 08:16 PM (UTC)
Message
I've been searching through google and such and found a gmcp plugin for Imperian but I can't download it. Is there any helps available on how to go about reading gmcp information?
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #1 on Mon 11 Feb 2013 08:19 PM (UTC)
Message
Here?

https://github.com/druuimai/gmcp.plugin

- Nick Gammon

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

Posted by Dyron   (17 posts)  [Biography] bio
Date Reply #2 on Mon 11 Feb 2013 09:06 PM (UTC)
Message
Awesome, thanks Nick. GMCP is a lot more complicated in mush for some reason. One last question, I hope.

How do I do a gmcp check on char.vitals.momentum by using that?
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #3 on Mon 11 Feb 2013 11:43 PM (UTC)
Message
See this thread:

http://www.gammon.com.au/forum/bbshowpost.php?id=11549

You may be able to ask one of the people there, who use GMCP on Imperian, how they did it.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #4 on Tue 12 Feb 2013 12:18 AM (UTC)
Message
You could try doing this:

Download the GMCP handler from Aardwolf:

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

Copy two files as documented on that page:


  • gmcphelper.lua to the "lua" directory in the MUSHclient installation

  • GMCP_handler.xml to the "plugins" directory


Install the GMCP_handler into MUSHclient.

Close the world (if necessary) and reconnect.

You should see:


--- Connected on Tuesday, February 12, 2013, 10:45 AM ---
Enabling GMCP.
Rapture Runtime Environment v2.2.0 -- (c) 2012 -- Iron Realms Entertainment


Type:


gmcpdebug 2


Look around. You should see something like:


Char.Vitals { "hp": "340", "maxhp": "340", "mp": "334", "maxmp": "334", "ep": "600", "maxep": "600", "wp": "570", "maxwp": "570", "nl": "0", "bal": "1", "eq": "1", "string": "H:340/340 M:334/334 E:600/600 W:570/570 NL:0/100 " }
gmcpdata serialized: {
  Char = {
    Status = {
      pk_level = "1   (0%)",
      guild = "(None)",
      bash_level = "1   (0%)",
      towne = "(None)",
      sect = "(None)",
      name = "Haelanad",
      city = "(None)",
      prof = "(None)",
      level = "1   (0.00%)",
      quest_level = "1   (0%)",
      fullname = "Haelanad",
      },
    Vitals = {
      wp = "570",
      eq = "1",
      ep = "600",
      maxhp = "340",
      hp = "340",
      nl = "0",
      maxep = "600",
      maxmp = "334",
      mp = "334",
      maxwp = "570",
      bal = "1",
      string = "H:340/340 M:334/334 E:600/600 W:570/570 NL:0/100 ",
      },
    StatusVars = {
      pk_level = "PK level",
      guild = "Guild",
      bash_level = "Bashing level",
      towne = "Towne",
      sect = "Cult/Sect",
      name = "Name",
      city = "City",
      prof = "Prof",
      level = "Overall level",
      quest_level = "Questing level",
      fullname = "Full name",
      },
    },
  Room = {
    Info = {
      map = "www.imperian.com/irex/maps/clientmap.php?map=1&building=0&level=0 6 13",
      num = "8465",
      name = "The empty western square",
      environment = "Urban",
      details = {
        },
      coords = "1,-1,0,0",
      exits = {
        ne = "8472",
        s = "8453",
        e = "8463",
        d = "8558",
        w = "8477",
        ["in"] = "28383",
        se = "8453",
        sw = "8571",
        n = "8472",
        },
      area = "the ruins of Caanae",
      },
    WrongDir = {
      [1] = "n",
      },
    },
  }
- 



Now to do something useful with that. You can turn the debugging off:



gmcpdebug 0


In the Immediate window, enter:


res, gmcparg = CallPlugin ("3e7dedbe37e44942dd46d264","gmcpval","Char")

-- convert to Lua table
luastmt = "gmcpdata = " .. gmcparg
assert (loadstring (luastmt or "")) ()

-- display Lua table
tprint (gmcpdata)

print ("My HP are:", gmcpdata.Vitals.hp)


That calls the plugin, asking for the latest "Char" stats. We see in the output window:


"Status":
  "pk_level"="1   (0%)"
  "guild"="(None)"
  "bash_level"="1   (0%)"
  "towne"="(None)"
  "sect"="(None)"
  "name"="Haelanad"
  "quest_level"="1   (0%)"
  "prof"="(None)"
  "level"="1   (0.00%)"
  "city"="(None)"
  "fullname"="Haelanad"
"Vitals":
  "wp"="570"
  "eq"="1"
  "ep"="600"
  "maxhp"="340"
  "hp"="340"
  "nl"="0"
  "maxep"="600"
  "maxmp"="334"
  "mp"="334"
  "maxwp"="570"
  "string"="H:340/340 M:334/334 E:600/600 W:570/570 NL:0/100 "
  "bal"="1"
"StatusVars":
  "pk_level"="PK level"
  "guild"="Guild"
  "bash_level"="Bashing level"
  "towne"="Towne"
  "sect"="Cult/Sect"
  "name"="Name"
  "quest_level"="Questing level"
  "prof"="Prof"
  "level"="Overall level"
  "city"="City"
  "fullname"="Full name"
My HP are: 340



The last line shows how we pulled out our current HP from the table.




To get the room details:


res, gmcparg = CallPlugin ("3e7dedbe37e44942dd46d264","gmcpval","Room")

-- convert to Lua table
luastmt = "gmcpdata = " .. gmcparg
assert (loadstring (luastmt or "")) ()

-- display Lua table
tprint (gmcpdata)

print ("The current room is:", gmcpdata.Info.name)


Example output:


"Info":
  "map"="www.imperian.com/irex/maps/clientmap.php?map=1&building=0&level=0 6 13"
  "num"="8465"
  "name"="The empty western square"
  "environment"="Urban"
  "details":
  "coords"="1,-1,0,0"
  "exits":
    "ne"="8472"
    "s"="8453"
    "e"="8463"
    "d"="8558"
    "w"="8477"
    "in"="28383"
    "se"="8453"
    "sw"="8571"
    "n"="8472"
  "area"="the ruins of Caanae"
"WrongDir":
  1="n"
The current room is: The empty western square


You should be able to build on that to use this information usefully.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #5 on Tue 12 Feb 2013 04:33 AM (UTC)
Message
And, look! If you download the GMCP mapper from here:

https://sites.google.com/site/dontarion/gmcp_mush_mapper

You can get a nice mapper going, like this:


- Nick Gammon

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

Posted by Dyron   (17 posts)  [Biography] bio
Date Reply #6 on Tue 12 Feb 2013 04:28 PM (UTC)
Message
Took a bit of editing but got it figured out. Thanks a ton, Nick.
[Go to top] top

Posted by Dyron   (17 posts)  [Biography] bio
Date Reply #7 on Tue 12 Feb 2013 07:40 PM (UTC)

Amended on Tue 12 Feb 2013 07:42 PM (UTC) by Dyron

Message

	-- Gmcp call
	res, gmcparg = CallPlugin ("3e7dedbe37e44942dd46d264","gmcpval","Char")
	-- convert to Lua table
	luastmt = "gmcpdata = " .. gmcparg
	assert (loadstring (luastmt or "")) ()
	-- Set momentum variable
	local momentum = tonumber(gmcpval("Vitals.momentum"))
	Note ( "Momentum is: " .. momentum )


Should I put this inside the function I'm wanting to use or just in the main script file?
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #8 on Tue 12 Feb 2013 08:01 PM (UTC)
Message
You put that into the script at the point where you want to know the momentum.

I couldn't see momentum in the list I posted above, but perhaps you do?

- Nick Gammon

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

Posted by Dyron   (17 posts)  [Biography] bio
Date Reply #9 on Tue 12 Feb 2013 08:10 PM (UTC)
Message
Lusternia has different gmcp then the mud you tried. It has char.vitals.momentum and char.vitals.power that I'm trying to access
[Go to top] top

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #10 on Wed 13 Feb 2013 04:21 AM (UTC)
Message
Oh sorry, I saw Imperian in your first post and tried that.

- Nick Gammon

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

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #11 on Wed 13 Feb 2013 04:42 AM (UTC)
Message
You didn't exactly copy my earlier example did you?

This shows your momentum and hit points:


-- Gmcp call
res, gmcparg = CallPlugin ("3e7dedbe37e44942dd46d264","gmcpval","Char")
-- convert to Lua table
luastmt = "gmcpdata = " .. gmcparg
assert (loadstring (luastmt or "")) ()
-- Set momentum variable
local momentum = tonumber(gmcpdata.Vitals.momentum)
Note ( "Momentum is: " .. momentum )
local hp = tonumber(gmcpdata.Vitals.hp)
Note ( "HP is: " .. hp)



- Nick Gammon

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

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #12 on Wed 13 Feb 2013 04:53 AM (UTC)
Message
The good news is the mapper works with Lusternia as well, here is an example (momentum and HP shown at the bottom):


- Nick Gammon

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

Posted by Nick Gammon   Australia  (22,975 posts)  [Biography] bio   Forum Administrator
Date Reply #13 on Wed 13 Feb 2013 04:55 AM (UTC)
Message
You can query the mapper for things:


mapper find teacher

The Path of the Teacher (road) (141) - 6 rooms away
The Path of the Teacher (road) (140) - 7 rooms away
The Path of the Teacher (road) (139) - 8 rooms away
The Path of the Teacher (road) (138) - 9 rooms away
The Path of the Teacher (road) (137) - 10 rooms away
The Path of the Teacher (road) (136) - 11 rooms away
The Path of the Teacher (road) (135) - 12 rooms away
The Path of the Teacher (road) (134) - 13 rooms away
The Path of the Teacher (road) (133) - 14 rooms away
The Path of the Teacher (road) (132) - 15 rooms away
The Path of the Teacher (road) (131) - 16 rooms away
The Path of the Teacher (road) (130) - 17 rooms away

- Nick Gammon

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

Posted by Dyron   (17 posts)  [Biography] bio
Date Reply #14 on Wed 13 Feb 2013 09:03 PM (UTC)
Message
Yea, I had it all working. Just wasn't sure if I should put it in the function or not. It was working fine in the function. Thanks, Nick.
[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.


29,881 views.

It is now over 60 days since the last post. This thread is closed.     [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.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

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

[Best viewed with any browser - 2K]    [Hosted at HostDash]