Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

change:graphic:lastmove isn't triggered after setting top/left properties?

Hey everyone, I've a problem with a script I'm implementing for my game. It tracks movement of tokens and I want it to roll back last move if it went too far (not enough move available). The problem is, that for some bizarre reason after I set top/left of an object the next movement doesn't trigger change:graphic:lastmove event. Why could that be?&nbsp; Here's the script itself&nbsp;&nbsp;<a href="https://pastebin.com/ZeHpp5yA" rel="nofollow">https://pastebin.com/ZeHpp5yA</a>
1566857854
The Aaron
Roll20 Production Team
API Scripter
It's because the lastmove is not changing.&nbsp;&nbsp; Here's what changes on the initial move which is being reverted: The movement is then reverted to place the token back to (1050,210), so the subsequent move only changes the left and top: If you reset the lastmove: if(obj.get("bar2_value") &lt; traversedDistance) { sendChat(obj.get("name"), "Too far"); obj.set({ left: x1, top: y1, lastmove: prev.lastmove }); } else { obj.set("bar2_value", obj.get("bar2_value") - traversedDistance); } You will again get the event on a change to lastmove.
Great thanks once again, it works :)&nbsp;