hello -
i'm very new with ags, and i've run into a problem with what seems like a simple task.
after running any interaction i'd like the mouse cursor to automatically set itself to "walk." is there a way to do this without manually adding "mouse.Mode=eModeWalkTo;" at the end of every interaction in the game?
i tried editing the on_mouse_click function to change the cursor after processing the mouse click, but doing so cancels the intended interaction.
any suggestions?
At the top of the global script, add
bool after_int;
Inside on_mouse_click(), directly after "if (button==eMouseLeft) { ...", add
after_int = true;
Inside repeatedly_execute, add
if (after_int) {
after_int = false;
mouse.Mode = eModeWalkto;
}
Not tested.
If KhrisMUC's suggestion doesn't work, start a few loop timer in the on_mouse_click instead and check for it's expiration in rep_ex and set to walk mode after that. Might need some fine tuning still, tho.
You could just:
function on_mouse_click(MouseButton button) {
if (button == eMouseLeft) {
// blah
}
else {
// blah
}
mouse.Mode = eModeWalkto;
}
If you really need it reset after the interaction finishes, that becomes a bit more complicated...
I still didn't do any tests, so bear with me ;)
monkey, your suggestion looks like what I guess wynni2 has already tried. But ProcessClick(..., mouse.Mode); gets queued and it looks like it does use whatever the value of mouse.Mode is at the time it's executed, not called.
My method was e.g. used by Proskrito's MI template to reset the action bar to "Walk to"/normal text color after an interaction, so it should work.
i bore with you, and it works like a charm. thanks.
Even if the function is queued, the parameters should be passed by value not by reference, so it shouldn't make a difference...?
If it does I'd say it's a bug in AGS?
Based off my reading of the first post, I was imagining that wynni was changing the mouse mode at the top of the script, thinking the interaction had already been processed.
Quote from: wynni2 on Mon 16/06/2008 04:29:59i tried editing the on_mouse_click function to change the cursor **after** processing the mouse click, but doing so cancels the intended interaction.
I _still_ didn't test it though. ;)