Help with Switch/Case! setProperty
Posted: Tue Sep 14, 2021 1:52 pm
Hello everyone, this is my first post here and i am new to programming and macros. English is also not my first language, so please bear with me
I'm trying to write a macro that sets the value of two properties(GdP, GeB) on a token. It works for the first one("GdP"), but not for the second one("GeB"). I want to know (1) if it is possible to do it this way and, (2) what am i doing wrong, cause as i said, im new to macro writing and i know little about it.
If switch/case is not the way to go, i would appreciate some tips on how to do it. Thanks!
I'm trying to write a macro that sets the value of two properties(GdP, GeB) on a token. It works for the first one("GdP"), but not for the second one("GeB"). I want to know (1) if it is possible to do it this way and, (2) what am i doing wrong, cause as i said, im new to macro writing and i know little about it.
Code: Select all
[h: str = getProperty("Strength")]
[h,switch(str):
case "10": setProperty("GdP", '1d6-2') setProperty("GeB", '1d6');
case "11": setProperty("GdP", '1d6-1') setProperty("GeB", '1d6+1');
case "12": setProperty("GdP", '1d6-1') setProperty("GeB", '1d6+2');
]