Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Game.Reset() problem  (Read 2785 times)

0 Members and 1 Guest are viewing this topic.

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Game.Reset() problem
« on: January 03, 2007, 10:44:27 PM »

This may be very blunt question which I've just recently discovered, but here goes. What exactly does Game.Reset() do?
I naively thought that it's sufficient to call it for restarting the game, but not so. In my case I have in game.script this:

global ConversationEnded = true;

upon Game.Reset this global contains [null] (thanks for the debugging console :)) So what exactly should I do for restarting a game?
Should I recreate all objects, reinitialize all variables? This would be nice to know to avoid bad bugs, like the one I was just struggling with.

Thanks for any help on this one!
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Game.Reset() problem
« Reply #1 on: January 04, 2007, 08:24:52 AM »

Should I recreate all objects, reinitialize all variables?
Yes, you'll have to. Game.Reset() sets all global variables to null. Other than that, it resets the inventory, dialogue responses and scene states.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Game.Reset() problem
« Reply #2 on: January 04, 2007, 09:53:39 AM »

Thanks! I got caught by "random bugs" I was never able to replicate until I restarted the game. :) Maybe it would be great to state
this explicitly in the documentation for the similary blunt persons as I am. :)

One more question though: do I have to recreate all objects and reload all windows too?

or maybe isn't the fastest way to Game.DetachScript("scripts/game.script"); with following reattach if really everything has to be
recreated (windows, objects, etc.)?
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Game.Reset() problem
« Reply #3 on: January 04, 2007, 10:23:23 AM »

If you have some persistent objects/windows running all the time, you should indeed recreate them. Actually you should destroy them prior to calling reset and then recreate them. Either by re-running game.script or perhaps moving the initialization code to a separate script/function.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Game.Reset() problem
« Reply #4 on: January 04, 2007, 11:08:15 AM »

Thanks! Will do this.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet
 

Page created in 0.02 seconds with 24 queries.