RPTools.net

Discussion and Support

Skip to content

It is currently Fri Jul 28, 2017 1:33 am 




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. :)



Reply to topic  [ 7 posts ] 

Previous topic | Next topic 

  Print view

Author Message
 Offline
Dragon
 
Joined: Tue Apr 20, 2010 7:22 pm
Posts: 574
 Post subject: Tokens ID losing leading zeros?
PostPosted: Sat Apr 22, 2017 4:54 pm 
In 1.4.0.5, I'm getting tokens that sometimes throw the following error when a particular macro is called.

Error executing "getTokens": the token name or id "343778971601000000000000" is unknown.

Here is the code.

Code:
[broadcast(getSelected())]
[h : selectedId = getSelected()]
[broadcast(selectedId)]
[h : MStance = 0]
[h : cond = ""]
[h, if(isPC()) : cond = '{ range: {upto:1, distancePerCell:0, metric:"ONE_TWO_ONE", token: ' + selectedId + '}, npc:1,visible:1 }' ; cond = '{ range: {upto:1, distancePerCell:0, metric:"ONE_TWO_ONE", token: ' + selectedId + '}, pc:1,visible:1 }']
[broadcast(cond)]
[h: ids = getTokens("json", cond)]


On this "bad" token, here are my broadcasts...

00000000343778971601000000000000
343778971601000000000000
{"range":{"upto":1,"distancePerCell":0,"metric":"ONE_TWO_ONE","token":343778971601000000000000},"npc":1,"visible":1}
Error executing "getTokens": the token name or id "343778971601000000000000" is unknown.

Notice that when it first broadcasts "getSelected()", the ID has leading zeros, like most tokens? But once its assigned to the selectedId variable, those leading zeros disappear (second broadcast) and then when that variable is using in setting the conditions for the getTokens call, it fails because its not a valid token.

Here is the out put for a token that's actually working.

00000000343778971C01000000000000
00000000343778971C01000000000000
{"range":{"upto":1,"distancePerCell":0,"metric":"ONE_TWO_ONE","token":"00000000343778971C01000000000000"},"npc":1,"visible":1}

And then the getTokens call works fine. Notice that the leading zeros didn't disappear between the two broadcasts?

Now for the really goofy thing. If I copy the bad token and paste, guess what? It now works FINE.

Reason i bring this up? This happened twice last during our game. Token was working fine, then suddenly started throwing this error. Copied the token, pasted it, deleted the old one and then it started working again.

So there's a workaround for this problem but in the past year of using 1.3.91, I never once saw this problem. Now on the first two sessions of using 1.4.0.5, I've seen it a couple of times. Any ideas?


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9269
Location: Netherlands
 Post subject: Re: Tokens ID losing leading zeros?
PostPosted: Sat Apr 22, 2017 5:33 pm 
this is an ancient issue which i REALLY would like to see resolved and the devs are working on a solution in the next release. in the mean time you can use the boT --> diangose button to scan your campaign file for 'issue' tokens.

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
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


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Tue Nov 10, 2009 6:11 pm
Posts: 7751
Location: Bay Area
 Post subject: Re: Tokens ID losing leading zeros?
PostPosted: Sat Apr 22, 2017 6:11 pm 
Yeah, big pain in the behind.

_________________
Downloads:


Top
 Profile  
 
 Offline
Dragon
 
Joined: Tue Apr 20, 2010 7:22 pm
Posts: 574
 Post subject: Re: Tokens ID losing leading zeros?
PostPosted: Sat Apr 22, 2017 6:19 pm 
Wow, really? Like I said, never ever say this in .89, not after running that for 2 years. Then in first 2 days, this has bit me on the butt multiple times in 1.4.0.5

But, if its a known issue, okay, I can work around that with the copy/paste solution.


Top
 Profile  
 
 Offline
Giant
 
Joined: Mon Aug 03, 2015 5:30 pm
Posts: 173
 Post subject: Re: Tokens ID losing leading zeros?
PostPosted: Sat Apr 22, 2017 10:00 pm 
Edit: The previous, if you read it, was incomplete.

What's happening is that sometimes, the randomly generated ID, which is supposed to be alpha-numberic, randomly has no letter in it (as your example). When this happens, it gets treated as a number instead, and numbers get the leading zeroes dropped. So use an if statement to determine if it is a number, and if so, use strformat to force it to be a string, with leading zeroes, 32 characters long. If not, use as is.

So try this instead of the selectedId variable by itself:

Code:
if(isNumber(id)): (strformat("%032d", selectedId));(selectedId)


Top
 Profile  
 
User avatar  Offline
Deity
 
Joined: Fri Mar 20, 2009 4:40 am
Posts: 9269
Location: Netherlands
 Post subject: Re: Tokens ID losing leading zeros?
PostPosted: Sun Apr 23, 2017 4:51 am 
you can do that trick but there are sooo many variables where that token id is used that you keep getting bit and its a bloody pain to debug. hence its better to remove the tokens from your campaign entirely (either by copy paste delete or using the bot).

_________________
GETTING STARTED WITH MAPTOOLS - TUTORIALS, DOCS, VIDEOS, TOOLS, ETC

My stuff
Excel Tools: Table and Light editors
MT Tools: Bag of Tricks: Tools for Maptool, Dungeon Builder I, Dungeon Builder II,onMouseOverEvent and
DPI.
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


Top
 Profile  
 
 Offline
Dragon
 
Joined: Tue Apr 20, 2010 7:22 pm
Posts: 574
 Post subject: Re: Tokens ID losing leading zeros?
PostPosted: Sun Apr 23, 2017 10:24 am 
appreciate the clarification guys, heh, at least I know its not something I messed up!!!


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 7 posts ] 

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:

Who is online

In total there are 6 users online :: 0 registered, 0 hidden and 6 guests (based on users active over the past 5 minutes)
Most users ever online was 243 on Sun Nov 04, 2012 6:14 am

Users browsing this forum: No registered users and 6 guests





Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group

Style based on Andreas08 by Andreas Viklund

Style by Elizabeth Shulman