Author Topic: Globals restarting?  (Read 1875 times)

RebornIsaac

  • Cherry Eater
  • Posts: 65
  • ~(´・ω・`)~
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 44.0.2403.130 Chrome 44.0.2403.130
    • View Profile
  • Playstyle: Keyboard
Globals restarting?
« on: August 14, 2015, 04:35:34 PM »
Whenever I restart my game, the globals restart, let's say item1 is at 1 when I restart/close it, and when I come back its again at 0, why does this happen? How can I keep the globals constant?
(Btw, Engine used is I Wanna Be The Engine V2)

Kyir

  • The Kid
  • Posts: 293
  • Normal Guy
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 44.0.2403.155 Chrome 44.0.2403.155
    • View Profile
  • Playstyle: Keyboard
Re: Globals restarting?
« Reply #1 on: August 14, 2015, 06:25:01 PM »
They're resetting because you're not actually saving the value of the variable. You need to fiddle with the save/load code for that, but I'm not sure how that engine structures it.

pieceofcheese87

  • Global Moderator
  • The Kid
  • Posts: 346
  • Personal Text
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 44.0.2403.155 Chrome 44.0.2403.155
    • View Profile
    • Twitch Tv Channel
  • Playstyle: Keyboard
Re: Globals restarting?
« Reply #2 on: August 14, 2015, 07:04:05 PM »
Why are you using such an old and outdated engine?
Signature

Derf

  • Guest
Re: Globals restarting?
« Reply #3 on: August 14, 2015, 07:36:20 PM »
Whenever I restart my game, the globals restart, let's say item1 is at 1 when I restart/close it, and when I come back its again at 0, why does this happen? How can I keep the globals constant?
(Btw, Engine used is I Wanna Be The Engine V2)
The game restart function is essentially the same as the game closing then starting again, so that's why no variables are saved over. Your three options to fix this are:

1). Set every global variable to be saved and loaded in the save and load scripts of the engine.

2). Rework the game over system so that it restarts the room and not the game.

3). Use a different engine that handles things better (though I'm not sure which I'd suggest as every engine I've used I have inevitably had to recode the saving system as they are generally pretty terrible).

patrickgh3

  • Spike Dodger
  • Posts: 169
  • stay optimistic! :D
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 44.0.2403.155 Chrome 44.0.2403.155
    • View Profile
    • Github
  • Playstyle: Keyboard
Re: Globals restarting?
« Reply #4 on: August 15, 2015, 03:47:29 PM »
I said pretty much the same thing as Derf in this thread, which is essentially the same issue. https://www.iwannacommunity.com/forum/index.php?topic=1823.0