playMaker

Author Topic: Hashtable get variable type for key  (Read 2359 times)

marv

  • Junior Playmaker
  • **
  • Posts: 50
Hashtable get variable type for key
« on: May 10, 2017, 03:44:17 AM »
I'd like an action that let's you provide the key for an item in a hashtable (Arraymaker package) and returns the variable type (int,bool etc.) in some form, preferably a string or even as events for various types.

Use case/context:

I'm currently building debug tools for my game and would like to do a simple dev console to enable testers to easily change the values for various variables stored in hash tables.

However, since I am currently storing variables of different types in the same hashtables (every character has a table to track their stats + a central hash table for "global" stats) there's no easy way to do this without possibly screwing up the game state by storing the wrong type of variable to a key.

This would also be helpful to keep similar problems when manipulating variables in a way that's not hardcoded but dynamic, when using game events provided by xml for example. It's rather easy to slip up here and provide a wrong variable name, possibly screwing up players' savegames. With this kind of action one could implement a check to see if the variable type of the item in the hash table is the same as the one provided by the game event and stop it from overwriting the item if it isn't.
« Last Edit: May 10, 2017, 03:58:39 AM by marv »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Hashtable get variable type for key
« Reply #1 on: June 06, 2017, 02:42:44 AM »
Hi,

 This all make sense. I am in the process of making some new features for ArrayMaker I'll include this in the mix.

 Bye,

 Jean

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Hashtable get variable type for key
« Reply #2 on: June 22, 2017, 04:46:38 AM »
Hi,

 ok, two new actions "ArrayListGetType" and "hashtableGetType" will now let you know which type if for that element, and if element is null, it will return the prefill type.

Please update from the Ecosystem :)

Let me know how it goes.

 Bye,

 Jean