Well, I thought I could find the center of my token (which is 75 wide by 150 tall) by simply doing...
[h: centerX = getTokenX(1,selectedToken)+(37.5)]
[h: centerY = getTokenY(1,selectedToken)+(75)]
However, if I'm finding that, based on the rotation of the token, this doesn't return the same coordinates each time!
Is there an easy way to determine this, without busting out the sin and cos functions?
Determining the center of a token
Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice
Re: Determining the center of a token
Ignore this...something else was throwing my math off...long day.
Re: Determining the center of a token
suggestion:
Code: Select all
[h,token(selectedToken): centerX = (getTokenX(1)+getTokenWidth())/2]
[h,token(selectedToken): centerY = (getTokenY(1)+getTokenHeight())/2]
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
Re: Determining the center of a token
I actually call the getWidth/Height earlier in the macro, my sample was just to simplify.
Is there some performance gain from the syntax you use?
Is there some performance gain from the syntax you use?
Re: Determining the center of a token
No its just more generic
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS
DISCORD (the new MT forum!)
My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent.
Frameworks: Dark Heresy, Rogue Trader, Deathwatch, Black Crusade, Only War, SET Card Game, RoboRally
Wiki: Debugging Tutorial, Speed Up Your Macros, Working With Two CODE Levels, Shortcut Keys, Avoiding Stack Overflow, READ THIS