Self created tokens can't be set as Player Characters

Thoughts, Help, Feature Requests, Bug Reports, Developing code for...

Moderators: dorpond, trevor, Azhrei

Forum rules
PLEASE don't post images of your entire desktop, attach entire campaign files when only a single file is needed, or generally act in some other anti-social behavior. :)
Post Reply
Odonel
Cave Troll
Posts: 26
Joined: Wed Dec 08, 2010 5:50 am
Location: Germany

Self created tokens can't be set as Player Characters

Post by Odonel »

We have written a Java program that creates Maptool tokens with specific properties. It writes the content.xml and properties.xml and zips them together with the necessary assets.

This token can be imported in Maptool and used in the designated framework without problems. But if the token is set to "PC" (in the drop down menu next to the name field in the edit token window) an error windows opens. After the change to "PC" this error windows opens every time the cursor hovers over the token - even when the token is changed back to "NPC".

If a player drags a token onto the map it is automatically flagged as "PC" and the error pops up.

The error occurs always and not only sometimes. It occurs even outside of our framework in a blank campaign. We are using Maptool 1.3.b87 and various java versions (JRE 1.6.0_31-b05 and JRE 1.7.0-b147; on different computers of course ;>).

I have attached one of the tokens so you can see for yourself.
Error message
java.lang.ArrayIndexOutOfBoundsException: 9
at net.rptools.maptool.model.GUID.hashCode(GUID.java:140)
at java.util.HashMap.get(Unknown Source)
at net.rptools.maptool.model.Zone.getExposedAreaMetaData(Zone.java:1336)
at net.rptools.maptool.client.ui.zone.ZoneRenderer.renderVisionOverlay(ZoneRenderer.java:1375)
at net.rptools.maptool.client.ui.zone.ZoneRenderer.renderGMVisionOverlay(ZoneRenderer.java:1364)
at net.rptools.maptool.client.ui.zone.ZoneRenderer.renderZone(ZoneRenderer.java:1119)
at net.rptools.maptool.client.ui.zone.ZoneRenderer.paintComponent(ZoneRenderer.java:680)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintChildren(Unknown Source)
at javax.swing.JComponent.paint(Unknown Source)
at javax.swing.JComponent.paintToOffscreen(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paint(Unknown Source)
at javax.swing.RepaintManager.paint(Unknown Source)
at javax.swing.JComponent._paintImmediately(Unknown Source)
at javax.swing.JComponent.paintImmediately(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.paintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.prePaintDirtyRegions(Unknown Source)
at javax.swing.RepaintManager.access$700(Unknown Source)
at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$000(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.awt.EventQueue$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.AccessControlContext$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at net.rptools.maptool.client.swing.MapToolEventQueue.dispatchEvent(MapToolEventQueue.java:38)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
at javax.swing.RepaintManager$PaintManager.paintDoubleBuffered
Attachments
fengrim.rptok
(5.6 KiB) Downloaded 41 times

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Self created tokens can't be set as Player Characters

Post by aliasmask »

Perhaps the <baGUID>1342036258742</baGUID> is the wrong format. I changed the Ids to "CgAADK1LundsAAAAAgAADA==" and it doesn't have that problem.

btw, I couldn't do any changes to token in MT until corrected the id. For example, I couldn't give it vision or use copyToken on the token.

Odonel
Cave Troll
Posts: 26
Joined: Wed Dec 08, 2010 5:50 am
Location: Germany

Re: Self created tokens can't be set as Player Characters

Post by Odonel »

Wonderful! An easy solution :D I tried it with some tokens and they work just as they should.

So the format has to be 22 random digits followed by two equality signs?

Thank you very much.

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: Self created tokens can't be set as Player Characters

Post by aliasmask »

I think you can use the same id will all the tokens because I believe they are updated as needed. There does seem to be a specific pattern though and not completely random.

User avatar
Vhex
Giant
Posts: 162
Joined: Fri Sep 09, 2011 4:41 am
Location: Honolulu, HI

Re: Self created tokens can't be set as Player Characters

Post by Vhex »

Just a random guess, but it looks like a hash of some sort. One of the coders could probably tell you exactly.

Odonel
Cave Troll
Posts: 26
Joined: Wed Dec 08, 2010 5:50 am
Location: Germany

Re: Self created tokens can't be set as Player Characters

Post by Odonel »

Well I tried it with 1111111111111111111111== and it worked. Does not seem to be that specific :>

username
Dragon
Posts: 277
Joined: Sun Sep 04, 2011 7:01 am

Re: Self created tokens can't be set as Player Characters

Post by username »

See http://forums.rptools.net/viewtopic.php?f=3&t=19334 and take a look at http://en.wikipedia.org/wiki/Globally_unique_identifier. In particular see the part on text encoding.
BTW: The code refers to a library "withay-util.jar", which does this. I haven't been able to locate that piece, anybody have a clue?

Post Reply

Return to “MapTool”