Gui dissapear on mouse click.

Started by , Tue 29/04/2003 03:44:58

Previous topic - Next topic

Mcfarser

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);
 }

Erica McLane

I`m not sure but I think AGS can`t handle interactions over a plain GUI. But this is my opinion.

Barcik

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));
     
 }
Currently Working On: Monkey Island 1.5

Mcfarser

it is not recognizing the on event function... what do i put down to set the function?

Mcfarser

let me rephrase that ... can i have an example of what i would put for int event and int data?   thanks

Mcfarser

the actual error i recieve is (Nested function not suported) on the line in which the  function you gave me begins... please help = /

Barcik

Currently Working On: Monkey Island 1.5

Mcfarser

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

Mcfarser

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

Barcik

There needs to be another ) there.
Currently Working On: Monkey Island 1.5

Mcfarser

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?

Mcfarser

I fixed it... maybe i should try to fix ti b4 asking for help next time  :-X

MCFARSER

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!

Barcik

It will be very helpful if you could supply a short description of GUI 2 and 6.
Currently Working On: Monkey Island 1.5

MCFARSER

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

Barcik

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);
  }}
 
}
Currently Working On: Monkey Island 1.5

SMF spam blocked by CleanTalk