Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: on Tue 29/04/2003 03:44:58

Title: Gui dissapear on mouse click.
Post by: on Tue 29/04/2003 03:44:58
I want to make a GUI disapear when the left mouse button is clicked I tried this code but i didnt work... can someone please help me!?

if (interface == 6) {
 if (IsButtonDown(RIGHT)==1)
   InterfaceOff(6);
 }
Title: Re:Gui dissapear on mouse click.
Post by: Erica McLane on Tue 29/04/2003 07:22:03
I`m not sure but I think AGS can`t handle interactions over a plain GUI. But this is my opinion.
Title: Re:Gui dissapear on mouse click.
Post by: Barcik on Tue 29/04/2003 13:57:10
int TButton;

function on_event (int event, int data) {
if (event==GUI_MDOWN){
   RefreshMouse();
   if (IsButtonDown(RIGHT)==1) TButton=2; else
   if (IsButtonDown(LEFT)==1) TButton=1;
  }

 if (event==GUI_MUP) {  //Called when the user release the mouse button
   if ((GetGUIAt(mouse.x,mouse.y)!=-1) && (TButton==1)
     GUIOff(GetGUIAt(mouse.x,mouse.y));
     
 }
Title: Re:Gui dissapear on mouse click.
Post by: on Tue 29/04/2003 16:14:41
it is not recognizing the on event function... what do i put down to set the function?
Title: Still need help.
Post by: on Tue 29/04/2003 16:22:34
let me rephrase that ... can i have an example of what i would put for int event and int data?   thanks
Title: This is my problem...
Post by: on Tue 29/04/2003 16:29:28
the actual error i recieve is (Nested function not suported) on the line in which the  function you gave me begins... please help = /
Title: Re:Gui dissapear on mouse click.
Post by: Barcik on Tue 29/04/2003 17:14:54
You forgot a } somewhere.
Title: Added } but no cigar
Post by: on Tue 29/04/2003 17:37:27
I coppied and pasted your code to my code under the right spot and noticed the function was missing a } I added it but i still get this error...

Error (Line 154): Nested functions are not supported... thank for your help so far...
Title: Fixed that but new PRoblem
Post by: on Tue 29/04/2003 17:45:17
Ok apparently i had the Function in the wrong spot... I feel dumb now .  But when i put it in the correct spot it reaches this line...
   if ((GetGUIAt(mouse.x,mouse.y)!=-1) && (TButton==1){
and gives me this error...
  Error (line 41): end of input reached in middle of expression.  :-\
why cant this nightmare end  ???
Title: Re:Gui dissapear on mouse click.
Post by: Barcik on Tue 29/04/2003 17:47:45
There needs to be another ) there.
Title: last problem hopefully
Post by: on Tue 29/04/2003 18:27:35
I cant believe i didnt see that i must be blind... ok but now on the same line it gives me a new error...
Error (line 41): PE04: parse error at '&&'

help what is wrong with this and sign?
Title: Nevermind i fixed it
Post by: on Tue 29/04/2003 18:30:42
I fixed it... maybe i should try to fix ti b4 asking for help next time  :-X
Title: Got a Final Stumper for you!
Post by: on Tue 29/04/2003 19:00:21
ok I used the code and it does work... I altered it so it only closes GUI 6 on click but when i open GUI 6, GUI 2 is Closed... when i close GUI 6 using this code here...
 int TButton;

function on_event (int event, int data) {
 if (event==GUI_MDOWN){
   RefreshMouse();
   if (IsButtonDown(RIGHT)==1) TButton=2; else
   if (IsButtonDown(LEFT)==1) TButton=1;
 }

 if ((event==GUI_MUP) && (data==6)) {  //Called when the user release the mouse button
   if (((GetGUIAt(mouse.x,mouse.y)!=-1)) && (TButton==1))
     GUIOff(GetGUIAt(mouse.x,mouse.y));  
   }
 
}


how can I get GUI 2 to open again... thanks you've been great help! hope u can help me again!
Title: Re:Gui dissapear on mouse click.
Post by: Barcik on Tue 29/04/2003 19:06:16
It will be very helpful if you could supply a short description of GUI 2 and 6.
Title: Re:Gui dissapear on mouse click.
Post by: on Tue 29/04/2003 20:58:31
GUI 6 is status screen that just  shows a bunch of info that you cant interact with and disapears when clicked away.  Since you use it so much it would get annoying to have an actual button to press to get out of it.  GUI 2 on the other hand is the usual Sierra pull down options menu from the top of the screen. thanks
Title: Re:Gui dissapear on mouse click.
Post by: Barcik on Wed 30/04/2003 09:56:58
function on_event (int event, int data) {
 if (event==GUI_MDOWN){
   RefreshMouse();
   if (IsButtonDown(RIGHT)==1) TButton=2; else
   if (IsButtonDown(LEFT)==1) TButton=1;
 }

 if ((event==GUI_MUP) && (data==6)) {  //Called when the user release the mouse button
   if (((GetGUIAt(mouse.x,mouse.y)!=-1)) && (TButton==1)) {
     GUIOff(6);  
     GUIOn(2);
  }}
 
}