[patch - MapTool b89] getTokenX-Y fix

Notes on testing the latest builds of MapTool

Moderators: dorpond, trevor, Azhrei

Post Reply
User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

[patch - MapTool b89] getTokenX-Y fix

Post by JamzTheMan »

This patch fixes the inconsistencies for the macro function getTokenX(1) and getTokenY(1).

The following note from the wiki would no longer be the case as there would be no exceptions and should be removed...

o The exception to this is when the token is 'Freesize' AND 'Snapped to Grid' AND NOT 'On Background Layer'. In that particular case the coordinates of the cell where the upper left corner of the FOOTPRINT (NOT image) of the token is at. The footprint can be recognized when you move the token on the Token layer, it will leave the white marker on the field. The footprint can be the same size as the image and it is if a preset size is used. With freesize however the size of the footprint is either the original size of the image OR when you have used a preset (e.g. 'large') it will have the size of the preset as footprint.
Attachments
Patch - getTokenX-Y fix.txt
(1.59 KiB) Downloaded 165 times
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
jfrazierjr
Deity
Posts: 5176
Joined: Tue Sep 11, 2007 7:31 pm

Re: [patch - MapTool b89] getTokenX-Y fix

Post by jfrazierjr »

JamzTheMan wrote:This patch fixes the inconsistencies for the macro function getTokenX(1) and getTokenY(1).

The following note from the wiki would no longer be the case as there would be no exceptions and should be removed...

o The exception to this is when the token is 'Freesize' AND 'Snapped to Grid' AND NOT 'On Background Layer'. In that particular case the coordinates of the cell where the upper left corner of the FOOTPRINT (NOT image) of the token is at. The footprint can be recognized when you move the token on the Token layer, it will leave the white marker on the field. The footprint can be the same size as the image and it is if a preset size is used. With freesize however the size of the footprint is either the original size of the image OR when you have used a preset (e.g. 'large') it will have the size of the preset as footprint.
Thanks Jamz. We need LOTS of people testing if lots of scenarios(hex, square, etc) with different size tokens, etc, so the more people who can please check this out
I save all my Campaign Files to DropBox. Not only can I access a campaign file from pretty much any OS that will run Maptool(Win,OSX, linux), but each file is versioned, so if something goes crazy wild, I can always roll back to a previous version of the same file.

Get your Dropbox 2GB via my referral link, and as a bonus, I get an extra 250 MB of space. Even if you don't don't use my link, I still enthusiastically recommend Dropbox..

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: [patch - MapTool b89] getTokenX-Y fix

Post by JamzTheMan »

Absolutely, as this does change base functionality in some cases.

Probably just as important would be people testing frameworks, especially anything that deals with token targeting, moving, etc. I'll be building a b89 fork for this soon for those who can't build their own.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: [patch - MapTool b89] getTokenX-Y fix

Post by Azhrei »

I'm going to apply this patch anyway. It'll be in SVN in a few minutes. If testing shows any problems, we'll fix them then. But trying to keep track of outstanding patches on the forum is kind of a pain. :?

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: [patch - MapTool b89] getTokenX-Y fix

Post by JamzTheMan »

OK, so Wolf found an "issue" with this over here: http://forums.rptools.net/viewtopic.php ... 28#p242528

So the question is, what do we want?

Option 1: Change MoveToken so it uses the same logic. Are there other related functions to fix?

Option 2: Put the code back and supply getTokenX(2) as an option.


Basically, we currently have two units we can return but three ways to do it.
1. As a cell, no issue there, always return footprint, equals true location of token for "gaming" purposes.
2. In pixels, based on footprint (same as 1, just different measurement. Can be derived using cell*gridSize)
3. In pixels, based on boundries, where you truly see the token on the map. This can be different than footprint due to freesize or layout change (on config tab).

Are there any other fringe cases to consider?
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [patch - MapTool b89] getTokenX-Y fix

Post by wolph42 »

you'll need to run the test campaign as well (if not already done so). Cause there's something wonky going on with the 'door' vs the 'tile' coords. The tile returns the boundary coords, the door returns... no clue. Whats up with that?

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: [patch - MapTool b89] getTokenX-Y fix

Post by JamzTheMan »

I have to look into it. I noticed even MT gets confused when you change the "layout" and you have to click the right spot to even select the token. In other words, it's checking a smaller footprint/boundary for selection than what it shows as the red/white boundary border.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
Azhrei
Site Admin
Posts: 12086
Joined: Mon Jun 12, 2006 1:20 pm
Location: Tampa, FL

Re: [patch - MapTool b89] getTokenX-Y fix

Post by Azhrei »

I'll keep an eye on this thread, but I'm going to let you guys figure out what it should do. I've not been involved with this enough to have an opinion right now.

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: [patch - MapTool b89] getTokenX-Y fix

Post by JamzTheMan »

So Wolf, I think we need to look at several other functions and see how they interact with x/y coords as well? I guess specifically, tokens that have their "layout" altered. I see the following:

copyToken(id, numCopies, fromMap, updates)
moveToken(x, y, units, id)
moveTokenFromMap(id, map, x, y, z)
moveTokenToMap(id, map, x, y, z)
canSeeToken(id|name, [id|name])
getDistanceToXY(x, y, units, source, metric)
getDistance(target, units, source, metric)
movedOverPoints()
GetTokens
Gettokennames
Movedovertoken

Miss anything?
Last edited by JamzTheMan on Fri Jun 14, 2013 12:21 pm, edited 1 time in total.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork


User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [patch - MapTool b89] getTokenX-Y fix

Post by wolph42 »

GetTokens
Gettokennames
Will edit when found more.

Movedovertoken

That's it. Went over all tokens and think those are them all.

User avatar
JamzTheMan
Great Wyrm
Posts: 1872
Joined: Mon May 10, 2010 12:59 pm
Location: Chicagoland
Contact:

Re: [patch - MapTool b89] getTokenX-Y fix

Post by JamzTheMan »

Added. Will create a campaign in our dropbox with sample macros if I get a chance.
-Jamz
____________________
Custom MapTool 1.4.x.x Fork: maptool.nerps.net
Custom TokenTool 2.0 Fork: tokentool.nerps.net
More information here: MapTool Nerps! Fork

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: [patch - MapTool b89] getTokenX-Y fix

Post by wolph42 »

attached is a full test campaign for all macros (also in dropbox). movedOverToken and movedOverPoints however act really strange and I suspect that they're broken.
This campaign file was created in nerps version j. (IRC)

to test: simply hit the buttons (and clean up afterwards for re-use) or move the 'drag' token.

and thus my suggestion is also clear: lets go for a full fix of all the macros as I simply know that if we don't we'll encounter an issue in it later down the road...
Attachments
Layout offset - test campaign.cmpgn
(83.93 KiB) Downloaded 155 times

Post Reply

Return to “Testing”