Wintermute Engine Forum
Wintermute Engine => Bug reports => Topic started by: Kaz on August 09, 2008, 06:51:16 AM
-
We make a lot of use of Game.Interactive = false, mainly on doors.
on "LeftClick"
{
Game.Interactive = false;
//Display the open door
//Play the door sound
Sleep(1000);
Game.ChangeScene(destination scene);
Game.Interactive = true;
}
With the above routine, Game.Interactive = false; was used because the documentation says it disables user input. But as several of our testers have found, Game.Interactive = false can be defeated. If the player clicks again during that routine (i.e. double-click), the ChangeScene takes place, but the Game.Interactive = true; isn't obeyed and the player is left permanently with the egg timer.
Our workaround is to disable the hotspot before the Game.Interactive = false; thus:
on "LeftClick"
{
var a = Scene.GetNode("open_door");
a.Active = false;
Game.Interactive = false;
//Display the open door
//Play the door sound
Sleep(1000);
Game.ChangeScene(destination scene);
Game.Interactive = true;
}
So as to disable input locally before doing it at a Game object level. Then it seems impossible to cause the hang.
-
the problem might be more connected to placing
Game.Interactive = true; after the ChangeScene, I'd never do this because it might bring a lot of instabilities.
-
Hi MM
Is that for sure? Because we're going to have to change every door script in the game, something I want to do only once - and I have a choice now as to whether to shut hotspots or change the order of Game.Interactive = true;
Cheers
-
take it this way. Game.ChangeScene is a method, not an event so the code goes on after the scene changing is complete. As the scene change detaches all Scene attached scripts, it's a matter of pure luck, if your script will survive long enough to be finished. This can bring in those ugly bugs which on some computers appear while on others no and they're pretty random.
I'd be glad if Mnemonic verified it here, but I myself had to change many many scripts upon realizing what's going on.
-
The script finishes the code after ChangeScene. *Unless*, I think, you kill the scene elsewhere in the meantime. I'm not convinced mere clicking can affect interactivity state, they're completely unrelated. Does your game have any double-click handlers? If so, what do they contain?
-
I've not scripted any double-click handlers anywhere. Are there any in the engine?
-
I should have confirmed in my last post that interactivity fails in the way described and has been independently found by a number of our beta testers. Whatever happens, I'm going to have to change hundreds of scripts, but I'm convinced there's something wrong with Game.Interactive = false. I'll be manually disabling whatever hotspot/region/sprite I've just clicked on, so maybe that should be automatic.
Cheers
-
well, I use Game.Interactive almost all the time, having game published and the only issue I ran into was the one I've described. The other suggested workaround is intercepting Game.ChangeScene in game.script as follows:
method ChangeScene(name)
{
Game.Interactive = true;
Game.ChangeScene(name);
}
this would save you tons of changes. ;)
-
Hi MM
Thanks for the idea.
Your method might work but all over the game we have differences in the way we use ChangeScene - some are dissolves, some are immediate, so we'd have to pass those parameters too, and I wouldn't know where to begin doing that.
Cheers