Potential bug - reading value of 1 from Library token prop's

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

Post Reply
ziltmilt
Dragon
Posts: 331
Joined: Sun Apr 29, 2007 9:28 pm
Contact:

Potential bug - reading value of 1 from Library token prop's

Post by ziltmilt »

I've noticed my macros can't pick up a value of 1 off a library token's properties. Other values, so far at least, don't have this issue. Anyone else noticed this?

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

Re: Potential bug - reading value of 1 from Library token pr

Post by aliasmask »

Can you give an example of how you came to this conclusion?

ziltmilt
Dragon
Posts: 331
Joined: Sun Apr 29, 2007 9:28 pm
Contact:

Re: Potential bug - reading value of 1 from Library token pr

Post by ziltmilt »

I can upload my cmpgn file if that'd help. I've got a token named 'Lib:Utility' with a property called 'BaseDiff'. Here's some test code I used:

Code: Select all


[h: val = 0]
[h: val = getLibProperty("BaseDiff", "Lib:Utility")]
Val = {val}

And, these are the results I get from , first setting BaseDiff = 2, then setting BaseDiff = 1:
Jeff:
Val = 2
Jeff:
Val =

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

Re: Potential bug - reading value of 1 from Library token pr

Post by aliasmask »

I guaranty you there is more going on than this code.

I created a lib token and set Strength to 2 and then 1 and it gave the correct values in output.

Code: Select all

[r: val = getLibProperty("Strength","lib:util")]

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: Potential bug - reading value of 1 from Library token pr

Post by Full Bleed »

aliasmask wrote:I guaranty you there is more going on than this code.
Going to guess that BaseDiff property is evaluated in some way as to invalidate the intended 1 value.

OP, you might want to share the campaign.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."


ziltmilt
Dragon
Posts: 331
Joined: Sun Apr 29, 2007 9:28 pm
Contact:

Re: Potential bug - reading value of 1 from Library token pr

Post by ziltmilt »

Yes, I gave the property in question a default value of 1. What should I do?

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

Re: Potential bug - reading value of 1 from Library token pr

Post by wolph42 »

Remove it. Just leave it empty. Just to be clear: I'm talking about the value you set in the campaign properties.
You can then manually set the value to 1 on the lib, that's no problem

User avatar
StarMan
Dragon
Posts: 939
Joined: Mon Jul 18, 2011 1:10 pm
Location: Toronto

Re: Potential bug - reading value of 1 from Library token pr

Post by StarMan »

Aha, so I'm NOT going crazy! Well, at least not on this point maybe. :wink: The problem in my case is not critical and I have devised a workaround similar to what you discuss above.

Please watch this video. The Global Toggles macro I talk about here uses Lib properties to store the values of the checkboxes. My macros then reference those properties with "[IF(getLibProperty("Strength")) ...". This works fine ... until I cut the Lib token, reload my campaign, delete the Lib token that is there and paste the one that is on the clipboard (i.e. replacing it with the newer version). Now when I run the exact same referencing macro, MT 91 fails with the generic "Error in roll ...".

Why? I haven't changed the property at all! If I run Global Toggles again to change it (or run the Reset MPB Props also discussed in the video), the macro starts working fine again. My theory up to this point is the act of pasting the Lib in somehow "destabilizes" Strength (and other props) causing it to change from a numeric value to an alphanumeric one. Regardless of when you go to the Properties tab of the token, it displays visually as "0" or "1". There are no quotes, whitespace or anything else to suggest the data type has been changed to a string. It LOOKS like a number.

No, I have not set a default for Strength (or the other checkbox props) in Edit->Campaign Properties. Again, this isn't critical as there is the Reset MPB Props workaround which runs [Strength=1]. I will try the [Strength=2] workaround but I am still curious ...
StarMan - The MacroPolicebox D&D 4E Framework: Import ANYTHING!

User avatar
celestian
Dragon
Posts: 276
Joined: Mon May 17, 2010 3:29 pm

Re: Potential bug - reading value of 1 from Library token pr

Post by celestian »

wolph42 wrote:Did you perhaps predefine the property on the lib with a default value of 1?
Cause in that case this can happen.
I never quite understood this behavior. Is there a REASON it would want to do this? I can't think of a valid reason it would make sense.

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

Re: Potential bug - reading value of 1 from Library token pr

Post by aliasmask »

celestian wrote:
wolph42 wrote:Did you perhaps predefine the property on the lib with a default value of 1?
Cause in that case this can happen.
I never quite understood this behavior. Is there a REASON it would want to do this? I can't think of a valid reason it would make sense.
I think this is only an issue for predefined token properties on lib tokens. I would say, just don't do it. If you have variables to set on a lib token, then do it with setLibProperty. I usually have databases and other settings I set with a macro.

Post Reply

Return to “Macros”