#Help with strings and numbers

1 messages · Page 1 of 1 (latest)

main raptor
#

Trying to run the following macro:

[h: attackerId = getImpersonated()]
[h: targetId = getSelected()]
[h: attackerAttack = getProperty("Attack", attackerId)]
[h: targetDefense = getProperty("Defense", targetId)]

[h, if(!isNumber(attackerAttack)), code: {
[h: attackerAttack = number(attackerAttack)]
}]
[h, if(!isNumber(targetDefense)), code: {
[h: targetDefense = number(targetDefense)]
}]

[h: dano = (attackerAttack - (targetDefense / 2)) * 0.5 + roll("1d6")]
[h: broadcast("Dano do Ataque: " + dano)]

I'm always getting "Illegal argument type java.lang.String, expecting java.math.BigDecimal"

How to solve this?

teal widget
#

roll(1d6)

#

@main raptor

#

And, fyi, when posting code to discord wrap it in triple ticks (the ` in the top left of your keyboard). 😉