playMaker

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

shadowof047

  • Playmaker Newbie
  • *
  • Posts: 16
"Hashtable add many " Action doesnt add items in order.
« on: March 06, 2017, 08: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, 10:17:28 PM by shadowof047 »

joaobsneto

  • Playmaker Newbie
  • *
  • Posts: 6
Re: "Hashtable add many " doesnt add in items in order.
« Reply #1 on: March 06, 2017, 09: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: 16
Re: "Hashtable add many " doesnt add in items in order.
« Reply #2 on: March 06, 2017, 10: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: 15500
  • Official Playmaker Support
Re: "Hashtable add many " Action doesnt add items in order.
« Reply #3 on: March 07, 2017, 12:44:59 AM »
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