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: Unload window don't work !  (Read 2791 times)

0 Members and 1 Guest are viewing this topic.

Endrit

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 62
    • View Profile
Unload window don't work !
« on: January 30, 2012, 09:36:16 PM »

Hi guys !
I need your help , I had a look on forum about the problem i have but i didn't find nothing !

Here's my problem :
I've created e new empty scene . In this scene i put this code :

Code: [Select]
#include "scripts\base.inc"
actor.Active = false;
///////////////////////////////////////////////////////////////
Game.SetCursor("ui_elements\mouse\mouse.sprite");

////////////////////////////////////////////////////
var [glow=red,2,300]WinMenu[/glow] = Game.LoadWindow("interface\system\menu2.window");
WinMenu.GoExclusive();

Well , I used in this script the var WinMenu to load a window with the GoExclusive(); method .

This menu is the game menu window , and when user click on New game it load another window with the same window , which ask to do tutorial or not . Well when user click on one of the options the game should unload the windows but this doesnt function .
this is the code on the tutorial ask window :

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

this.xResult = false;


////////////////////////////////////////////////////////////////////////////////
on "close"
{
  this.Close();
}


////////////////////////////////////////////////////////////////////////////////
on "New Game"
{
Game.ChangeScene("scenes\intro00001\intro00001.scene");

Game.UnloadObject("interface\system\menu2.window");

   Game.UnloadObject(this);



 
 
}

////////////////////////////////////////////////////////////////////////////////
on "Keypress"
{
  var button;

  if(Keyboard.KeyCode==VK_ESCAPE)
  {
    button = this.GetControl("close");
    button.Press();
  }
  else if(Keyboard.KeyCode==VK_RETURN)
  {
    button = this.GetControl("yes");
    button.Press();
  }

Hope I described it clearly !

Thank you for your time ! ::rock



 ::beer ::beer ::beer ::beer ::beer ::beer ::beer ::beer ::beer ::beer ::beer ::beer ::beer ::beer ::beer ::beer ::beer ::beer
« Last Edit: January 30, 2012, 09:39:53 PM by Endrit »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Unload window don't work !
« Reply #1 on: January 31, 2012, 06:42:17 PM »

Well I didn't study all of it, but this line is definitely wrong:

Game.UnloadObject("interface\system\menu2.window");

The method accepts a reference to the actual object, not a filename.

When loading a window, store the reference to it, and use that reference to unload it later:

Code: WME Script
  1. var someWindow = Game.LoadWindow("path\file.window");
  2. ...
  3. ...
  4. Game.DeleteWindow(someWindow);
  5.  
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.072 seconds with 24 queries.