Macro stopped working

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
Psycher
Kobold
Posts: 18
Joined: Thu Nov 25, 2010 1:50 am

Macro stopped working

Post by Psycher »

Help, my library was working just fine yesterday, now today I opened the campaign and I get "Error in body of roll"

The macro in question (in my Library)

[h:Token = getStrProp(macro.args, "ParentToken")]
[h,token(Token): status=input(
"uItemName | Default Name | Item Name",
"uQuantity | 0 | Quantity",
"uDescription | None | Description | TEXT | WIDTH=60",
"uWeight | 0 | Weight per Object"
)]
[h:abort(status)]
[h: uNewItem = json.set("{ }", "Name", uItemName, "Amount", uQuantity, "Description", uDescription, "Weight", uWeight)]
[h,token(Token): Inventory = json.append(Inventory, uNewItem)]
<b> * [r: uItemName] Added * </b>
[MACRO("DrawCharacterSheet@Lib:CharacterSheet") : "ParentToken=" + currentToken()]

When I try to run it:
   Error in body of roll.       Statement options (if any): h,token(Token)       Statement Body : status=input( "uItemName | Default Name | Item Name", "uQuantity | 0 | Quantity", "uDescription | None | Description | TEXT | WIDTH=60", "uWeight | 0 | Weight per Object" )

I'm tearing my hair out, as it worked just fine yesterday - I added several items to several tokens, now those same tokens give me this error. I went to the wiki, and it states that "currentToken()" is "1.3b51 - No longer a trusted function."
I even moved the tokens to the default map where I keep my library at. Everything else works, showing that currentToken() is working as expected, and I'm at my wit's end. Anyone have any workarounds?

User avatar
aliasmask
RPTools Team
Posts: 9024
Joined: Tue Nov 10, 2009 6:11 pm
Location: Bay Area

Re: Macro stopped working

Post by aliasmask »

Where is this macro located. Make sure you have player editable unchecked. Make sure there is an impersonated token. From what I see, your parent token is the current token so you should just use Wiki: switchToken().

Psycher
Kobold
Posts: 18
Joined: Thu Nov 25, 2010 1:50 am

Re: Macro stopped working

Post by Psycher »

Sorry, more context needed I see.

So the token has a character sheet macro that references a macro in the library token to open an HTML window (the character sheet) that has, among other things, an inventory. There's a link in the character sheet that references the "editItem" macro in the library token. the json arrays that populate this character sheet are in the properties of the token itself, but the macros reside in the library.
There are other links in the character sheet for rolling for stats and such that successfully reference the properties of the parent token, to date this is the only one that doesn't work - and a couple of days ago it worked just fine.

Psycher
Kobold
Posts: 18
Joined: Thu Nov 25, 2010 1:50 am

Re: Macro stopped working

Post by Psycher »

Also I'm using a library token named:

Lib:CharacterSheet

Psycher
Kobold
Posts: 18
Joined: Thu Nov 25, 2010 1:50 am

Re: Macro stopped working

Post by Psycher »

Think I figured it out... in an earlier game macros weren't working, so I changed the library to ownership: all players, and made the library token visible. When I turned off ownership: all players, it started working again.
Thanks for the assist!

Post Reply

Return to “MapTool”