Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: Problems with changing scenes  (Read 6102 times)

0 Members and 1 Guest are viewing this topic.

Mac

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 136
    • View Profile
    • Homepage
Problems with changing scenes
« on: April 04, 2005, 10:46:46 PM »

Hi,

I have a problem with changing scenes that looks like this:

Like in the wme demo project, it is possible to change the scene immediatly with a double click in our game. But when I use the double click and I am in the next scene (for example I go from a location to the map), I have to use a double click again to go back. The 'LeftClick' event is no longer being triggered in the script.

In other words: When I use left mouse clicks to change the scenes it works perfectly but when I use left double click just one time, I have to use it always after that because changing with just a single left click doesn't work.

That occurs even if the executed script parts are the same, like this:

Code: [Select]
#include "scripts\base.inc"


////////////////////////////////////////////////////////////////////////////////
on "LeftClick" {
  Game.ChangeScene("scenes\AmBrunnen\AmBrunnen.scene");
}


////////////////////////////////////////////////////////////////////////////////
on "LeftDoubleClick" {
  Game.ChangeScene("scenes\AmBrunnen\AmBrunnen.scene");
}

Does anyone know a clue ?

Thanks
Mac
Logged

organican

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Posts: 74
    • View Profile
Re: Problems with changing scenes
« Reply #1 on: April 05, 2005, 01:38:34 AM »

One thing that you might want to try that just might help you out, is this itsy-bitsy teeny-weeny piece of code:

on "something"
{
 Game.ChangeScene("scenes\" + Game.PrevScene + "\" + Game.PrevScene + ".scene");
}

(As long as the scene is in the "scenes" folder and it's folder-name is the same as it's *.scene filename.)

Hope that help's ya out!
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Problems with changing scenes
« Reply #2 on: April 05, 2005, 08:26:31 AM »

Hm, that's strange. I can't do any tests at the moment, but Five magical amulets is using doubleclicks all the time without any problems..
So if you put e.g. Game.Msg("something"); to the LeftClick handler it doesn't get executed at all?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Mac

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 136
    • View Profile
    • Homepage
Re: Problems with changing scenes
« Reply #3 on: April 05, 2005, 02:24:37 PM »

No, it doesn't get executed. Sometimes after changing between two scenes using double click a few (3-4) times, the LeftClick handler comes back to life again. But it should always work and that is not the case. I have no idea what that could be.

Mac
Logged

Mac

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 136
    • View Profile
    • Homepage
Re: Problems with changing scenes
« Reply #4 on: April 05, 2005, 03:37:56 PM »

Just worked on it a bit and I noticed that this thing only occurs in the map scenes. In all these scenes is the main actor disabled (actor.Active=false). So the error description changes to this:

If I enter a scene in which the actor is disabled using a double click I can not change to another scene using a LeftClick event MOST of the time, not always. Double clicks do always work.

Still strange to me.

Mac
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Problems with changing scenes
« Reply #5 on: April 05, 2005, 05:39:51 PM »

I tried it and unfortunately I'm unable to replicate the error. I think there must be some other factor involved. Could you please post both of those exit scripts in their entirety?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Mac

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 136
    • View Profile
    • Homepage
Re: Problems with changing scenes
« Reply #6 on: April 05, 2005, 06:07:19 PM »

Ok.

So here is the scene_init.script of a scene where it occurs.
It's from one of the 'map scenes'. From here you can go to 5 different locations:
Code: [Select]
#include "scripts\base.inc"

// here comes the stuff which initializes the scene
switch(Game.PrevScene)
{
case "AmBrunnen":
 Game.StopSound();
 break;
case "MI_Karte":
 // Game.PlayMusicChannel(1, "Spacig1.ogg");
 // Game.MusicCrossfade(0, 1, CrossfadeSpeed);
 break;
}

actor.SkipTo(400, 1000);
actor.Direction = DI_DOWN;
actor.Active = false;


////////////////////////////////////////////////////////////////////////////////
// scene state
global StateMarktplatz;


// default values
if(StateMarktplatz==null)
{
  StateMarktplatz.Visited = false;
  // add scene states here
}



////////////////////////////////////////////////////////////////////////////////
// setup scene according to state variables



////////////////////////////////////////////////////////////////////////////////
if(!StateMarktplatz.Visited)
{
  StateMarktplatz.Visited = true;

  // this is our first visit in this scene...
}


This is a script of one of the five region entities that are in that scene where LeftClick doesn't work:
Code: [Select]
#include "scripts\base.inc"


////////////////////////////////////////////////////////////////////////////////
on "LeftClick" {
  Game.ChangeScene("scenes\VorDemTanteEmmaLaden\VorDemTanteEmmaLaden.scene");
}


////////////////////////////////////////////////////////////////////////////////
on "LeftDoubleClick" {
  Game.ChangeScene("scenes\VorDemTanteEmmaLaden\VorDemTanteEmmaLaden.scene");
}

This is the script to go back to the faulty scene (the map):
Code: [Select]
#include "scripts\base.inc"


////////////////////////////////////////////////////////////////////////////////
on "LeftClick" {
  actor.GoToObject(this);
  Game.ChangeScene("scenes\Marktplatz\Marktplatz.scene");
}


////////////////////////////////////////////////////////////////////////////////
on "LeftDoubleClick" {
  Game.ChangeScene("scenes\Marktplatz\Marktplatz.scene");
}

Basic stuff really ... what's my fault ?

Mac
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Problems with changing scenes
« Reply #7 on: April 05, 2005, 06:17:43 PM »

Huh, no idea. I have basically the same code here and it works ok. Make sure the exit region entity isn't obstructed by some other object (when you point the mouse pointer at it its name should be displayed in the upper right part of the screen). Also you can try removing the "LeftDoubleClick" handler from the map region entity to see if it makes any difference (it's unnecessary anyway).
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Mac

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 136
    • View Profile
    • Homepage
Re: Problems with changing scenes
« Reply #8 on: April 05, 2005, 06:21:27 PM »

Well ...

I just noticed that when I delete the 'actor.Active=false;' line from the first code in the last reply it works as it is supposed to. When I put it back in the error returns. Maybe no bug but something I overlooked ? Does 'actor.Active' have anything to do with the event handler system ?

Mac
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Problems with changing scenes
« Reply #9 on: April 05, 2005, 06:33:07 PM »

Does 'actor.Active' have anything to do with the event handler system ?
Nope, it shouldn't affect scene entities in any way ???
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Mac

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 136
    • View Profile
    • Homepage
Re: Problems with changing scenes
« Reply #10 on: April 05, 2005, 07:01:58 PM »

I removed all 'actor.Active=false;' lines from all the map scripts and now everything works perfectly. And I don't even remember why I put this line in. I already positioned the actor outside of the screen and there is no floor entity so he won't move. And that's all it should do. (Maybe there is something I will notice in a while.  ;)

So problem's gone I think.
Sorry for wasting your time.

Thanks
Mac
Logged
 

Page created in 0.183 seconds with 23 queries.