b91: isPropertyEmpty() error?

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
User avatar
darkrokr
Kobold
Posts: 19
Joined: Thu Oct 25, 2012 4:48 am

b91: isPropertyEmpty() error?

Post by darkrokr »

I am getting a weird error regarding a macro function, and although I am certain as to the location of the error, its nature escapes me. Pertinent information: macro.args only consists of the ID of the current token; I never let CreatureType go empty; ChaMod and ConMod are automatically calculated; Concentration is empty by default. …yet it is that last tidbit that is giving me trouble: the macro works properly when Concentration is not empty but throws an error when it is. The macro itself is contained within the following spoiler (it's fairly short; either nine or ten lines, depending on screen size).
Spoiler
<!-- This macro exists to handle modifiers to a Concentration skill check. -->
<!-- These modifiers can include the relevant ability modifier, bonuses from feats, and racial modifiers. -->
<!-- VARIABLES RETURNED: one, the sum of all applicable modifiers not counting the d20 roll itself. -->

<!-- Get the target from the calling macro, and switch to that target. -->
[h: switchToken(macro.args)]

<!-- If the user is a Construct or an Undead, use the Charisma modifier; else, use the Constitution modifier. -->
[h: macro.return = if(CreatureType == "Construct" || CreatureType == "Undead", ChaMod, ConMod) + if(listContains(Feats, "Skill Focus (Concentration)", ", ") == 1, 3, 0) + if(isPropertyEmpty(Concentration) != 1 && isNumber(Concentration) == 1, floor(Concentration), 0) + if(CreatureRace == "Marut", 4, 0)]
I am using Ubuntu 14.04 32-bit with Java 6 and MapTool b91. If it matters (and it probably doesn't), I'm trying to create a framework for D&D 3.5e from scratch.

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

Re: b91: isPropertyEmpty() error?

Post by aliasmask »

You're using the Wiki: if() and floor(Concentration) is evaluated in either case. When blank, this will error. A hot fix would be to put floor(eval("0 + "+Concentration)). But, will concentration ever be a fraction and need the floor function?

User avatar
darkrokr
Kobold
Posts: 19
Joined: Thu Oct 25, 2012 4:48 am

Re: b91: isPropertyEmpty() error?

Post by darkrokr »

That fixed it. Thanks. …that's a weird error, though…

Yes, the floor() function is necessary; D&D 3.5e supports half-ranks in skills, and Concentration counts as a skill in this case. Granted, I don't plan on my players taking cross-class skill ranks in anything other than Listen, Search, or Spot, but I figured that I'd cover for Concentration as a cross-class skill regardless.

Post Reply

Return to “MapTool”