Tracking walk destination - DestinationY issue

Started by Honza, Fri 03/05/2019 07:11:28

Previous topic - Next topic

Honza

I need to keep track of the coordinates the player is walking to while they are walking. The DestinationX & DestinationY properties seem to be made for this, but while DestinationX works fine, DestinationY behaves weirdly. It seems to return the amount of pixels above 256, 512, 768 and 1024 if the actual destination y surpasses those values. Eg. if the player is walking to y 300, player.DestinationY would be "44", y 550 returns "38", 1000 is "232", etc. Only once the player stops, the DestinationY value changes to the player's current y value.

Sorry if I'm missing something obvious, tried to google it and search the forums but couldn't find any explanation. I'm using AGS Build 3.4.1.12


Crimson Wizard

#1
Hmm, yes, there seem to be some kind of a bug there, it does not show correct value if coordinate is >255 (which hints that it has something to do with how much bytes is read).

PS. Looks like this function never worked correctly since it was added in 2014. Either it was not used much, or used only in non-scrolling low-res rooms, but nobody noticed this earlier.

Honza

#2
Thanks for checking! Sucks, seemed like exactly the function I need. Any idea for another (relatively) simple way to track walking destination? I thought I could use the mouse click coordinates instead, but I want to take advantage of the built-in system which finds the nearest reachable spot if you click outside a walking area, so it doesn't work for me. :(

EDIT: Thought of a clunky work-around: I send an invisible, super-fast dummy character to the mouse coordinates, then use its coordinates as destination ones. A cleaner solution would still be much appreciated though :).

Crimson Wizard

#3
Right, I fixed this for ags 3.5.0, it's already in beta stage so I'd rather not make patches for older versions unless there's no workaround.

Honza

Wow, that was fast! The workaround seems to be working fine so far, so no worries.

Crimson Wizard

#5
Quote from: Honza on Fri 03/05/2019 19:34:06
Wow, that was fast!

This is the fix :)
https://github.com/adventuregamestudio/ags/commit/232e58885bb8579f50258045fd0e34c027d25c60
it was cutting 1 upper byte from the return value.
Although now the limit is 32767, but I hope it will be enough for a while...

SMF spam blocked by CleanTalk