playMaker

Author Topic: "Hashtable add many " Action doesnt add items in order.  (Read 274 times)

shadowof047

  • Playmaker Newbie
  • *
  • Posts: 15
    • View Profile
"Hashtable add many " Action doesnt add items in order.
« on: March 06, 2017, 06:15:15 PM »
Hello .

As i said in the title , the action "hashtable add many" doesnt add items in the order defined in it , it seemed random to me , but maybe there is a pattern to it.

the order is important because i'm trying to use hashtables for a series of simple conversations between some characters , but now , sentences are getting mixed up. i am aware i can do this some other way . but this is also simple and easy.

In the attached picture you can see that , the items order in the action is different than the hashtable proxy .so  is this a bug or i can fix this ?
« Last Edit: March 06, 2017, 08:17:28 PM by shadowof047 »

joaobsneto

  • Playmaker Newbie
  • *
  • Posts: 6
    • View Profile
Re: "Hashtable add many " doesnt add in items in order.
« Reply #1 on: March 06, 2017, 07:42:24 PM »
I never used this action before, but I believe that Hashset do not have order. You should use a list data structure.

shadowof047

  • Playmaker Newbie
  • *
  • Posts: 15
    • View Profile
Re: "Hashtable add many " doesnt add in items in order.
« Reply #2 on: March 06, 2017, 08:14:26 PM »
I never used this action before, but I believe that Hashset do not have order. You should use a list data structure.

well , there goes my hope for a conversation system with hashtable :-\ .
i already made a similar system with arraylists , but i liked the hastable one better  ;D

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12342
  • Official Playmaker Support
    • View Profile
Re: "Hashtable add many " Action doesnt add items in order.
« Reply #3 on: March 06, 2017, 10:44:59 PM »
Hi,

You will be better off building a conversation system using Xml, it will be a lot more manageable and productive.

and yes, Hashtable have this issue that their keys is not ordered, so during compilation the order in which you created them is not respected, by design.

Bye,

 Jean