Everything went just fine, the macro takes the property, adds modifier, treats that as a target number. Then it rolls separate d10s for Decimals and Normal numbers, processes them to create the result ranging from 1 to 100 with ability to reverse the number order to get the Warhammer Hit Locations numbers.
I've managed to create functions to display either Degrees of Success or Failure, and all went well, until I tried to play with the 'If functions' that gives commands and codes.
Basically the idea was, that there is the final Location-Hit variable calculated from the previous dice rolls and the 'if functions' checks the number, assigning a text Phrase to another variable which would be displayed at the very end, or moves on to compare the number again, to some higher values.
I used the [if(comparison), code:{command}; ...], asking the macro to run another check and asign a text Phrase if it finds proper values in comparison section.
I tested the macro with few basic increments and it went on fine, but once I finished the whole chain, I get constant Errors...
The Macro below is partially written in Polish
Macro in question
Code: Select all
<!-----------This part loads in cWS - which stands for Character's Weapon Skill - no problem here
[h: WW=getProperty("cWS")]
[h: WWmod=Modyfikator]
[h: finalWW=WW+WWmod]
<!----------The main 'engine' block - everything runs smoothly here. 'nLokTraf' stands for NewHitLocation and is the crucial value used later
[h: Dziesietne = 1d10-1]
[h: Zwykle = 1d10-1]
[h: ZwykleT = Zwykle]
[h: Skladowa = ((Dziesietne * 10))+Zwykle]
[h: OSklad = Skladowa]
[h: nSkladowa = if(Skladowa == 0, 100, Osklad)]
[h: LokTraf = ((Zwykle *10))+Dziesietne]
[h: OLokTraf = LokTraf]
[h: nLokTraf = if(LokTraf == 0, 100, OLokTraf)]
[h: StanTestu = if(finalWW>=nSkladowa, 1, 0)]
[h: StopnieTemp = if(finalWW>=nSkladowa, (floor((finalWW-nSkladowa)/10)),
(floor((nSkladowa-finalWW)/10)))]
[h: Stopnie = if(0>StopnieTemp, 0, StopnieTemp)]
<!-----------This is the problematic part. Basically 'Lokacja' means Location, and the idea was to provide that variable with a phrase, by comparing the nLokTraf with numerical ranges corresponding to each Hit Location in game's mechanics.
[e,if(15>=nLokTraf), code:{[Lokacja="Glowa"]};
{[if(nLokTraf>15 && 35>=nLokTraf), code:{[Lokacja="Prawa Reka"]};{
[if(nLokTraf>35 && 55>=nLokTraf), code:{[Lokacja="Lewa Reka"]};{
[if(nLokTraf>55 && 80>=nLokTraf), code:{[Lokacja="Korpus"]};{
[if(nLokTraf>80 && 90>=nLokTraf), code:{[Lokacja="Prawa Noga"]};{
[if(nLokTraf>90 && 100>=nLokTraf), code:{[Lokacja="Lewa Noga"]};{[Lokacja="Error"]}]}]}]}]}]}]
<!------------------The block that shows results - no problems here. The idea is to display the phrase indicating body location where [Lokacja] is.
<b>Próg Wyzwania:</b> [finalWW]<br>
<b>Wynik Rzutu:</b> [nSkladowa] [if(StanTestu==1): "Sukces"; "Niepowodzenie"] [Stopnie] Stopni<br>
<b>Trafienie w:</b> [nLokTraf] [Lokacja]<br>
Error Message
Error in body of roll. Statement options (if any): e,if(15>=nLokTraf), code Statement Body (first 200 characters): {[Lokacja="Glowa"]}; {[if(nLokTraf>15 && 35>=nLokTraf), code:{[Lokacja="Prawa Reka"]};{ [if(nLokTraf>35 && 55>=nLokTraf), code:{[Lokacja="Lewa Reka"]};{ [if(nLokTraf>55 && 80>=nLokTraf), code:
Thanks in advance.