Library token property value doesn't always return

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:

Library token property value doesn't always return

Post by ziltmilt »

Hi, hopefully this is a real simple question. I've got a property on a library token, called 'BaseDiff'. When it's got a value not equal to 0, I can get code to return the value. If BaseDiff == 0, then the only value returned is an empty string. Any idea why this would be?

Here's my code ..

Code: Select all


{getLibProperty("BaseDiff", "Lib:Utility")}

Again, it works just fine and returns the correct value if the property doesn't equal zero. I even tried renaming it to 'BaseDifficulty' and tried returning a value and that didn't work either.

User avatar
Irrlicht
Dragon
Posts: 426
Joined: Mon Feb 09, 2009 10:53 am

Re: Library token property value doesn't always return

Post by Irrlicht »

I'm not sure where you put that code, but on a normal macro, it would suffice to do:

Code: Select all

[h: retrievedBaseDiff = getLibProperty("BaseDiff", "Lib:Utility")]

[h, if(retrievedBaseDiff == 0): retrievedBaseDiff = ""]

[r: retrievedBaseDiff]
"There are many ways my Son, to find where the souls of Demons remain...
But it takes only one second of despair and of doubt until, at last, your Soul they will gain..."

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

Re: Library token property value doesn't always return

Post by aliasmask »

ziltmilt wrote:Again, it works just fine and returns the correct value if the property doesn't equal zero.
By any chance did you set a default value to 0 for the property on the lib token? If you don't set a default value then it'll probably work.

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

Re: Library token property value doesn't always return

Post by ziltmilt »

Yes, I put in a default value. Any idea why that would matter?


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

Re: Library token property value doesn't always return

Post by aliasmask »

ziltmilt wrote:Yes, I put in a default value. Any idea why that would matter?
It's a lib token thing.

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

Re: Library token property value doesn't always return

Post by ziltmilt »

Well, thanks again for the quick reply, folks. The fix worked!!

Post Reply

Return to “Macros”