v2.7 mouse.x

Started by Wretched, Tue 03/05/2005 17:32:04

Previous topic - Next topic

Wretched

mouse.x is changing through the script. I think this function is not working properly. It says in the help that it should be the value when the script is started, however it seems to be changing through the script. Has this changed or is the help file incorrect?

strazer

Hm, I think while the script runs the mouse coordinates should not be updated unless you let the game advance some game loops by using the Wait function.

Can you please post an example script?

Wretched

Sufficient to say I have a MoveCharacterBlocking() function and a DisplaySpeech() function before I test mouse.x, but I'm sure this is behaving differently to how it did in v2.6. I've tested both builds and the mouse.x is changing in 2.7.

strazer

MoveCharacterBlocking(EGO, 100, 150) is a short version of

Code: ags

MoveCharacter(EGO, 100, 150);
while(character[EGO].walking) Wait(1);


thus because of the Wait the game runs in the background and the mouse coordinates are updated.

Quote
I've tested both builds and the mouse.x is changing in 2.7.

As it should be.

Btw, unlike AGS v2.62, in AGS v2.7 the mouse coordinates are updated before each call to repeatedly_execute_always:

Quote from: Pumaman on Sat 13/11/2004 21:02:00
* The mouse.x/y variables are now updated for rep_exec_always.

Wretched

Ok that's fine it was not the neatest bit of code and easily changed. Maybe you could make this a bit more clear in the help file which specifically states;

Quotemouse.x - Mouse X co-ordinate when the script was started (320-res).

Pumaman

Ah, because 2.7 now updates it before rep_exec_always calls, this effectively means that if you have any Wait() or blocking calls in your script, it will now get updated where it didn't before. I'll re-word the manual accordingly.

SMF spam blocked by CleanTalk