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: Trying to display my own window  (Read 5720 times)

0 Members and 1 Guest are viewing this topic.

Uhfgood

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 117
  • No pain, no game!
    • View Profile
    • Indie Flux
Trying to display my own window
« on: August 02, 2012, 09:01:55 PM »

For some strange reason I can not get a window I created to display at all.  I tried it in game.script, game_loop.script, and scene.script, by setting Visible to true.  It will not show up at all.  I tried modifying the x and y position in the window editor just in case it was showing off screen, and it wasn't.

I *do* know that it *does* load up in game.script -- and will display when the game starts if it's visible flag is true.  But set it to false in game.script, and then try to set it to true in any other script just doesn't work.

What am I doing wrong?
Logged
--------------------------------------------
Keith Weatherby II
uhfgood -AT- frontier -DOT- com
Games Afoot Software
Indie Flux - Previews, Reviews, News and more!
--------------------------------------------

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Trying to display my own window
« Reply #1 on: August 03, 2012, 06:39:43 AM »

Since we don't know *what* exactly you're doing it's hard to say what you're doing wrong. Post your scripts.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Spellbreaker

  • Supporter
  • Frequent poster
  • *
  • Karma: 4
  • Offline Offline
  • Gender: Male
  • Posts: 376
    • View Profile
    • Apeiron Studios
Re: Trying to display my own window
« Reply #2 on: August 03, 2012, 09:50:58 AM »

As Mnemonic said, show your scripts, but a simple guess from my side would be: Did you forget to set the variable containing your window object to global?
Logged

Uhfgood

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 117
  • No pain, no game!
    • View Profile
    • Indie Flux
Re: Trying to display my own window
« Reply #3 on: August 03, 2012, 05:13:15 PM »

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

// store some of the game's attributes in global variables for convenience
Keyboard = Game.Keyboard;
Scene = Game.Scene;


// load the right-click menu
global WinMenu = Game.LoadWindow("interface\menu\menu.window");
WinMenu.Visible = false;

// load the "caption" window
var win = Game.LoadWindow("interface\system\caption.window");
global WinCaption = win.GetControl("caption");


global PieMenu = Game.LoadWindow("\interface\menu\pie_menu.window");
PieMenu.Visible = false;

global MenuObject = null;


// load our main actor
actor = Game.LoadActor("actors\Harold\Harold.actor");
Game.MainObject = actor;

// run the "game loop" script
Game.AttachScript("scripts\game_loop.script");


// which scene to load?
Game.ChangeScene(Game.StartupScene);



////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
PieMenu.Visibile = true;

/*
// what did we click?
var ActObj = Game.ActiveObject;
if(ActObj!=null)
{
ActObj.ApplyEvent("LeftClick");
}
// else propagate the LeftClick event to a scene
else
{
Scene.ApplyEvent("LeftClick");
}
*/
}



////////////////////////////////////////////////////////////////////////////////
on "RightClick"
{
 
}


////////////////////////////////////////////////////////////////////////////////
on "Keypress"
{
  // on Esc or F1 key
  if(Keyboard.KeyCode==VK_ESCAPE || Keyboard.KeyCode==VK_F1)
  {
    // load and display the main menu window
    WinCaption.Visible = false;
    var WinMainMenu = Game.LoadWindow("interface\system\mainmenu.window");
    WinMainMenu.Center();
    WinMainMenu.GoSystemExclusive();
    Game.UnloadObject(WinMainMenu);
  }
}


////////////////////////////////////////////////////////////////////////////////
on "QuitGame"
{
  // on Alt+F4 (window close)
  // load and display the quit confirmation window
  WinCaption.Visible = false;
  var WinQuit = Game.LoadWindow("interface\system\quit.window");
  WinQuit.Center();
  WinQuit.GoSystemExclusive();

  // and if the user selected Yes
  if(WinQuit.xResult)
  {
    // quit the game
    Game.QuitGame();
  }
  // otherwise just unload the quit window from memory
  else Game.UnloadObject(WinQuit);
}
Logged
--------------------------------------------
Keith Weatherby II
uhfgood -AT- frontier -DOT- com
Games Afoot Software
Indie Flux - Previews, Reviews, News and more!
--------------------------------------------

Dan Peach

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 100
    • View Profile
    • Viperante - Game Development
Re: Trying to display my own window
« Reply #4 on: August 03, 2012, 05:51:28 PM »

Spelling mistake on your first LeftClick instruction. Dunno if that's the problem, but it won't help. :)

Uhfgood

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 117
  • No pain, no game!
    • View Profile
    • Indie Flux
Re: Trying to display my own window
« Reply #5 on: August 03, 2012, 08:03:10 PM »

Fixed.  And in fact it's actually displaying now.  Maybe I was spelling it wrong all the time for some reason.

Thanks for spotting it, sometimes people tend to overlook something when they kept looking at it for so long.
Logged
--------------------------------------------
Keith Weatherby II
uhfgood -AT- frontier -DOT- com
Games Afoot Software
Indie Flux - Previews, Reviews, News and more!
--------------------------------------------
 

Page created in 0.041 seconds with 20 queries.