playMaker

Author Topic: How do I step through keys in an arraymaker hash table?  (Read 2169 times)

Gevarre

  • Playmaker Newbie
  • *
  • Posts: 49
How do I step through keys in an arraymaker hash table?
« on: June 02, 2013, 06:27:30 PM »
i'm trying create an in-game scoreboard in a multiplayer game. I have a game manager object in the scene with an arrayMaker hash table.

As each player is instantiated into the game, they read their playerName from their player pref and send as both key and value (this'll change later to store other values).

So far, so good. I have a hash table with all the names. Trouble is, now I need to step through those keys and put those values into the scoreboard (In this case Ngui labels). I can find individual keys by their text string, but what I need is a way to get item 1 and set it, get item 2 and set it, etc.

Is there any way to do this without knowing the key strings? This probably isn't even the best way to do this, but I've looked around and haven't found any good examples of this for a networked game, so I'm trying to do it from scratch. any links to examples would also be greatly appreciated.

Thanks.

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How do I step through keys in an arraymaker hash table?
« Reply #1 on: June 03, 2013, 02:09:13 AM »
Hi,

 For this, you need to do the following:

 store all keys into an arrayList using the action "HashTableKeys"

then you work with arrayGetNext, and you iterate through all keys, you can then access back each values.

 Does that make sense? I have added in my todo an entry to provide a convenient actions to do that like HashTableGetNext, hopefully this will be soon available ( have to finish serialization first tho).

bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: How do I step through keys in an arraymaker hash table?
« Reply #2 on: June 03, 2013, 07:01:33 AM »
Hi,

 Updated ArrayMaker on the wiki, you'll find a new action: HashTableGetNext :)

bye,

 Jean

Gevarre

  • Playmaker Newbie
  • *
  • Posts: 49
Re: How do I step through keys in an arraymaker hash table?
« Reply #3 on: June 03, 2013, 12:47:32 PM »
Many thanks as usual  ;D