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

[Help] capture "change:graphic:top" and/or "...:left" but execute function once.

Working on a script where I capture a change of left and or top, and they both call the same function.  However, I only want to execute the function once if both left and top change in the same frame. I can't think of a good strategy to abort or skip the second function call.
1439693600
Lithl
Pro
Sheet Author
API Scripter
on('change:graphic', function(obj, prev) { if (obj.get('top') === prev.top && obj.get('left') === prev.left) return; // Behavior if either top or left changes goes here });