script interferes with mouse clicks?

Started by , Sun 06/11/2005 00:49:40

Previous topic - Next topic

BlankMan

I have a line of script in the repeatedly execute section that places a GUI near the mouse cursor. The line is this:

gCursormode.SetPosition(mouse.x-60, mouse.y);


It does it's job -- it causes the GUI to follow the mouse around.  Unfortunately, it also seems to interfere with the processing of mouse clicks, but not all the time.  For example, if cursor mode is set to walk, and I left-click, most of the time the player walks. But sometimes he won't. And he won't walk until I've moved the cursor a few times and have left-clicked like crazy. The line of script also seems to interfere with right clicking.

If I take the line of script out, everything seems to be fine. 

I had an equivalent script in the old AGS scripting language in a different game that worked fine.

Does anyone understand this?

strazer

Since the GUI is directly under the mouse cursor, the GUI is clicked instead of the room background beneath.

Either position the GUI a bit away from the mouse cursor ("mouse.y + 2" for example) or simply uncheck the GUI's "Clickable" checkbox in the editor.

BlankMan

Thanks. That's exactly it.

Just out of curiousity, since the GUI has a fixed relationship to the mouse cursor, why was it sometimes clicking on the background and sometimes on the GUI?

strazer

Your GUI's position is updated by the code in the repeatedly_execute function. So ferociously moving the mouse and clicking probably worked a few times because the GUI's position hadn't been updated yet. Also, rep_ex doesn't run when the game is blocked (repeatedly_execute_always does), so maybe it has something to do with that.
Anyway, glad it works now.

SMF spam blocked by CleanTalk