Showing people in a my room via GMCP

I know it is this: gmcp.Room.Players.name

But how do I display just the names?

Comments

  • KlendathuKlendathu Eye of the Storm
    You might need to edit it to get it to work, it's been ripped out of a larger script block.




    ppl = ppl or {}
    ppl.here = ppl.here or {}
    ppl.track = function(event)
    if event == "gmcp.Room.Players" then
    ppl.here = {}
    for k,v in pairs(gmcp.Room.Players) do
    if gmcp.Room.Players[k].name ~= gmcp.Char.Status.name then
        table.insert(ppl.here, gmcp.Room.Players[k].name) --all the names go into this table
    end
    end
    elseif event == "gmcp.Room.RemovePlayer" then
    listRemove(ppl.here, gmcp.Room.RemovePlayer)
    else -- gmcp.Room.AddPlayer
    table.insert(ppl.here, gmcp.Room.AddPlayer.name)
    end

    end
    -- event handlers
    registerAnonymousEventHandler("gmcp.Room.AddPlayer", "ppl.track")
    registerAnonymousEventHandler("gmcp.Room.RemovePlayer", "ppl.track")
    registerAnonymousEventHandler("gmcp.Room.Players","ppl.track")

    You can then iterate table ppl.here for the list of names, eg

    for _,v in ppl.here do
    	echo("\n"..v)
    end



    Tharos, the Announcer of Delos shouts, "It's near the end of the egghunt and I still haven't figured out how to pronounce Clean-dat-hoo."
  • Looks like that uses a custom function listRemove which, I'd assume, removes an item from an ordered list based on its value.
  • You could use my mData script in my sig, and use the event it raises for whatever you're doing :)
    Current scripts: GoldTracker 1.2, mData 1.1
    Site: https://github.com/trevize-achaea/scripts/releases
    Thread: http://forums.achaea.com/discussion/4064/trevizes-scripts
    Latest update: 9/26/2015 better character name handling in GoldTracker, separation of script and settings, addition of gold report and gold distribute aliases.
  • @Klendathu Thank you! Got it working!
  • How did you get it working? I have tried everything and cant get any of the GMCP room information to get in the box. can we see the finished script pleasee!?
  • KlendathuKlendathu Eye of the Storm
    edited July 2016
    Link in my signature for the complete script.

    Tharos, the Announcer of Delos shouts, "It's near the end of the egghunt and I still haven't figured out how to pronounce Clean-dat-hoo."
  • How did you get it working? I have tried everything and cant get any of the GMCP room information to get in the box. can we see the finished script pleasee!?
    </code></pre>This is what I used.. &nbsp;<br><br><pre class="CodeBlock"><code>[code]<br><p>function inRoomPlayers()</p><p>-- CREATE A WINDOW &nbsp;</p><p> openUserWindow("Players In Room")<br></p><p>&nbsp; oldRoomID = oldRoomID or 0<br></p><p>-- PULL THE GMCP IN AND CREATE A TABLE OF NAMES (may not be needed but I intend to use this info in other ways later, so I want it in a table)&nbsp;</p><p> if tonumber(gmcp.Room.Info.num) ~= oldRoomID then</p><p>&nbsp; &nbsp;-- If room changes, empty the table and pull in the list of new names &nbsp;</p><p>   playersInRoom = {}</p><p>&nbsp; &nbsp; &nbsp; for k,v in pairs(gmcp.Room.Players) do</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if v.name ~= gmcp.Char.Status.name then</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if not table.contains(playersInRoom, v.name) then</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;table.insert(playersInRoom, v.name) --all the names go into this table</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end -- Adding players to a table</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; end --&nbsp;Check to make sure your own name isn't added</p><p>&nbsp; &nbsp; &nbsp; end -- Sort through the list</p><p>&nbsp; end -- If the room changes</p><p>&nbsp; oldRoomID = tonumber(gmcp.Room.Info.num)</p><p>&nbsp; clearWindow("Players In Room")<br></p><p>&nbsp; cecho("Players In Room", "<PowderBlue>\n Players Here\n -------------")<br></p><p>-- Add names from table into the Window&nbsp; </p><p>&nbsp;for k, v in ipairs(playersInRoom) do</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; cecho("Players In Room", "\n"..v)</p><p>&nbsp; &nbsp;end</p><p>end</p><p>inRoomPlayers()</p><p>[/code]</p>


  • Just realized that looks like ass...

    Did you get it working @Trentillian ?

  • Also trying to get this to work. Could you put it in pastebin or something easier to copy and paste? Also, should the window just pop up when you add this script?
  • Puxi said:
    Also trying to get this to work. Could you put it in pastebin or something easier to copy and paste? Also, should the window just pop up when you add this script?
    My function for people already in the room:
     http://pastebin.com/jU5ESHWP

    For removing players when they leave:
      http://pastebin.com/UXLA5VzL

    For Adding players when they enter:
      http://pastebin.com/WB0vB1rE

    I have mine triggered to  ^Your last login was from domain.*$ to do "inRoomPlayers()"

    Throws the windows up and then I arrange them how I want

  • If you don't want to log out and log back in, you can use the LUA command thing..  

    "lua inRoomPlayers()"  on the command line

  • edited October 2016
    Too late to edit... I should also let you know I have an alias called WHERE  (my var names need work and the overall cleanliness of the code, but I just wanted to get something up and running fairly quickly)

    ^where (\w+)$    TO USE:  Just type  WHERE <PERSON>
       http://pastebin.com/11BEKWm8

    The Trigger to begin capture:
    http://pastebin.com/Kuu9eGmX

    The Trigger to end capture:
      http://pastebin.com/YGqNmNAx

  • Caelan said:
    Puxi said:
    Also trying to get this to work. Could you put it in pastebin or something easier to copy and paste? Also, should the window just pop up when you add this script?
    My function for people already in the room:
     http://pastebin.com/jU5ESHWP

    For removing players when they leave:
      http://pastebin.com/UXLA5VzL

    For Adding players when they enter:
      http://pastebin.com/WB0vB1rE

    I have mine triggered to  ^Your last login was from domain.*$ to do "inRoomPlayers()"

    Throws the windows up and then I arrange them how I want
    In the Your Last Login trigger, you should also put inRoomPlayers = {}  to initialize the table to empty

Sign In or Register to comment.