Trouble in the land of GUIs

Started by , Sun 29/02/2004 00:19:52

Previous topic - Next topic

Brushguy

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!

RickJ

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).


Brushguy

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.

Alynn

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

Brushguy

It says "GetGlobalVariable" is an undefined command.

Alynn

My fault it's actually GetGlobalInt....

I must have been thinking of something else....

Brushguy

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?

OverWind

Every image has a number, look it up in the sprite manager, and use that number as parameter for the function :)
Sleep is for losers, baggy eyes are for winners!

Brushguy

Alright.  If I wanted to change GUI button 11 to picture 4, what would I put in the script?

Alynn

Ok really maybe you should RTFM...

Brushguy

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?

SSH

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?
12

Brushguy

:-\  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.   :'(

Scummbuddy

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.
- Oh great, I'm stuck in colonial times, tentacles are taking over the world, and now the toilets backing up.
- No, I mean it's really STUCK. Like adventure-game stuck.
-Hoagie from DOTT

Alynn

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.

SMF spam blocked by CleanTalk