Options for retrieving int into global variables.

0 favourites
  • 2 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Hey y'all, let me start off with the picture above to provide a better explanation. So currently, I have 3 different tiers, as you may see Tier 4-6, with them being 10prizes for tier 4, 5 prizes for tier 5, 5 prizes for tier 6. And each time a person gets one of these prizes, the numbers are deducted by 1.

    Credits to dop2000 for the tween code & logic provided

    But as these numbers are fixed, everytime a person plays the game on my server, the prizes resets, and I do not want that. How do I make it so the global variables remains changed permanently? So if someone gets prize 4, it goes from 10>9, and the next person that gets it, it goes from 9>8. Local storage is out of the question, as this game is intended for different players. I had asked a similar question previously, and I'll be trying the solution (Which is reading a txt file using Ajax) when I'm home from work to see if it works. But I'm open to other solutions, hopefully something which will allow me to directly read from my database table, and once it is done subtracting the prize, it'll post and overwrite the content in the database but I'm not sure if this is possible.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yooo man!

    The txt file will work for sure.

    But it's completely possible to do the database thing:

    SQL has the "-" operator, so you could do something like "UPDATE * where `tier` = $tier VALUES `chances` = `chances`-1". you just need to call that by PHP or something. That's the ideal if your game will be played in multiplayer with some people at the same time, so it doen't conflict any information!

    Hope i helped you someway, if not ask again 'cus maybe i didn't understood your point or if you need more information about my method. But please don't chance post for that, i still wanna see what is your solution at the end.

    -- Yuri Seiya from Utopic Blades Team --

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