a question relateing to the hash table object.

This forum is currently in read-only mode.
From the Asset Store
Game with complete Source-Code (Construct 3 / .c3p) + HTML5 Exported.
  • i am making a game similar to guitar hero. the notes are stored in external files (hash tables). currently i have 2 applications. an encoder and a decoder. the game works around a simple time mechanism.

    every 100 milliseconds add 1 to global var 'time'

    that is basically what i did for the timer. here is how i want the program to work. i want to store the note as a vale in the hash table. i want the keys to be named as the current 'time' variable.

    unfortunately i cannot figure out how to name a key after a variable. however construct wont let me do the following : & global('time')

    this is under key name.

    here is the real problem, if i cant have the keys automatically named and recalled from a simple string my encoding and decoding system will not work....

    does anyone have any ideas.....

  • why &global('timer')

    why not just global('timer')

  • if i type in global('timer') nothing happens

    as in it accepts the code but when i run it in debug the key doesn't get created... there has got to be a way to do it though.

  • sorry, try:

    ""&global('timer')

  • you rock!! it works! now i should be able to finnish the beta by the end of the week

    i guess i was putting a space between & and global('timer') or some thing like that. (but why does it usually accept that?) but none the less thank you very much!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • same as str(global('timer')) ?

  • same as str(global('timer')) ?

    Yes, if you want to insert a key you have to specify the key name as string if it isn't already. Unfortunately it doesn't work automatically with the hash table.

    This is especially annoying when you want to add keys and values dynamically from an INI for example. You have to tell the hash if it's a value, string or float. Otherwise it will remain 0.

    This is one of the major quirks I see with hash tables, which are otherwise very useful. Unless I'm overlooking something obvious or there's a good reason it works the way it does... at least I can't think of one.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)