Bug in Beta 2 or scripting problem?

Started by Fekix, Wed 10/03/2004 17:21:34

Previous topic - Next topic

Fekix

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?
Currently working on: My Little Real Life Adventure

Pumaman

What sort of hang-up is it? Can you press Alt+X to exit when it hangs up?

Fekix

#2
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
Currently working on: My Little Real Life Adventure

SSH

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?

12

Fekix

the gui is pop-up modal. but no transparency and no background image.
Currently working on: My Little Real Life Adventure

Pumaman

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.

Fekix

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
Currently working on: My Little Real Life Adventure

SSH

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?

12

Fekix

#8
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)
Currently working on: My Little Real Life Adventure

Pumaman

Could you post your  on_event  function in case there's a problem with it that's causing this.

Fekix

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.
Currently working on: My Little Real Life Adventure

Pumaman

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.

Fekix

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.
Currently working on: My Little Real Life Adventure

Pumaman

Ah of course, that'd do it. Glad it's all solved :)

SMF spam blocked by CleanTalk