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: buttons depending on variables ???  (Read 3146 times)

0 Members and 1 Guest are viewing this topic.

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
buttons depending on variables ???
« on: January 06, 2005, 05:00:01 PM »

Hello again

I want to script a map that can be placed over the existing scenes. So i scripted a window with some buttons for the various rooms.

The problem is - i want only the buttons of the rooms to be displayed the player already has visited ...

So i define a variable in every scene like map0, map1, map .....

can i check these variables in the window definition ???

if (map1 =1)
{
Button
}

hoping for a solution
stucki


Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: buttons depending on variables ???
« Reply #1 on: January 06, 2005, 06:02:53 PM »

Not in the definition file, but in the script attached to the window. Your definition file will contain all the buttons and the script will hide buttons representing the unvisited rooms before the window is displayed.

Something like:

var Button = this.GetControl("some_button_name");
if(map1!=1) Button.Visible = false;
...
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: buttons depending on variables ???
« Reply #2 on: January 07, 2005, 11:47:47 AM »

Thanks for the quick answer.

but as always there is another problem now.

i declare the global variable map1 in the base script.
    global map1;

and in the scene_init.script its set to the value 1
    map1 = 1;

now in my map script i check the var map1.
    var Button = this.GetControl("m1");
    if(map1!=0) Button.Visible = false;
    else Button.Visible = true;

but the button is always hidden even if the scene has already been visited.

any Idea ??

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: buttons depending on variables ???
« Reply #3 on: January 07, 2005, 11:59:38 AM »

I believe the condition shoud be

  if(map1!=1) Button.Visible = false;
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Stucki

  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Posts: 325
  • I'm a llama!
    • View Profile
    • Schach-Welten
Re: buttons depending on variables ???
« Reply #4 on: January 10, 2005, 04:12:31 PM »

thanks for helping
as always you are right an i am stupid

for the next problem to occur
 

Page created in 0.032 seconds with 20 queries.