Illegal argument type java.lang.String, expecting java.math.BigDecimal
I’m pretty sure that the decimal is causing the var [r: exp = listGet( x, 1, ":")] to register as a string but I can’t find anything on forcing the var to register as a number.
Code: Select all
[r, MACRO("Skills@Lib:DoH"): Skills + ', 0, Admin, 0']
[h: Skills = macro.return]
Code: Select all
[h: Parameter = macro.args]
[h: skillList = listGet(Parameter, 0)]
…
…
[r, switch(listGet(Parameter, 1)), CODE:
…
…
default:
{
[h: newList = '']
[h: nRoll = (1d10 + (listGet( Parameter, 3) * 10)) / 100]
[h: tmpList = listGet(skillList, listGet(Parameter, 1), "~*~")]
[r, foreach( x, tmpList, "", "~"), CODE:
{
[r: exp = listGet( x, 1, ":")]
[r: exp = exp + nRoll]
[h: newList = newList + if( newList == "", '', '~ ') + if( listGet( x, 0, ":") == listGet(Parameter, 2), listReplace( x, 1, if( listGet( x, 1, ":") < listGet(Parameter, 3), listGet(Parameter, 3), exp), ":"), x)]
}]
[h: skillList = listReplace( skillList, listGet(Parameter, 1), newList, "~*~")]
}]
[h: macro.return = skillList]
Spoiler
Code: Select all
[h: Parameter = macro.args]
[h: skillList = listGet(Parameter, 0)]
[h: EducationalList = '
Admin~ Advocate~ Animals (Veterinary)~ Art (Preformer)~ Art (Holography)~ Art (Instrument)~ Art (Visual Media)~ Art (Write)~
Diplomat~
Electronics (Comms.)~ Electronics (Computers)~ Electronics (Remote Ops.)~ Electronics (Sensors)~
Engineer (Basic Systems)~ Engineer (Advanced Systems)~ Engineer (Power Plants)~ Engineer (M-Drives)~ Engineer (J-Drive)~
Engineer (H-Drive)~ Engineer (W-Drive)~ Engineer (A-Drive)~ Engineer (G-Drive)~ Engineer (S-Drive)~ Engineer (T-Drive)~
Investigate~
Math~ Mechanic~ Medic~
Science (Archaeology)~ Science (Astronomy)~ Science (Biology)~ Science (Botany)~ Science (Chemistry)~ Science (Cybernetics)~ Science (Economics)~ Science (Genetics)~ Science (History)~ Science (Magicology)~ Science (Psionicology)~ Science (Psychology)~ Science (Robotics)~ Science (Sophontology)~ Science (Xenology)~
Survival~
Tactics (Army)~ Tactics (Air Force)~ Tactics (Naval)~ Tactics (Gorilla)']
[h: SocialList = '
Animals (Handling)~ Animals (Training)~ Athletics (Dexterity)~ Athletics (Endurance)~ Athletics (Strength)~
Broker~
Carouse~
Deception~
Gambler~
Leadership~
Persuasion~ Perception~ Profession~
Recon~
Seduction~ Stealth~ Stewardship~ Streetwise~ Studied (Intellect)~ Studied (Will Power)~ Studied (Social Std.)']
[h: CombatList = '
Explosives~
Gunner (Capital)~ Gunner (Ortillery)~ Gunner (Screen)~ Gunner (Turret)~
Gun Combat (Archaic)~ Gun Combat (Slug)~ Gun Combat (Energy)~ Gun Combat (Plasma)~ Gun Combat (Thata)~ Gun Combat (Magical)~
Heavy Wpns (Artillery)~ Heavy Wpns (Man-Port.)~ Heavy Wpns (Vehicle)~
Melee (Angelic)~ Melee (Blade)~ Melee (Bludgeon)~ Melee (Demonic)~ Melee (Energy)~ Melee (Magical)~ Melee (Natural)~ Melee (Unarmed)']
[h: TransportList = '
Astrogation~
Navigation~
Drive (Hovercraft)~ Drive (Mole)~ Drive (Tracked)~ Drive (Walker)~ Drive (Wheeled)~
Flyer (Airship)~ Flyer (Grav)~ Flyer (Ornithopter)~ Flyer (Rotor)~ Flyer (Wing)~
Seafarer (Ocean Ships)~ Seafarer (Personal)~ Seafarer (Sail)~ Seafarer (Submarine)~
Pilot (Class A)~ Pilot (Class B)~ Pilot (Class C)~ Pilot (Class D)~
Vacc Suit']
[r, switch(listGet(Parameter, 1)), CODE:
case "build":
{
[h: skillList = '']
[h: x = listCount(EducationalList, "~")]
[h, for(i, 0, x, +1, ""): skillList = skillList + if(i == 0, '', '~ ') + listGet(EducationalList, i, "~") + ': -3']
[h: skillList = skillList + "~*~"]
[h: x = listCount(SocialList, "~")]
[h, for(i, 0, x, +1, ""): skillList = skillList + if(i == 0, '', '~ ') + listGet(SocialList, i, "~") + ': -3']
[h: skillList = skillList + "~*~"]
[h: x = listCount(CombatList, "~")]
[h, for(i, 0, x, +1, ""): skillList = skillList + if(i == 0, '', '~ ') + listGet(CombatList, i, "~") + ': -3']
[h: skillList = skillList + "~*~"]
[h: x = listCount(TransportList, "~")]
[h, for(i, 0, x, +1, ""): skillList = skillList + if(i == 0, '', '~ ') + listGet(TransportList, i, "~") + ': -3']
};
case "check":
{
[h: Checked = 0]
[h: ctFound = 0]
[h: tmpList = listGet(skillList, 0, "~*~")]
[h, if (listCount(tmpList, "~") >= listCount(EducationalList, "~")), CODE:
{
[h: List1 = tmpList]
[h: List2 = EducationalList]
[h: Diff = 'Extra ']
};
{
[h: List2 = tmpList]
[h: List1 = EducationalList]
[h: Diff = 'Missing ']
}]
[r, foreach( ck, List1, "", "~"), CODE:
{
[h: Found = 0]
[h, for( i, 0, listCount(List2, "~")): Found = if( listGet(ck, 0, ":") == listGet( listGet(List2, i, "~"), 0, ":"), 1, Found)]
[r: if( Found == 0, Diff + 'educational skill found: ' + listGet(ck, 0, ":") + '<br>', '')]
[h: ctFound = if( Found == 0, ctFound, ctFound + 1)]
}]
[h: Checked = if( ctFound == listCount( List1, "~"), Checked +1, Checked)]
[h: ctFound = 0]
[h: tmpList = listGet(skillList, 1, "~*~")]
[h, if (listCount(tmpList, "~") >= listCount(SocialList, "~")), CODE:
{
[h: List1 = tmpList]
[h: List2 = SocialList]
[h: Diff = 'Extra ']
};
{
[h: List2 = tmpList]
[h: List1 = SocialList]
[h: Diff = 'Missing ']
}]
[r, foreach( ck, List1, "", "~"), CODE:
{
[h: Found = 0]
[h, for( i, 0, listCount(List2, "~")): Found = if( listGet(ck, 0, ":") == listGet( listGet(List2, i, "~"), 0, ":"), 1, Found)]
[r: if( Found == 0, Diff + 'social skill found: ' + listGet(ck, 0, ":") + '<br>', '')]
[h: ctFound = if( Found == 0, ctFound, ctFound + 1)]
}]
[h: Checked = if( ctFound == listCount( List1, "~"), Checked +1, Checked)]
[h: ctFound = 0]
[h: tmpList = listGet(skillList, 2, "~*~")]
[h, if (listCount(tmpList, "~") >= listCount(CombatList, "~")), CODE:
{
[h: List1 = tmpList]
[h: List2 = CombatList]
[h: Diff = 'Extra ']
};
{
[h: List2 = tmpList]
[h: List1 = CombatList]
[h: Diff = 'Missing ']
}]
[r, foreach( ck, List1, "", "~"), CODE:
{
[h: Found = 0]
[h, for( i, 0, listCount(List2, "~")): Found = if( listGet(ck, 0, ":") == listGet( listGet(List2, i, "~"), 0, ":"), 1, Found)]
[r: if( Found == 0, Diff + 'combat skill found: ' + listGet(ck, 0, ":") + '<br>', '')]
[h: ctFound = if( Found == 0, ctFound, ctFound + 1)]
}]
[h: Checked = if( ctFound == listCount( List1, "~"), Checked +1, Checked)]
[h: ctFound = 0]
[h: tmpList = listGet(skillList, 3, "~*~")]
[h, if (listCount(tmpList, "~") >= listCount(TransportList, "~")), CODE:
{
[h: List1 = tmpList]
[h: List2 = TransportList]
[h: Diff = 'Extra ']
};
{
[h: List2 = tmpList]
[h: List1 = TransportList]
[h: Diff = 'Missing ']
}]
[r, foreach( ck, List1, "", "~"), CODE:
{
[h: Found = 0]
[h, for( i, 0, listCount(List2, "~")): Found = if( listGet(ck, 0, ":") == listGet( listGet(List2, i, "~"), 0, ":"), 1, Found)]
[r: if( Found == 0, Diff + 'transportation skill found: ' + listGet(ck, 0, ":") + '<br>', '')]
[h: ctFound = if( Found == 0, ctFound, ctFound + 1)]
}]
[h: Checked = if( ctFound == listCount( List1, "~"), Checked +1, Checked)]
[r: if( Checked == 4, 'All skills check out.', '')]
};
default:
{
[h: newList = '']
[h: nRoll = (1d10 + (listGet( Parameter, 3) * 10)) / 100]
[h: tmpList = listGet(skillList, listGet(Parameter, 1), "~*~")]
[r, foreach( x, tmpList, "", "~"), CODE:
{
[r: exp = listGet( x, 1, ":")]
[r: exp = exp + nRoll]
[h: newList = newList + if( newList == "", '', '~ ') + if( listGet( x, 0, ":") == listGet(Parameter, 2), listReplace( x, 1, if( listGet( x, 1, ":") < listGet(Parameter, 3), listGet(Parameter, 3), exp), ":"), x)]
}]
[h: skillList = listReplace( skillList, listGet(Parameter, 1), newList, "~*~")]
}]
[h: macro.return = skillList]