Problem using code "{}" in a strProp

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
User avatar
Shadowfireomega
Giant
Posts: 218
Joined: Thu Dec 23, 2010 12:12 am
Location: San Antonio, Texas

Problem using code "{}" in a strProp

Post by Shadowfireomega »

Took me a while to figure out what was going on, but every time I update a strProp with setStrProp, any of the properties within the string that have a value containing another property switch that property for the value.
Example:

Code: Select all

[h:Weapon1=setStrProp(Weapon1,"Wep1Abil","{StrMod}")]
Sets the property to : Wep1Abil={StrMod} within the string property.
All is good.

However when I try to update anything else on that string property, say

Code: Select all

[h:Weapon1=setStrProp(Weapon1,"Wep1Name","Longsword")]
Now the property reads: Wep1Abil=5 (which is the value for StrMod)
Not so great, as I would like this ability to be dynamic.

Any workaround for this?
"I love being wrong, for if I was always right, there would be nothing left to learn, and that would be a world I would not want to live in."
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros

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

Re: Problem using code "{}" in a strProp

Post by aliasmask »

Interesting. Looks like a bug, but maybe not. It's tricky working with strings that look like something else, but isn't. Is Weapon1 defined in your token properties? I bet it's being evaluated there which is a feature rather than a bug. Why not just put StrMod only, no {}s?

You other option is to switch to json formatting.

User avatar
Shadowfireomega
Giant
Posts: 218
Joined: Thu Dec 23, 2010 12:12 am
Location: San Antonio, Texas

Re: Problem using code "{}" in a strProp

Post by Shadowfireomega »

Interesting. Looks like a bug, but maybe not. It's tricky working with strings that look like something else, but isn't. Is Weapon1 defined in your token properties? I bet it's being evaluated there which is a feature rather than a bug. Why not just put StrMod only, no {}s?
Weapon1 is defined in the token properties. If I don't update the property at all it retains the {StrMod} and pulls from the token defined property StrMod. Now with melee weapons this isn't such a big deal, I'll mostly not need to update the property for them. But when it's a ranged weapon the attack macro updates the ammo property within. When this happens {DexMod} switches to it's value. The problem with that is if the player gets buffed and DexMod changes, this will not update the strProp as if it had {DexMod}.

But I see what you're saying with not using the {}. To be honest I kinda went this route while waiting already, putting a switch inside of the attack macro that assigns the proper stat based on weapon type.
"I love being wrong, for if I was always right, there would be nothing left to learn, and that would be a world I would not want to live in."
-Benjamin Fisher
"Knowledge is knowing a tomato is a fruit; wisdom is not putting it in a fruit salad."
-Miles Kington
"Space is his favorite thing in the world!"
-Kayla Kros
"Anything times 1 is 1"
-Kayla Kros

Post Reply

Return to “Macros”