Please login or register.

Login with username, password and session length
Advanced search  

News:

IRC channel - server: waelisch.de  channel: #wme (read more)

Author Topic: Problem overriding changeScene method  (Read 6688 times)

0 Members and 2 Guests are viewing this topic.

lacosaweb

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 116
    • View Profile
Problem overriding changeScene method
« on: November 06, 2021, 02:19:11 PM »

Hi, I write my custom Game.ChangeScene method:

Code: [Select]
method ChangeScene(Scene_name,fadeout,fadein)
{
global altermenuopciones;
if(Game.ChangingScene)
return;
if(Scene.Name!="negro" && Scene.Description!="intro")
{
if(altermenuopciones==null)
{
altermenuopciones=menu_opciones;
}
else
{
return;
}
}
if(fadeout==null) fadeout=true;
menu_opciones = true;
global selected_item;
Game.SelectedItem = null;
selected_item = null;

if(fadeout==true)
{
Game.FadeOut(250,0,0,0,255);
}

FondoScup(true);
Game.ChangeScene(Scene_name, false, false);
}


The method works ok but the script stands in memory and never disappear.
In debug console I can see that it gets through to the end, but every time I change scene a new changeScene item is added in memory.
This doesen't happen when I replance the las line of my method "Game.ChangeScene(Scene_name, false, false);" to "Game.ChangeScene(Scene_name);". But I need to change Scene without fade.

Logged

HCDaniel

  • Regular poster
  • ***
  • Karma: 8
  • Offline Offline
  • Posts: 168
    • View Profile
Re: Problem overriding changeScene method
« Reply #1 on: November 13, 2021, 11:26:59 AM »

I'm wondering whether you are accidentally created a recursion, since you are overwriting Game.ChangeScene(arg1,arg2,arg3) - but at the end of your function you are calling it with the same arguments again. According to the docs here http://docs.dead-code.org/wme/scripting_about_methods.html (unfortunately link doesn't work so you need to navigate there yourself) you should explicitly specify that you are calling the "original" method by using the "this" keyword. Might be worth a try ;)

Logged

lacosaweb

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 116
    • View Profile
Re: Problem overriding changeScene method
« Reply #2 on: November 20, 2021, 07:39:59 PM »

Hi, I changed the line
   Game.ChangeScene(Scene_name, false, false);
to
   this.ChangeScene(Scene_name,false,false);

The same result. Any other idea?

Thanks
Logged
 

Page created in 0.04 seconds with 19 queries.