playMaker

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

marv

  • Junior Playmaker
  • **
  • Posts: 50
    • View Profile
Hashtable get variable type for key
« on: May 10, 2017, 12: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, 12:58:39 AM by marv »

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 12351
  • Official Playmaker Support
    • View Profile
Re: Hashtable get variable type for key
« Reply #1 on: June 05, 2017, 11:42:44 PM »
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: 12351
  • Official Playmaker Support
    • View Profile
Re: Hashtable get variable type for key
« Reply #2 on: June 22, 2017, 01: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