Register to post in forums, or Log in to your existing account
 

Play RetroMUD
Post new topic  Reply to topic     Home » Forums » CMUD General Discussion
XonDK
Apprentice


Joined: 01 Dec 2006
Posts: 178

PostPosted: Mon Jan 30, 2012 7:20 pm   

%gmcp cleanup? feature suggestion
 
I don't suppose its possible to get cmud to print gmcp info prettier like divide it up in the groups its given
Code:

something like.
char={name="blah"
fullname="blah"
  Vitals={blahblah
   blahblah
   }
}

the idea being to make it easier to see what a main group and what's a sub of what group
Reply with quote
Daern
Sorcerer


Joined: 15 Apr 2011
Posts: 809

PostPosted: Mon Jan 30, 2012 9:27 pm   
 
This was a fun one ;) Edit: made it a bit more readable.
Code:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<cmud>
  <alias name="printgmcp" language="Lua">
    <value>local gmcp = zs.sys.gmcp
local out = ""
local function procitem(key, data, depth)
  out = out .. string.rep(" ", depth * 3) .. key .. ": "
  if type(data) == "table" then
    out = out .. "{\n"
    for k, v in pairs(data) do procitem(k, v, depth + 1) end
    out = out .. string.rep(" ", depth * 3) .. "}\n"
  else
    out = out .. data .. "\n"
  end
end
procitem("gmcp", gmcp, 0)
print(out)</value>
  </alias>
</cmud>
Reply with quote
XonDK
Apprentice


Joined: 01 Dec 2006
Posts: 178

PostPosted: Tue Jan 31, 2012 12:45 pm   
 
Exactly what I was looking for thanks a ton :)
Reply with quote
Display posts from previous:   
Post new topic   Reply to topic     Home » Forums » CMUD General Discussion All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum

© 2009 Zugg Software. Hosted by Wolfpaw.net