Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Sun 29/02/2004 00:19:52

Title: Trouble in the land of GUIs
Post by: on Sun 29/02/2004 00:19:52
How do I disable and enable GUI buttons?  The reason for doing so is that there are five GUI buttons, one for each character.  Click on it and you switch to that character.  But at the beginning of the game I only want 2 controllable characters, with more coming later.  Help me out!
Title: Re:Trouble in the land of GUIs
Post by: RickJ on Sun 29/02/2004 01:09:59
Use SetButtonPic() to change the buttons appearance.  Then put an "if" statement in the gloabl script section of the code that handles the functionality for that button(s).

Title: Re:Trouble in the land of GUIs
Post by: on Tue 02/03/2004 13:53:59
Okay, suppose I wanted to wait until Global Value 5 equals 0, I would have buttons 1 and 4 on, but when GV5 = 1, I would have buttons 3 and 5 on, but turn 1 and 4 off.  GV5 = 2, I would turn all buttons off and turn button 2 on.  GV5 = 3, turn on 1,2, and 4 on but leave 3 and 5 off.  Then if GV5 = 4, turn all the buttons on.  Could somebody give the script to put in the global script?

I am a total n00b at scripting.  Every time I try something I get a "parse error" message.
Title: Re:Trouble in the land of GUIs
Post by: Alynn on Tue 02/03/2004 16:10:01
if (GetGlobalVariable(5)==0){
 //code for buttons 1-4)
}
else if (GetGlobalVariable(5)==1){
 //code to turn off buttons not needed and turn on the
 //needed ones
}
//so on and so forth until you have everything you need
Title: Re:Trouble in the land of GUIs
Post by: on Sat 13/03/2004 18:32:32
It says "GetGlobalVariable" is an undefined command.
Title: Re:Trouble in the land of GUIs
Post by: Alynn on Sat 13/03/2004 19:01:09
My fault it's actually GetGlobalInt....

I must have been thinking of something else....
Title: Re:Trouble in the land of GUIs
Post by: on Sun 14/03/2004 19:38:24
One last question:  What parameters do I use for the command (SetButtonPic) ?  

In other words, how do I tell it which button to change and which picture to change it to?
Title: Re:Trouble in the land of GUIs
Post by: OverWind on Mon 15/03/2004 03:01:37
Every image has a number, look it up in the sprite manager, and use that number as parameter for the function :)
Title: Re:Trouble in the land of GUIs
Post by: on Mon 15/03/2004 18:54:32
Alright.  If I wanted to change GUI button 11 to picture 4, what would I put in the script?
Title: Re:Trouble in the land of GUIs
Post by: Alynn on Mon 15/03/2004 19:21:14
Ok really maybe you should RTFM...
Title: Re:Trouble in the land of GUIs
Post by: on Tue 16/03/2004 15:05:44
Look, I'm sorry I'm annoying you guys so much, and that I'm a total n00b at scripting.  I promise that this is the last question and then I forget about the topic:  if I wanted to change GUI button 11 to picture 4, what would script line would I put in the script?
Title: Re:Trouble in the land of GUIs
Post by: SSH on Tue 16/03/2004 15:21:01
Let me tell you how to find out the answer to your question.

Load up AGS Edit
Press F1 to get the help file to come up
Go to the "search" tab
Enter "GUI button" in the search field and hit "List topics"
Go to the topic "GUI functions"
Now, click on "SetButtonPic"
Now the help file will give you lots of information about changing the button. You probably want:

SetButtonPic(YOURGUINAMEGOESHERE, 11, 1, 4);

That's what "RTFM" means. Read The Friendly Manual. If you can't even be bothered to look up the manual for one script command it doesn't bode well for the quality of your game. Why should we care about it when you don't yourself?
Title: Re:Trouble in the land of GUIs
Post by: on Wed 17/03/2004 16:48:27
:-\  I'm sorry.  I didn't know what RTFM meant, because I'm really bad at acronyms.  I'm also sorry I've been pestering you guys so much.  If you had just spelled out "Read the Friendly Manual," I would've done it.

If I'm just going to be greeted with sarcasm when I have to ask questions on stuff that I'm clueless about, I think I can figure out further AGS problems on my own.  I can understand you guys getting fed up with my constant question-asking, so I'll leave now.   :'(
Title: Re:Trouble in the land of GUIs
Post by: Scummbuddy on Wed 17/03/2004 18:54:09
Look, we're sorry if you took it harshly, we just want everyone to be more self-able to fix problems out and code for themselves. We do love to help everyone, but there is a better satisfaction once you've done it yourself. We really don't want you to leave, nor did anyone here think that you or any other recently new posters have been posting too much. Its okay to ask, cause thats how you learn.  We would ask that you check around first, and then go ahead and ask you questions if they haven't been answered.
Please stick around.
Title: Re:Trouble in the land of GUIs
Post by: Alynn on Thu 18/03/2004 06:15:13
Look, sorry I came off that way, but pretty much any scripting problem you have, as long as it's "what is the function for", "what parameters does it take" it will more than likely be in the manual.

I just get irritated with people who ask questions, without looking for themselves. To me, it seems that I am doing the game for you, you are just dictating it into the engine.

I had no problem with your first question, but when you started asking how to do things that are clearly in the manual, it looked to me that you basicly said, "Hey I'm too lazy to find out on my own, so I want one of you to do it for me."

It's probably more me than you, I have been moderating a board (obviously not this one) with n00bs that would rather you tell them step by step how to do everything than try to figure out a single thing on thier own. Like reading the manual or, even just trying to figure it out on their own....

Sorry for the long explination, just wanted you to see where I was coming from.