Welcome to the Achaea Forums! Please be sure to read the Forum Rules.

Showing people in a my room via GMCP

DochithaDochitha Member Posts: 1,413 @ - Epic Achaean
I know it is this: gmcp.Room.Players.name

But how do I display just the names?

Comments

  • KlendathuKlendathu Eye of the StormMember Posts: 3,178 @@ - Legendary Achaean
    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."
    Dochitha
  • AntoniusAntonius Member Posts: 4,935 @@ - Legendary Achaean
    Looks like that uses a custom function listRemove which, I'd assume, removes an item from an ordered list based on its value.
  • TrevizeTrevize Member Posts: 1,517 @ - Epic Achaean
    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.
  • DochithaDochitha Member Posts: 1,413 @ - Epic Achaean
    @Klendathu Thank you! Got it working!
    Klendathu
  • TrentillianTrentillian Member Posts: 1
    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 StormMember Posts: 3,178 @@ - Legendary Achaean
    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."
  • CaelanCaelan Member Posts: 1,998 @ - Epic Achaean
    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!?
    This is what I used..  

    [code]
    function inRoomPlayers()-- CREATE A WINDOW   openUserWindow("Players In Room")
      oldRoomID = oldRoomID or 0
    -- 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)  if tonumber(gmcp.Room.Info.num) ~= oldRoomID then   -- If room changes, empty the table and pull in the list of new names   playersInRoom = {}      for k,v in pairs(gmcp.Room.Players) do          if v.name ~= gmcp.Char.Status.name then              if not table.contains(playersInRoom, v.name) then                 table.insert(playersInRoom, v.name) --all the names go into this table              end -- Adding players to a table          end -- Check to make sure your own name isn't added      end -- Sort through the list  end -- If the room changes  oldRoomID = tonumber(gmcp.Room.Info.num)  clearWindow("Players In Room")
      cecho("Players In Room", "<PowderBlue>\n Players Here\n -------------")
    -- Add names from table into the Window   for k, v in ipairs(playersInRoom) do          cecho("Players In Room", "\n"..v)   endendinRoomPlayers()[/code]


  • CaelanCaelan Member Posts: 1,998 @ - Epic Achaean
    Just realized that looks like ass...

    Did you get it working @Trentillian ?

  • PuxiPuxi Member Posts: 625 ✭✭✭✭ - Eminent
    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?
  • CaelanCaelan Member Posts: 1,998 @ - Epic Achaean
    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

  • CaelanCaelan Member Posts: 1,998 @ - Epic Achaean
    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

  • CaelanCaelan Member Posts: 1,998 @ - Epic Achaean
    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

  • CaelanCaelan Member Posts: 1,998 @ - Epic Achaean
    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 to Comment.