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: Can't get AfterLoad to trigger  (Read 7608 times)

0 Members and 2 Guests are viewing this topic.

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Can't get AfterLoad to trigger
« on: March 20, 2012, 02:45:41 PM »

Hi All

I can't get AfterLoad to trigger and was wondering if anybody could suggest why. In my Main Menu window, I have this:
on "PlayButton"
  {
  Game.GoForIt = true;
  if(Game.IsSaveSlotUsed(CurrentPlayerSlot) == true)
    {
   Game.LoadGame(CurrentPlayerSlot);
   Game.Msg("Load game executed");
   }
  CloseThis();
  }

I have this in game.script:
on "AfterLoad"
  {
  for(var ddd = 1; ddd<11; ddd=ddd+1)
    {
    Game.Msg("Afterload reached");
   }
  if(MainMenu.State != null)
    {
   Game.Msg("MainMenu Detected");
   var mmwin = MainMenu.State;
   mmwin.Close();
   MainMenu.State = null;
   MainMenu.Showing = false;
   Game.UnloadObject(mmwin);
   }
  }

The AfterLoad is never reached and the menu window doesn't close. Any ideas?

Thanks
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: Can't get AfterLoad to trigger
« Reply #1 on: March 20, 2012, 04:48:58 PM »

I should add that I've looked at all the other mentions of AfterLoad here, and I've made sure these are clean saves.
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

Spellbreaker

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Gender: Male
  • Posts: 376
    • View Profile
    • Apeiron Studios
Re: Can't get AfterLoad to trigger
« Reply #2 on: March 20, 2012, 05:43:33 PM »

Strange. Actually I copied that reach-loop. My afterload works perfectly, but for some reason the Game.Msg does not seem to work. The rest in my case works ( plugin gets started and music gets loaded ).

I dunno why the game.msg does not work. Break Points in the debugger doesn't seem to work either.
Logged

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: Can't get AfterLoad to trigger
« Reply #3 on: March 20, 2012, 06:12:50 PM »

So is it me or is it a (gulp) bug, do you think? :-(
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

Spellbreaker

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Gender: Male
  • Posts: 376
    • View Profile
    • Apeiron Studios
Re: Can't get AfterLoad to trigger
« Reply #4 on: March 20, 2012, 07:00:25 PM »

I think it's a bug. But as I said, other code gets executed, except that game.msg stuff.
Logged

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: Can't get AfterLoad to trigger
« Reply #5 on: March 20, 2012, 07:06:19 PM »

What I don't get is why Afterload works for you, using my code, but not in the context I took it from ????
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

Spellbreaker

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Gender: Male
  • Posts: 376
    • View Profile
    • Apeiron Studios
Re: Can't get AfterLoad to trigger
« Reply #6 on: March 20, 2012, 07:29:43 PM »

I really don't know.
Logged

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: Can't get AfterLoad to trigger
« Reply #7 on: March 20, 2012, 07:36:53 PM »

Thanks for the input. If I can't get this to work, I'm going to be really stuck. God, I hope it's not a bug.
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Can't get AfterLoad to trigger
« Reply #8 on: March 21, 2012, 07:55:01 AM »

If I put this to game.script, I get the message with no problems:

Code: WME Script
  1. on "AfterLoad"
  2. {
  3.   Game.Msg("after load");
  4. }
  5.  

Even if I use Kaz' loop, I get lots of messages.

Kaz, you should start with something simple (just the message) and then keep adding your more complex code to see when/if it breaks. But make sure to always save the game with the modified scripts first.

Also, Game.LOG() is perhaps more appropriate for testing, because the log file doesn't disappear after a few seconds ;)
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: Can't get AfterLoad to trigger
« Reply #9 on: March 21, 2012, 09:41:22 AM »

Thanks Mnemonic, I'll give it a try. But I'm a bit concerned about committing code to a function, that may be selective about what instructions it obeys  ;D

However, I think I may also have figured out alternative way of doing it, via the Registry.

Cheers
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Can't get AfterLoad to trigger
« Reply #10 on: March 22, 2012, 10:36:24 PM »

AfterLoad works. I use it all the time. Keep in mind that the after load code must be present in your savegame. If you are loading savegame from the time before you've implemented AfterLoad, it will not work.
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Azrael

  • Regular poster
  • ***
  • Karma: 9
  • Offline Offline
  • Gender: Male
  • Posts: 155
    • View Profile
    • Mad Orange
Re: Can't get AfterLoad to trigger
« Reply #11 on: March 23, 2012, 09:26:29 AM »

AfterLoad works also for us, never had problem with that.
Logged

Kaz

  • Arberth Studios
  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 228
  • The story is the game
    • View Profile
    • Info on 'Rhiannon' & 'Coven'
Re: Can't get AfterLoad to trigger
« Reply #12 on: March 25, 2012, 05:21:09 PM »

Thanks to all - I did as suggested and stripped the code down until I could convince myself my code was at fault, on the presumption that it's usually me, :-[ not Mnemonic. It's working now. 8)

I'm using this for the classic "Large Aquatic" style of Autosave. Exit from In-Game menu window saves game, then loads main menu window, to allow to quit altogether, etc. The problem is, the loaded save then takes up from that point, so loads the main menu again. To get round this, I use AfterLoad to set a global Game.PostLoad=true, then test for that every time I load the main menu from the ingame menu. If you've *not* just loaded a game, go to the main menu; else, carry on playing; either way, turn PostLoad off or you'll never be able to go to the main menu. That's just my way of doing it, thanks to you guys. I'm sure others have more sophisticated ways. If you do, I'd love to read/study/steal them.  >:D
Cheers,
Logged
\"Fans of popular horror adventures like Scratches and Barrow Hill should start bracing themselves for another haunting experience, as independent developer Arberth Studios has announced production on its debut title Rhiannon - Curse of the Four Branches.\" - AdventureGamers.com
 

Page created in 0.027 seconds with 22 queries.