CopyToken broken?

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

venger
Giant
Posts: 144
Joined: Tue Apr 17, 2007 11:37 am

CopyToken broken?

Post by venger »

Hi
I'm running MT 1.5.12
I last did some coding around december or so. And I seem to remember copytoken macro I made worked but I had a lot going on and its fuzzy and dunno if I just visualized it working
anyway

I'm getting this error
java.lang.NullPointerException error executing expression copyToken(EncounterShip, 1, "z.Tokens.Encounters")

The map I'm working with is named properly as the variable and I have a properly named set of tokens on that map.
I've been over the code but Im still learning. Does the below code look ok? Why do I get the error?

Code: Select all

[h:status=input(  
"EncounterShip|Armada, Beholder.EyeSpike, Beholder.Tyrant, Dragonfly, DragonShip, Drakkar, Flitter, Gadabout, Galleon, GrandBombard, Hammership, Hummingbird, Illithid.Nautiloid, Man-o-War, Mosquito, Neogi.DeathSpider, Neogi.MindSpider, SkeletonShip, Squidship, Tradesman, Wasp|SELECT: Which Ship?|RADIO|SELECT=0 VALUE=STRING"
)]

[h: copyToken(EncounterShip, 1, "z.Tokens.Encounters")]

User avatar
aliasmask
Deity
Posts: 8667
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: CopyToken broken?

Post by aliasmask »

Nothing stands out with the syntax. Do you get the error with any selection? I know MT can be weird with the . in names sometimes depending on context. I say reduce your list to 1 item, output the result from input, change the map name of token and see if something works, then go backwards from there to see where the failure is.

Mortuis
Cave Troll
Posts: 57
Joined: Mon Feb 01, 2010 7:17 pm

Re: CopyToken broken?

Post by Mortuis »

I'm having the same problem. I'm building a new macro, so far it's just:

Code: Select all

[h: copyToken("Magic Circle", 1, "Macro Map")]
I've quadruple checked the spelling of the token I'm trying to copy and the name of the map. When I click the macro I get:

java.lang.NullPointerException error executing expression copyToken("Magic Circle", 1, "Macro Map").

User avatar
aliasmask
Deity
Posts: 8667
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: CopyToken broken?

Post by aliasmask »

My other thought would be permissions. I'm going to set up a test with 1.5.13 first.

User avatar
aliasmask
Deity
Posts: 8667
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: CopyToken broken?

Post by aliasmask »

Okay, I'm getting the same error in 1.5.13. It seems there's a bug with the conditions option. If you put "{}" for the last parameter it should work fine. I'll log the bug for the next fix.

User avatar
aliasmask
Deity
Posts: 8667
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: CopyToken broken?

Post by aliasmask »

Apparently, this is a known issue: https://github.com/RPTools/maptool/issues/1300

Mortuis
Cave Troll
Posts: 57
Joined: Mon Feb 01, 2010 7:17 pm

Re: CopyToken broken?

Post by Mortuis »

Thanks aliasmask! Adding that as the fourth parameter fixed it for me!

venger
Giant
Posts: 144
Joined: Tue Apr 17, 2007 11:37 am

Re: CopyToken broken?

Post by venger »

Please advise, following the github comments,it looks like it may be some time before bug's squashed so I want to do the work around as mentioned by adding the {}
so,fourth parameter?

I'm not on step with all of the syntax , where does {} go in my code?
Tried it a few places I thought it might go to no avail, but better I ask here and learn the lesson of... why it goes where it does?
A Short answer is ok
Thanks

User avatar
Full Bleed
Demigod
Posts: 4558
Joined: Sun Feb 25, 2007 11:53 am
Location: MD
Contact:

Re: CopyToken broken?

Post by Full Bleed »

venger wrote:
Mon Mar 02, 2020 3:51 pm
I'm not on step with all of the syntax , where does {} go in my code?
Tried it a few places I thought it might go to no avail, but better I ask here and learn the lesson of... why it goes where it does?
A Short answer is ok
Haven't tested, but presumably:

Code: Select all

[h: copyToken(EncounterShip, 1, "z.Tokens.Encounters", {})]
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

venger
Giant
Posts: 144
Joined: Tue Apr 17, 2007 11:37 am

Re: CopyToken broken?

Post by venger »

I tried the above code Fullbleed,
Same error I got with the spots I tried.

Line 1:50: unexpected char: '{'

User avatar
Full Bleed
Demigod
Posts: 4558
Joined: Sun Feb 25, 2007 11:53 am
Location: MD
Contact:

Re: CopyToken broken?

Post by Full Bleed »

venger wrote:
Mon Mar 02, 2020 7:13 pm
I tried the above code Fullbleed,
Same error I got with the spots I tried.

Line 1:50: unexpected char: '{'
Please share the macro.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."

venger
Giant
Posts: 144
Joined: Tue Apr 17, 2007 11:37 am

Re: CopyToken broken?

Post by venger »

https://drive.google.com/open?id=1oCLtu ... WhLRJ0d8Qu

Here is my Token FullBleed
It's a representation of the PC's flagship I would control at a F2F game so for now I'm putting macros on it.
The macros are to set up Spelljammer type encounters and handle various combat things

The macro in question is titled "1.Add a Ship" which is to copy a token from the "z.Tokens.Encounters" map

---------------------
If you have the time, could you please look at this, is not a bug
I provided the token because before this issue, I was pondering a solution for the macro next to it, "1.Initiate Encounter" and would have been posting about it.

The macro is ok up until Step 7 (typo in the remarks as a second Step 6 in the code, sorry)

My Tactical map is a hex vertical
The token graphic shows the facings as a number, and I call them bearings.

Macro purpose: Reposition the encounter token relative to the PCFlagship, on a random bearing and distance.
My code handles placing the Encounter token adjacent to PCFlagship on a relative bearing, but I cant resolve what code or logic needed to move the token to its random 1d10+10 distance away on that bearing. I'm stymied for a solution.
I left my code out regarding that move, none of it worked. Not even close

Any tips, snippets, info whatsoever is greatly appreciated
Thanks
Last edited by venger on Tue Mar 03, 2020 8:46 am, edited 1 time in total.

User avatar
aliasmask
Deity
Posts: 8667
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: CopyToken broken?

Post by aliasmask »

Put quotes around the braces:

Code: Select all

[h: copyToken(EncounterShip, 1, "z.Tokens.Encounters", "{}")]

venger
Giant
Posts: 144
Joined: Tue Apr 17, 2007 11:37 am

Re: CopyToken broken?

Post by venger »

Yes Aliasmask that did it, thank you.
I see now its like a place holder for a parameter or something like that

Phergus
Deity
Posts: 7132
Joined: Fri May 12, 2006 8:56 pm
Location: Middle of Nowhere, NM
Contact:

Re: CopyToken broken?

Post by Phergus »

Yes. There were two bugs. copyToken() without the updates parameter just flat failed while passing the parameter worked but spewed a bogus error message.

Fixed in 1.5.14.

Post Reply

Return to “Macros”