Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Fekix on Wed 10/03/2004 17:21:34

Title: Bug in Beta 2 or scripting problem?
Post by: Fekix on Wed 10/03/2004 17:21:34
I've downloaded Beta 2 and i've noticed that sometime the game hang up when clicking on a gui (not on a button or label or something like this, i mean clicking in a blank gui area). I opened the console and noticed that the last commands before hanging up are:

Mouseclick over GUI X
Character X start moving (x,y)

I don't know if this error appears before beta 2 or if there is a problem with my script. Can someone try by clicking several times in a gui in his game?
Title: Re:Bug in Beta 2 or scripting problem?
Post by: Pumaman on Wed 10/03/2004 20:41:06
What sort of hang-up is it? Can you press Alt+X to exit when it hangs up?
Title: Re:Bug in Beta 2 or scripting problem?
Post by: Fekix on Wed 10/03/2004 20:54:59
Alt-X works! It shows me that there is a problem in line 63 in my room script. i looked it up and its a while loop with wait command till the character move to the hotspot. Somehow AGS noticed the left click ON the GUI as a click on my hotspot which force my character to move. But the GUI is over the hotspot so i don't know why this happens. But the character will not move because game is paused because of the GUI is on and this means the game will stay in the while loop
Title: Re:Bug in Beta 2 or scripting problem?
Post by: SSH on Thu 11/03/2004 16:07:55
So, is the GUI pop-up modal? Is it transparent? Does it have an image in the background? Does the image have any transparent bits in it?

maybe it's related to the "* Fixed "Mouse moves over hotspot" running even if the mouse was actually moving over a GUI on top of the hotspot." bug that CJ fixed in beta 1?

Title: Re:Bug in Beta 2 or scripting problem?
Post by: Fekix on Thu 11/03/2004 16:10:07
the gui is pop-up modal. but no transparency and no background image.
Title: Re:Bug in Beta 2 or scripting problem?
Post by: Pumaman on Thu 11/03/2004 21:21:03
Try adding a line like this to the start of your  on_mouse_click function in the global script:

if ((IsInterfaceEnabled() == 0) || (IsGamePaused() == 1)) return;

that should make it ignore mouse clicks while the GUI is up.
Title: Re:Bug in Beta 2 or scripting problem?
Post by: Fekix on Fri 12/03/2004 19:31:26
still the same :(

here's my on_mouse_click function:

#sectionstart on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE
function on_mouse_click(int button) {
 if (IsInterfaceEnabled() == 0 || IsGamePaused() == 1) return;
 else if (button==LEFT) {
   if (itemon == 1) {
     ProcessClick(mouse.x, mouse.y, 4);
     itemon = 0;
     SetLabelText(4, 0, "@OVERHOTSPOT@");
     }
   else ProcessClick(mouse.x, mouse.y, 0);
 }
 else if (button==RIGHT) {
   if (itemon == 1) {
     itemon = 0;
     SetLabelText(4, 0, "@OVERHOTSPOT@");
     }
   else set_actionmenu();
   }
 
}
#sectionend on_mouse_click  // DO NOT EDIT OR REMOVE THIS LINE
Title: Re:Bug in Beta 2 or scripting problem?
Post by: SSH on Fri 12/03/2004 19:45:40
Have you put anything in on_event? Or do you check for mouse clicks in your repeatedly_execute?

Can you put something in your repeatedly_exectute to change a GUI label with the value of GetLocationType(mouse.x, mouse.y) and then tell us what it says just before you click?

Title: Re:Bug in Beta 2 or scripting problem?
Post by: Fekix on Fri 12/03/2004 20:36:47
Yes, my on_event function handles mouseclicks but only for GUI 0 and the problem appears with other guis.
My Label still says its a GUI or nothing (0) before i clicked :(

edit: it even hang up if the game is not in the while loop. it just show a speech and hang up (alt-x still works)
Title: Re:Bug in Beta 2 or scripting problem?
Post by: Pumaman on Sat 13/03/2004 18:14:53
Could you post your  on_event  function in case there's a problem with it that's causing this.
Title: Re:Bug in Beta 2 or scripting problem?
Post by: Fekix on Sat 13/03/2004 23:38:01
function on_event(int event, int data) {
 if (event == GUI_MDOWN && data == 0 && GetInvAt(mouse.x, mouse.y) > -1) {
   if (IsButtonDown(RIGHT) == 1) {
     itemclick=GetInvAt(mouse.x, mouse.y);
     GetInvName(GetInvAt(mouse.x, mouse.y), displayhotspotname);
     set_actionmenu();
     }
   else if (IsButtonDown(LEFT) == 1) {
     SetGlobalInt(1, GetInvAt(mouse.x, mouse.y));
     GetInvName(GetInvAt(mouse.x, mouse.y), displayhotspotname);
     StrFormat(displayitem, "Use %s on", displayhotspotname);
     SetLabelText(4, 0, displayitem);
     itemon=1;
     }
 }
}

if you like to, i can send you my whole game. If you'd like to, send me a pm.
Title: Re:Bug in Beta 2 or scripting problem?
Post by: Pumaman on Sun 14/03/2004 14:37:09
Hmm it might be best if you could upload the game, it's hard to know what the problem might be. It all looks ok at first glance.
Title: Re:Bug in Beta 2 or scripting problem?
Post by: Fekix on Mon 15/03/2004 13:00:02
I solved my problem. It was a problem in my script. The problem causing that the interaction was executet for my door script when i clicked on the gui was that i have a repeatedly_esxecuted command asking for GetHotspotAt(mouse.x, mouse.y). This command even gives the Hotspot number if the mouse is over a gui which is over the hotspot.
Title: Re:Bug in Beta 2 or scripting problem?
Post by: Pumaman on Mon 15/03/2004 20:23:07
Ah of course, that'd do it. Glad it's all solved :)