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: Hiding Buttons on a Window  (Read 2162 times)

0 Members and 1 Guest are viewing this topic.

VonDoom

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 11
    • View Profile
Hiding Buttons on a Window
« on: January 21, 2010, 12:15:54 AM »

Hi, I'm trying to create a fullscreen map and I want to hide the rooms buttons until they visit them. The visited room state is stored in a var called MyScene[n], n being the number of the room. The buttons all have the names "R1", "R2", etc.

This is what I got so far. For some reason the buttons on the map aren't hiding.

Code: [Select]
this.Close();
// load and display the map
var WinMainMenu = Game.LoadWindow("interface\map\map.window");
var WinControl;

//turns on or off the visited rooms on the map
for(var i=0; i<MyScene.Length; i=i+1)
        {

WinControl=WinMainMenu.GetControl(Game.ExpandString("R"+i));
if (MyScene[i]==false)
{
  WinControl.Visible=false;
}else{
  WinControl.Visible=true;
        }

}

    WinMainMenu.GoSystemExclusive();
    Game.UnloadObject(WinMainMenu);
Logged

VonDoom

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 11
    • View Profile
Re: Hiding Buttons on a Window
« Reply #1 on: January 21, 2010, 04:23:32 AM »

Nevermind, solved. I was treating MyScene as an array when it's just a generic var, so it doesn't have any Length property.

Though now I wonder, is there any way to know the total number of items stored in a var without having it stored in another variable?
« Last Edit: January 21, 2010, 02:34:42 PM by VonDoom »
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Hiding Buttons on a Window
« Reply #2 on: January 21, 2010, 09:40:02 PM »

you can declare an array

Code: WME Script
  1. var MyScene = new Array();
  2. MyScene.Push("Hello","VonDoom");
  3. Game.Msg(MyScene.Length);
  4.  


Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet
 

Page created in 0.037 seconds with 24 queries.