"To long" error (Solved)

Discuss macro implementations, ask for macro help (to share your creations, see User Creations, probably either Campaign Frameworks or Drop-in Resources).

Moderators: dorpond, trevor, Azhrei, giliath, jay, Mr.Ice

Post Reply
TheShadow
Kobold
Posts: 12
Joined: Wed Mar 19, 2014 9:43 pm

"To long" error (Solved)

Post by TheShadow »

I had just finished copying the entire macro to make macros from:

http://onlinedungeonmaster.com/2012/03/ ... ent-566800

When "java.lang.IllegalArgumentException: Value too long:[Then my coding]" popped up. Considering how long this had take (3 Days :cry: ) I was very unhappy. Could you help resolve this? I already took out the things that I could, but they were just line breaks that helped organize the macro.
Spoiler
TheShadow wrote:Hia,
I was coping the macro from a website I found (http://onlinedungeonmaster.com/2012/03/ ... ment-56680) and came across this error when I was done. To summarize, it said my Macro was too long
(java.lang.IllegalArgumentException: Value too long:) is the first line. I'll cancel out of it, but every time I try to complete the macro by clicking OK it pops-up again. I believe I'm using .b89 nut it may be .b84 maptool (I can't check without losing it). Suggested fix... Umm, maybe increase maximum size of macros?

Thanks
-A Confused GM
Last edited by TheShadow on Fri Mar 21, 2014 5:24 pm, edited 2 times in total.

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: "To long" error

Post by aliasmask »

Without your actual code, there isn't much to debug. I downloaded the macro from the site and this is what I get:
||| CODE |||

Code: Select all

[h: listActionTypes = "2. Traits, 3. Standard Actions, 4. Move Actions, 5. Minor Actions, 6. Triggered Actions"]
[h: listDamageLevel = "Minion, Very Low, Low, Normal, High, Very High, Extreme"]
[h: listUsage = "At-Will, Recharge, Encounter, Not Applicable"]
[h: x = input(
  "MacroName | NewPower| Power Name || WIDTH=20",
  "TargetRange | (M1) | Targets-Aura-Etc || WIDTH=10",
  "ActionType | " + listActionTypes + " | Action Type | LIST | VALUE=STRING SELECT=1",
  "SortOrder | 1 | Sort order || WIDTH=2",
  "Usage | " + listUsage + " | Usage | LIST | VALUE=STRING SELECT=0",
  "NumberOfTargets | Single-Target, Multi-Target, No Targets | Number of Targets | LIST | VALUE=STRING SELECT=0",
  "AttackRollRequired | 1 | Attack roll? | CHECK | ",
  "DamageRollRequired | 1 | Damage roll? | CHECK | ",
  "RequirementIncluded | 0 | Requirement line? | CHECK | ",
  "PreAttackEffectIncluded | 0 | Pre-attack effect? | CHECK | ",
  "MissEffectIncluded | 0 | Miss effect? | CHECK | ",
  "AftereffectIncluded | 0 | After-save effect? | CHECK | ",
  "PostAttackEffectIncluded | 0 | Post-attack effect? | CHECK | ",
  "SpecialEffectIncluded | 0 | Special effect? | CHECK | "
)]
[h: abort(x)]

[h: DefenseTargeted='AC']
[h: Enhancement=0]
[h: DamageLevel="Normal"]
[h: DefaultDamageLevel=3]
[h, if(getProperty("Role")=="Brute"): DefaultDamageLevel=DefaultDamageLevel+1]
[h, if(Usage=="Recharge"): DefaultDamageLevel=DefaultDamageLevel+1]
[h, if(Usage=="Encounter"): DefaultDamageLevel=DefaultDamageLevel+2]
[h, if(NumberOfTargets=="Multi-Target"): DefaultDamageLevel=DefaultDamageLevel-1]
[h, if(getProperty("SubType")=="Minion"): DefaultDamageLevel=0]

[h: RechargeTargetInputString=if(Usage=="Recharge",encode("RechargeTarget | 2, 3, 4, 5, 6 | Recharge Target | LIST | VALUE=STRING SELECT=3"),"")]
[h: DamageRollInputString=if(DamageRollRequired==1,encode("DamageLevel | " + listDamageLevel + " | Damage Level | LIST | VALUE=STRING SELECT=" + DefaultDamageLevel),"")]
[h: EnhancementInputString=if(DamageRollRequired==1,encode("Enhancement | 0 | Extra damage on crit? | CHECK | "),"")]
[h: ExtraAttackBonusInputString=if(AttackRollRequired==1,encode("ExtraAttackBonus | 0 | Extra attack bonus | | WIDTH=2"),"")]
[h: JustEffectInputString=if(AttackRollRequired==0,encode("JustEffect | . | Effect line | | WIDTH=50"),"")]
[h: DefenseInputString=if(AttackRollRequired==1,encode("DefenseTargeted | AC, Fortitude, Reflex, Will | Defense targeted | LIST | VALUE=STRING SELECT=0"),"")]
[h: HitStringInputString=if(AttackRollRequired==1&&DamageRollRequired==1,encode("HitStringWithDamage | damage | Hit line after damage roll | | WIDTH=50"),if(AttackRollRequired==1&&DamageRollRequired==0,encode("HitStringNoDamage | .  | Hit line | | WIDTH=50"),if(AttackRollRequired==0&&DamageRollRequired==1,encode("EffectStringNoAttack | damage  | Effect line after damage roll | | WIDTH=50"),"")))]
[h: RequirementInputString=if(RequirementIncluded==1,encode("Requirement | . | Requirement | | WIDTH=50"),"")]
[h: TriggerInputString=if(ActionType=="6. Triggered Actions",encode("Trigger | . | Trigger | | WIDTH=50"),"")]
[h: PreAttackEffectInputString=if(PreAttackEffectIncluded==1,encode("PreAttackEffect | . | Pre-Attack Effect | | WIDTH=50"),"")]
[h: MissEffectInputString=if(MissEffectIncluded==1,encode("MissEffect | . | Miss Effect | | WIDTH=50"),"")]
[h: AftereffectInputString=if(AftereffectIncluded==1,encode("Aftereffect | . | Aftereffect | | WIDTH=50"),"")]
[h: PostAttackEffectInputString=if(PostAttackEffectIncluded==1,encode("PostAttackEffect | . | Post-attack effect | | WIDTH=50"),"")]
[h: SpecialEffectInputString=if(SpecialEffectIncluded==1,encode("SpecialEffect | . | Special Effect | | WIDTH=50"),"")]

[h: x = input(
  decode(RechargeTargetInputString),
  decode(RequirementInputString),
  decode(TriggerInputString),
  decode(PreAttackEffectInputString),
  decode(ExtraAttackBonusInputString),
  decode(DefenseInputString),
  decode(DamageRollInputString),
  decode(EnhancementInputString),
  decode(HitStringInputString),
  decode(MissEffectInputString),
  decode(AftereffectInputString),
  decode(PostAttackEffectInputString),
  decode(SpecialEffectInputString),
  decode(JustEffectInputString)
)]
[h: abort(x)]

[h, switch(DamageLevel), code:
  case "Minion": {
    [h: NumDice=0]
    [h: DieSize="MinionDamage"]
    [h: DamageBonus="MinionDamage"]
    [h: Enh=1]
    [h: CritDamageDie="MinionDamage"]
    };
  case "Very Low": {
    [h: NumDice="NumDice50"]
    [h: DieSize="DamageDie50"]
    [h: DamageBonus="DamageBonus50"]
    [h: Enh=Enhancement]
    [h: CritDamageDie="DamageDie50"]
    };
  case "Low": {
    [h: NumDice="NumDice75"]
    [h: DieSize="DamageDie75"]
    [h: DamageBonus="DamageBonus75"]
    [h: Enh=Enhancement]
    [h: CritDamageDie="DamageDie75"]
    };
  case "Normal": {
    [h: NumDice="NumDice100"]
    [h: DieSize="DamageDie100"]
    [h: DamageBonus="DamageBonus100"]
    [h: Enh=Enhancement]
    [h: CritDamageDie="DamageDie100"]
    };
  case "High": {
    [h: NumDice="NumDice125"]
    [h: DieSize="DamageDie125"]
    [h: DamageBonus="DamageBonus125"]
    [h: Enh=Enhancement]
    [h: CritDamageDie="DamageDie125"]
    };
  case "Very High": {
    [h: NumDice="NumDice150"]
    [h: DieSize="DamageDie150"]
    [h: DamageBonus="DamageBonus150"]
    [h: Enh=Enhancement*2]
    [h: CritDamageDie="DamageDie150"]
    };
  case "Extreme": {
    [h: NumDice="NumDice175"]
    [h: DieSize="DamageDie175"]
    [h: DamageBonus="DamageBonus175"]
    [h: Enh=Enhancement*2]
    [h: CritDamageDie="DamageDie175"]
    }
]

[h: AttackBonus=if(DefenseTargeted=='AC','DefaultAttackBonusVsAC','DefaultAttackBonusVsNAD')]

[h: MyCommand=""]
[h: MyCommand=MyCommand+encode("<b>" + MacroName + "</b> " + TargetRange + "<br>\\n")]
[h, if(RequirementIncluded==1): MyCommand=MyCommand+encode("<i>Requirement:</i> "+Requirement+"<br>\\n")]
[h, if(ActionType=="6. Triggered Actions"): MyCommand=MyCommand+encode("<i>Trigger:</i> "+Trigger+"<br>\\n")]
[h, if(PreAttackEffectIncluded==1): MyCommand=MyCommand+encode("<i>Effect:</i> "+PreAttackEffect+"<br>\\n")]

[h, if(AttackRollRequired==1), CODE: {
  [h: MyCommand=MyCommand+encode("[h: AttackBonus=" + AttackBonus + " + " + ExtraAttackBonus + "]\\n")]
  [h: MyCommand=MyCommand+encode("[h: Defense='"+DefenseTargeted+"']\\n")]
  [h: MyCommand=MyCommand+encode("[h: d20roll=d20]\\n")]
  [h: MyCommand=MyCommand+encode("[h: Enh="+Enh+"]\\n")]
  [h: MyCommand=MyCommand+encode("[h: CritDamageDie="+CritDamageDie+"]\\n\\n")]
  [h: MyCommand=MyCommand+encode("[h, if(CritDamageDie > 0), CODE:\\n { [CritBonus=roll(Enh,CritDamageDie)]  }; \\n  { [CritBonus=0] }\\n ]\\n\\n")]
  [h: MyCommand=MyCommand+encode("[h: AttackRoll=d20roll+AttackBonus]\\n")]
  }
]
[h, if(DamageRollRequired==1), CODE: {
  [h: MyCommand=MyCommand+encode("[h: DamageString='"+HitStringWithDamage+"']\\n")]
  [h: MyCommand=MyCommand+encode("[h: NumDice="+NumDice+"]\\n")]
  [h: MyCommand=MyCommand+encode("[h: DamageDie="+DieSize+"]\\n")]
  [h: MyCommand=MyCommand+encode("[h: DamageBonus="+DamageBonus+"]\\n\\n")]
  [h: MyCommand=MyCommand+encode("[h: DamageRoll=roll(NumDice,DamageDie)]\\n")]
  [h: MyCommand=MyCommand+encode("[h: NumDice="+NumDice+"]\\n")]
  [h: MyCommand=MyCommand+encode("[h: MaxDamage=NumDice*DamageDie+DamageBonus+CritBonus]\\n")]
  [h: MyCommand=MyCommand+encode("[h: RegularDamage=DamageRoll+DamageBonus]\\n\\n")]
  }
]
[h, if(NumberOfTargets=="Single-Target" && AttackRollRequired==1), CODE: {
  [h: MyCommand=MyCommand+encode("<i>Attack:</i> [d20roll] + [AttackBonus] = <b>[AttackRoll]</b> versus [Defense]<br>\\n")]
  [h, if(DamageRollRequired==1), CODE: {
    [h: MyCommand=MyCommand+encode("[if(d20roll==20), CODE:\\n")]
    [h: MyCommand=MyCommand+encode("  {<font color=red>--CRITICAL HIT--</font><br>\\n")]
    [h: MyCommand=MyCommand+encode("    <i>Hit:</i> [NumDice*DamageDie] ([NumDice]d[DamageDie]) + [DamageBonus] + [CritBonus] = <b>[MaxDamage]</b>  [DamageString]<br>\\n")]
    [h: MyCommand=MyCommand+encode("  };\\n")]
    [h: MyCommand=MyCommand+encode("  {<i>Hit:</i> [DamageRoll] ([NumDice]d[DamageDie]) + [DamageBonus] = <b>[RegularDamage]</b> [DamageString]<br>}\\n")]
    [h: MyCommand=MyCommand+encode("]\\n")]
    };
    {[h: MyCommand=MyCommand+encode("<i>Hit:</i> "+HitStringNoDamage+"\\n")]
    }
  ]
  };{}
]
[h, if(NumberOfTargets=="Multi-Target" && AttackRollRequired==1), CODE: {
  [h: MyCommand=MyCommand+encode("[h: x=input('NumberOfTargets|0|Number of targets')]\\n")]
  [h: MyCommand=MyCommand+encode("[h: abort(x)]\\n\\n")]
  [h: MyCommand=MyCommand+encode("Attacking [NumberOfTargets]  [if(NumberOfTargets==1,'target','targets')].<br>\\n")]
  [h: MyCommand=MyCommand+encode("[count(NumberOfTargets,'<br>'), CODE: {\\n")]
  [h: MyCommand=MyCommand+encode("  [h: d20roll=d20]\\n")]
  [h: MyCommand=MyCommand+encode("  [h: AttackRoll=d20roll+AttackBonus]\\n")]
  [h: MyCommand=MyCommand+encode("  <i>Target [r:roll.count+1]:</i>  [d20roll] + [AttackBonus] = <b>[AttackRoll]</b> versus [Defense]\\n")]
  [h, if(DamageRollRequired==1), CODE: {
    [h: MyCommand=MyCommand+encode("  [if(d20roll==20), CODE: {<font color=Red>  --CRITICAL HIT--</font> [NumDice*DamageDie] ([NumDice]d[DamageDie]) + [DamageBonus] + [CritBonus] = <b>[MaxDamage]</b> [DamageString]};{} ]\\n")]
    [h: MyCommand=MyCommand+encode("  }\\n")]
    [h: MyCommand=MyCommand+encode("]<br><br>\\n")]
    [h: MyCommand=MyCommand+encode("<i>Hit:</i> [DamageRoll] ([NumDice]d[DamageDie]) + [DamageBonus] = <b>[RegularDamage]</b> [DamageString]<br>\\n")]
    };
    {[h: MyCommand=MyCommand+encode("<i>Hit:</i> "+HitStringNoDamage+"\\n")]
    }
  ]
  }
]

[h, if(AttackRollRequired==0&&DamageRollRequired==1): MyCommand=MyCommand+encode("<i>Hit:</i> [DamageRoll] ([NumDice]d[DamageDie]) + [DamageBonus] = <b>[RegularDamage]</b> [DamageString]<br>}\\n")]

[h, if(MissEffectIncluded==1): MyCommand=MyCommand+encode("<i>Miss:</i> "+MissEffect+"<br>\\n")]
[h, if(AftereffectIncluded==1): MyCommand=MyCommand+encode("<i>Aftereffect:</i> "+Aftereffect+"<br>\\n")]
[h, if(PostAttackEffectIncluded==1): MyCommand=MyCommand+encode("<i>Effect:</i> "+PostAttackEffect+"<br>\\n")]
[h, if(SpecialEffectIncluded==1): MyCommand=MyCommand+encode("<i>Special:</i> "+SpecialEffect+"<br>\\n")]
[h, if(AttackRollRequired==0): MyCommand=MyCommand+encode("<i>Effect:</i> "+JustEffect+"<br>\\n")]

[h: FontColor="green"]

[h, if(Usage=="Encounter"), CODE: {
  [h: EncountersArray=getProperty("EncounterPowersDeclared")]
  [h: FirstEmptyEncounter=-1]
  [h, for(i, 9, -1, -1), CODE: 
    {[h: PowerCheck=json.get(EncountersArray,i)]
    [h, if(PowerCheck==0): EncounterPowerNumber=i]
    }
  ]
  [h: FontColor="red"]
  [h: NewArray=json.set(EncountersArray, EncounterPowerNumber, 1)]
  [h: setProperty("EncounterPowersDeclared", NewArray)]
  [h: MyCommand=MyCommand+encode("[h: PowerNumber="+EncounterPowerNumber+"]\\n")]
  [h: MyCommand=MyCommand+encode("[h: PowersCharged=getProperty('EncounterPowersCharged')]\\n")]
  [h: MyCommand=MyCommand+encode("[h: IsPowerAvailable=json.get(PowersCharged,PowerNumber)]\\n\\n")]
  [h: MyCommand=MyCommand+encode("[h, if(IsPowerAvailable==0), CODE:\\n")]
  [h: MyCommand=MyCommand+encode("  {[assert(1==0,add('This power has already been expended.'),0)]};\\n")]
  [h: MyCommand=MyCommand+encode("  {[h: NewArray=json.set(PowersCharged,PowerNumber,0)]\\n")]
  [h: MyCommand=MyCommand+encode("  [h: setProperty('EncounterPowersCharged', NewArray)]}]\\n")]
  [h: MyCommand=MyCommand+encode("[h: setMacroProps(getMacroButtonIndex(), 'color=darkgray') ]")]
  }
]

[h, if(Usage=="Recharge"), CODE: {
  [h: RechargeArray=getProperty("RechargePowersDeclared")]
  [h: FirstEmptyRecharge=-1]
  [h, for(i, 9, -1, -1), CODE: 
    {[h: PowerCheck=json.get(RechargeArray,i)]
    [h, if(PowerCheck==0): RechargePowerNumber=i]
    }
  ]
  [h: FontColor="purple"]
  [h: NewArray=json.set(RechargeArray, RechargePowerNumber, 1)]
  [h: setProperty("RechargePowersDeclared", NewArray)]
  [h: MyCommand=MyCommand+encode("[h: RechargeTarget="+RechargeTarget+"]\\n")]
  [h: MyCommand=MyCommand+encode("[h: RechargeRoll=d6]\\n")]
  [h: MyCommand=MyCommand+encode("[h: PowerNumber="+RechargePowerNumber+"]\\n")]
  [h: MyCommand=MyCommand+encode("[h: PowersCharged=getProperty('RechargePowersCharged')]\\n")]
  [h: MyCommand=MyCommand+encode("[h: IsPowerAvailable=json.get(PowersCharged,PowerNumber)]\\n\\n")]
  [h: MyCommand=MyCommand+encode("[h, if(IsPowerAvailable==0 && RechargeRoll<RechargeTarget), CODE:\\n")]
  [h: MyCommand=MyCommand+encode("  {[g: assert(1==0,add('Recharge roll = ', RechargeRoll, '. The power fails to recharge.'),0)]};\\n")]
  [h: MyCommand=MyCommand+encode("  {[h: NewArray=json.set(PowersCharged,PowerNumber,0)]\\n")]
  [h: MyCommand=MyCommand+encode("  [h: setProperty('RechargePowersCharged', NewArray)]}]\\n")]
  [h: MyCommand=MyCommand+encode("[h: setMacroProps(getMacroButtonIndex(), 'color=gray') ]")]
  }
]

[h, if(Usage=="Not Applicable"): FontColor="black"]

[h: MacroProps='{"autoexecute":1, "label":"'+MacroName+" "+TargetRange+'", "group":"'+ActionType+'", "sortBy":'+SortOrder+', "fontColor":"'+FontColor+'", "command":"'+decode(MyCommand)+'"}']
[h: createMacro(MacroProps)]
This looks like something for D&D 4E which I'm not familiar with.

User avatar
wolph42
Winter Wolph
Posts: 9999
Joined: Fri Mar 20, 2009 5:40 am
Location: Netherlands
Contact:

Re: "To long" error

Post by wolph42 »

in short: can you paste the code here and the error log as well. Read the debug article in my sig if you don't know what an 'errror log' is.

TheShadow
Kobold
Posts: 12
Joined: Wed Mar 19, 2014 9:43 pm

Re: "To long" error

Post by TheShadow »

Spoiler
java.lang.IllegalArgumentException: Value too long: [h: listActionTypes = "2. Traits, 3. Standard Actions, 4. Move Actions, 5. Minor Actions, 6. Triggered Actions"]
[h: listDamageLevel = "Minion, Very Low, Low, Normal, High, Very High, Extreme"]
[h: listUsage = "At-Will, Recharge, Encounter, Not Applicable"]
[h: x = input(
"MacroName | NewPower| Power Name || WIDTH=20",
"TargetRange | (M1) | Targets-Aura-Etc || WIDTH=10",
"ActionType | " + listActionTypes + " | Action Type | LIST | VALUE=STRING SELECT=1",
"SortOrder | 1 | Sort order || WIDTH=2",
"Usage | " + listUsage + " | Usage | LIST | VALUE=STRING SELECT=0",
"NumberOfTargets | Single-Target, Multi-Target, No Targets | Number of Targets | LIST | VALUE=STRING SELECT=0",
"AttackRollRequired | 1 | Attack roll? | CHECK | ",
"DamageRollRequired | 1 | Damage roll? | CHECK | ",
"RequirementIncluded | 0 | Requirement line? | CHECK | ",
"PreAttackEffectIncluded | 0 | Pre-attack effect? | CHECK | ",
"MissEffectIncluded | 0 | Miss effect? | CHECK | ",
"AftereffectIncluded | 0 | After-save effect? | CHECK | ",
"PostAttackEffectIncluded | 0 | Post-attack effect? | CHECK | ",
"SpecialEffectIncluded | 0 | Special effect? | CHECK | "
)]
[h: abort(x)]

[h: DefenseTargeted='AC']
[h: Enhancement=0]
[h: DamageLevel="Normal"]
[h: DefaultDamageLevel=3]
[h, if(getProperty("Role")=="Brute"): DefaultDamageLevel=DefaultDamageLevel+1]
[h, if(Usage=="Recharge"): DefaultDamageLevel=DefaultDamageLevel+1]
[h, if(Usage=="Encounter"): DefaultDamageLevel=DefaultDamageLevel+2]
[h, if(NumberOfTargets=="Multi-Target"): DefaultDamageLevel=DefaultDamageLevel-1]
[h, if(getProperty("SubType")=="Minion"): DefaultDamageLevel=0]

[h: RechargeTargetInputString=if(Usage=="Recharge",encode("RechargeTarget | 2, 3, 4, 5, 6 | Recharge Target | LIST | VALUE=STRING SELECT=3"),"")]
[h: DamageRollInputString=if(DamageRollRequired==1,encode("DamageLevel | " + listDamageLevel + " | Damage Level | LIST | VALUE=STRING SELECT=" + DefaultDamageLevel),"")]
[h: EnhancementInputString=if(DamageRollRequired==1,encode("Enhancement | 0 | Extra damage on crit? | CHECK | "),"")]
[h: ExtraAttackBonusInputString=if(AttackRollRequired==1,encode("ExtraAttackBonus | 0 | Extra attack bonus | | WIDTH=2"),"")]
[h: JustEffectInputString=if(AttackRollRequired==0,encode("JustEffect | . | Effect line | | WIDTH=50"),"")]
[h: DefenseInputString=if(AttackRollRequired==1,encode("DefenseTargeted | AC, Fortitude, Reflex, Will | Defense targeted | LIST | VALUE=STRING SELECT=0"),"")]
[h: HitStringInputString=if(AttackRollRequired==1&&DamageRollRequired==1,encode("HitStringWithDamage | damage | Hit line after damage roll | | WIDTH=50"),if(AttackRollRequired==1&&DamageRollRequired==0,encode("HitStringNoDamage | . | Hit line | | WIDTH=50"),if(AttackRollRequired==0&&DamageRollRequired==1,encode("EffectStringNoAttack | damage | Effect line after damage roll | | WIDTH=50"),"")))]
[h: RequirementInputString=if(RequirementIncluded==1,encode("Requirement | . | Requirement | | WIDTH=50"),"")]
[h: TriggerInputString=if(ActionType=="6. Triggered Actions",encode("Trigger | . | Trigger | | WIDTH=50"),"")]
[h: PreAttackEffectInputString=if(PreAttackEffectIncluded==1,encode("PreAttackEffect | . | Pre-Attack Effect | | WIDTH=50"),"")]
[h: MissEffectInputString=if(MissEffectIncluded==1,encode("MissEffect | . | Miss Effect | | WIDTH=50"),"")]
[h: AftereffectInputString=if(AftereffectIncluded==1,encode("Aftereffect | . | Aftereffect | | WIDTH=50"),"")]
[h: PostAttackEffectInputString=if(PostAttackEffectIncluded==1,encode("PostAttackEffect | . | Post-attack effect | | WIDTH=50"),"")]
[h: SpecialEffectInputString=if(SpecialEffectIncluded==1,encode("SpecialEffect | . | Special Effect | | WIDTH=50"),"")]

[h: x = input(
decode(RechargeTargetInputString),
decode(RequirementInputString),
decode(TriggerInputString),
decode(PreAttackEffectInputString),
decode(ExtraAttackBonusInputString),
decode(DefenseInputString),
decode(DamageRollInputString),
decode(EnhancementInputString),
decode(HitStringInputString),
decode(MissEffectInputString),
decode(AftereffectInputString),
decode(PostAttackEffectInputString),
decode(SpecialEffectInputString),
decode(JustEffectInputString)
)]
[h: abort(x)]

[h, switch(DamageLevel), code:
case "Minion": {
[h: NumDice=0]
[h: DieSize="MinionDamage"]
[h: DamageBonus="MinionDamage"]
[h: Enh=1]
[h: CritDamageDie="MinionDamage"]
};
case "Very Low": {
[h: NumDice="NumDice50"]
[h: DieSize="DamageDie50"]
[h: DamageBonus="DamageBonus50"]
[h: Enh=Enhancement]
[h: CritDamageDie="DamageDie50"]
};
case "Low": {
[h: NumDice="NumDice75"]
[h: DieSize="DamageDie75"]
[h: DamageBonus="DamageBonus75"]
[h: Enh=Enhancement]
[h: CritDamageDie="DamageDie75"]
};
case "Normal": {
[h: NumDice="NumDice100"]
[h: DieSize="DamageDie100"]
[h: DamageBonus="DamageBonus100"]
[h: Enh=Enhancement]
[h: CritDamageDie="DamageDie100"]
};
case "High": {
[h: NumDice="NumDice125"]
[h: DieSize="DamageDie125"]
[h: DamageBonus="DamageBonus125"]
[h: Enh=Enhancement]
[h: CritDamageDie="DamageDie125"]
};
case "Very High": {
[h: NumDice="NumDice150"]
[h: DieSize="DamageDie150"]
[h: DamageBonus="DamageBonus150"]
[h: Enh=Enhancement*2]
[h: CritDamageDie="DamageDie150"]
};
case "Extreme": {
[h: NumDice="NumDice175"]
[h: DieSize="DamageDie175"]
[h: DamageBonus="DamageBonus175"]
[h: Enh=Enhancement*2]
[h: CritDamageDie="DamageDie175"]
}
]

[h: AttackBonus=if(DefenseTargeted=='AC','DefaultAttackBonusVsAC','DefaultAttackBonusVsNAD')]

[h: MyCommand=""]
[h: MyCommand=MyCommand+encode("<b>" + MacroName + "</b> " + TargetRange + "<br>\\n")]
[h, if(RequirementIncluded==1): MyCommand=MyCommand+encode("<i>Requirement:</i> "+Requirement+"<br>\\n")]
[h, if(ActionType=="6. Triggered Actions"): MyCommand=MyCommand+encode("<i>Trigger:</i> "+Trigger+"<br>\\n")]
[h, if(PreAttackEffectIncluded==1): MyCommand=MyCommand+encode("<i>Effect:</i> "+PreAttackEffect+"<br>\\n")]

[h, if(AttackRollRequired==1), CODE: {
[h: MyCommand=MyCommand+encode("[h: AttackBonus=" + AttackBonus + " + " + ExtraAttackBonus + "]\\n")]
[h: MyCommand=MyCommand+encode("[h: Defense='"+DefenseTargeted+"']\\n")]
[h: MyCommand=MyCommand+encode("[h: d20roll=d20]\\n")]
[h: MyCommand=MyCommand+encode("[h: Enh="+Enh+"]\\n")]
[h: MyCommand=MyCommand+encode("[h: CritDamageDie="+CritDamageDie+"]\\n\\n")]
[h: MyCommand=MyCommand+encode("[h, if(CritDamageDie > 0), CODE:\\n { [CritBonus=roll(Enh,CritDamageDie)] }; \\n { [CritBonus=0] }\\n ]\\n\\n")]
[h: MyCommand=MyCommand+encode("[h: AttackRoll=d20roll+AttackBonus]\\n")]
}
]
[h, if(DamageRollRequired==1), CODE: {
[h: MyCommand=MyCommand+encode("[h: DamageString='"+HitStringWithDamage+"']\\n")]
[h: MyCommand=MyCommand+encode("[h: NumDice="+NumDice+"]\\n")]
[h: MyCommand=MyCommand+encode("[h: DamageDie="+DieSize+"]\\n")]
[h: MyCommand=MyCommand+encode("[h: DamageBonus="+DamageBonus+"]\\n\\n")]
[h: MyCommand=MyCommand+encode("[h: DamageRoll=roll(NumDice,DamageDie)]\\n")]
[h: MyCommand=MyCommand+encode("[h: NumDice="+NumDice+"]\\n")]
[h: MyCommand=MyCommand+encode("[h: MaxDamage=NumDice*DamageDie+DamageBonus+CritBonus]\\n")]
[h: MyCommand=MyCommand+encode("[h: RegularDamage=DamageRoll+DamageBonus]\\n\\n")]
}
]
[h, if(NumberOfTargets=="Single-Target" && AttackRollRequired==1), CODE: {
[h: MyCommand=MyCommand+encode("<i>Attack:</i> [d20roll] + [AttackBonus] = <b>[AttackRoll]</b> versus [Defense]<br>\\n")]
[h, if(DamageRollRequired==1), CODE: {
[h: MyCommand=MyCommand+encode("[if(d20roll==20), CODE:\\n")]
[h: MyCommand=MyCommand+encode(" {<font color=red>--CRITICAL HIT--</font><br>\\n")]
[h: MyCommand=MyCommand+encode(" <i>Hit:</i> [NumDice*DamageDie] ([NumDice]d[DamageDie]) + [DamageBonus] + [CritBonus] = <b>[MaxDamage]</b> [DamageString]<br>\\n")]
[h: MyCommand=MyCommand+encode(" };\\n")]
[h: MyCommand=MyCommand+encode(" {<i>Hit:</i> [DamageRoll] ([NumDice]d[DamageDie]) + [DamageBonus] = <b>[RegularDamage]</b> [DamageString]<br>}\\n")]
[h: MyCommand=MyCommand+encode("]\\n")]
};
{[h: MyCommand=MyCommand+encode("<i>Hit:</i> "+HitStringNoDamage+"\\n")]
}
]
};{}
]
[h, if(NumberOfTargets=="Multi-Target" && AttackRollRequired==1), CODE: {
[h: MyCommand=MyCommand+encode("[h: x=input('NumberOfTargets|0|Number of targets')]\\n")]
[h: MyCommand=MyCommand+encode("[h: abort(x)]\\n\\n")]
[h: MyCommand=MyCommand+encode("Attacking [NumberOfTargets] [if(NumberOfTargets==1,'target','targets')].<br>\\n")]
[h: MyCommand=MyCommand+encode("[count(NumberOfTargets,'<br>'), CODE: {\\n")]
[h: MyCommand=MyCommand+encode(" [h: d20roll=d20]\\n")]
[h: MyCommand=MyCommand+encode(" [h: AttackRoll=d20roll+AttackBonus]\\n")]
[h: MyCommand=MyCommand+encode(" <i>Target [r:roll.count+1]:</i> [d20roll] + [AttackBonus] = <b>[AttackRoll]</b> versus [Defense]\\n")]
[h, if(DamageRollRequired==1), CODE: {
[h: MyCommand=MyCommand+encode(" [if(d20roll==20), CODE: {<font color=Red> --CRITICAL HIT--</font> [NumDice*DamageDie] ([NumDice]d[DamageDie]) + [DamageBonus] + [CritBonus] = <b>[MaxDamage]</b> [DamageString]};{} ]\\n")]
[h: MyCommand=MyCommand+encode(" }\\n")]
[h: MyCommand=MyCommand+encode("]<br><br>\\n")]
[h: MyCommand=MyCommand+encode("<i>Hit:</i> [DamageRoll] ([NumDice]d[DamageDie]) + [DamageBonus] = <b>[RegularDamage]</b> [DamageString]<br>\\n")]
};
{[h: MyCommand=MyCommand+encode("<i>Hit:</i> "+HitStringNoDamage+"\\n")]
}
]
}
]

[h, if(AttackRollRequired==0&&DamageRollRequired==1): MyCommand=MyCommand+encode("<i>Hit:</i> [DamageRoll] ([NumDice]d[DamageDie]) + [DamageBonus] = <b>[RegularDamage]</b> [DamageString]<br>}\\n")]

[h, if(MissEffectIncluded==1): MyCommand=MyCommand+encode("<i>Miss:</i> "+MissEffect+"<br>\\n")]
[h, if(AftereffectIncluded==1): MyCommand=MyCommand+encode("<i>Aftereffect:</i> "+Aftereffect+"<br>\\n")]
[h, if(PostAttackEffectIncluded==1): MyCommand=MyCommand+encode("<i>Effect:</i> "+PostAttackEffect+"<br>\\n")]
[h, if(SpecialEffectIncluded==1): MyCommand=MyCommand+encode("<i>Special:</i> "+SpecialEffect+"<br>\\n")]
[h, if(AttackRollRequired==0): MyCommand=MyCommand+encode("<i>Effect:</i> "+JustEffect+"<br>\\n")]

[h: FontColor="green"]

[h, if(Usage=="Encounter"), CODE: {
[h: EncountersArray=getProperty("EncounterPowersDeclared")]
[h: FirstEmptyEncounter=-1]
[h, for(i, 9, -1, -1), CODE:
{[h: PowerCheck=json.get(EncountersArray,i)]
[h, if(PowerCheck==0): EncounterPowerNumber=i]
}
]
[h: FontColor="red"]
[h: NewArray=json.set(EncountersArray, EncounterPowerNumber, 1)]
[h: setProperty("EncounterPowersDeclared", NewArray)]
[h: MyCommand=MyCommand+encode("[h: PowerNumber="+EncounterPowerNumber+"]\\n")]
[h: MyCommand=MyCommand+encode("[h: PowersCharged=getProperty('EncounterPowersCharged')]\\n")]
[h: MyCommand=MyCommand+encode("[h: IsPowerAvailable=json.get(PowersCharged,PowerNumber)]\\n\\n")]
[h: MyCommand=MyCommand+encode("[h, if(IsPowerAvailable==0), CODE:\\n")]
[h: MyCommand=MyCommand+encode(" {[assert(1==0,add('This power has already been expended.'),0)]};\\n")]
[h: MyCommand=MyCommand+encode(" {[h: NewArray=json.set(PowersCharged,PowerNumber,0)]\\n")]
[h: MyCommand=MyCommand+encode(" [h: setProperty('EncounterPowersCharged', NewArray)]}]\\n")]
[h: MyCommand=MyCommand+encode("[h: setMacroProps(getMacroButtonIndex(), 'color=darkgray') ]")]
}
]

[h, if(Usage=="Recharge"), CODE: {
[h: RechargeArray=getProperty("RechargePowersDeclared")]
[h: FirstEmptyRecharge=-1]
[h, for(i, 9, -1, -1), CODE:
{[h: PowerCheck=json.get(RechargeArray,i)]
[h, if(PowerCheck==0): RechargePowerNumber=i]
}
]
[h: FontColor="purple"]
[h: NewArray=json.set(RechargeArray, RechargePowerNumber, 1)]
[h: setProperty("RechargePowersDeclared", NewArray)]
[h: MyCommand=MyCommand+encode("[h: RechargeTarget="+RechargeTarget+"]\\n")]
[h: MyCommand=MyCommand+encode("[h: RechargeRoll=d6]\\n")]
[h: MyCommand=MyCommand+encode("[h: PowerNumber="+RechargePowerNumber+"]\\n")]
[h: MyCommand=MyCommand+encode("[h: PowersCharged=getProperty('RechargePowersCharged')]\\n")]
[h: MyCommand=MyCommand+encode("[h: IsPowerAvailable=json.get(PowersCharged,PowerNumber)]\\n\\n")]
[h: MyCommand=MyCommand+encode("[h, if(IsPowerAvailable==0 && RechargeRoll<RechargeTarget), CODE:\\n")]
[h: MyCommand=MyCommand+encode(" {[g: assert(1==0,add('Recharge roll = ', RechargeRoll, '. The power fails to recharge.'),0)]};\\n")]
[h: MyCommand=MyCommand+encode(" {[h: NewArray=json.set(PowersCharged,PowerNumber,0)]\\n")]
[h: MyCommand=MyCommand+encode(" [h: setProperty('RechargePowersCharged', NewArray)]}]\\n")]
[h: MyCommand=MyCommand+encode("[h: setMacroProps(getMacroButtonIndex(), 'color=gray') ]")]
}
]

[h, if(Usage=="Not Applicable"): FontColor="black"]

[h: MacroProps='{"autoexecute":1, "label":"'+MacroName+" "+TargetRange+'", "group":"'+ActionType+'", "sortBy":'+SortOrder+', "fontColor":"'+FontColor+'", "command":"'+decode(MyCommand)+'"}']
[h: createMacro(MacroProps)]
at java.util.prefs.AbstractPreferences.put(Unknown Source)
at net.rptools.maptool.client.ui.macrobuttons.buttons.MacroButtonPrefs.savePreferences(MacroButtonPrefs.java:69)
at net.rptools.maptool.model.MacroButtonProperties.save(MacroButtonProperties.java:301)
at net.rptools.maptool.model.MacroButtonProperties.<init>(MacroButtonProperties.java:185)
at net.rptools.maptool.client.ui.macrobuttons.buttongroups.ButtonGroupPopupMenu$ImportMacroAction$1.run(ButtonGroupPopupMenu.java:176)
at java.awt.event.InvocationEvent.dispatch(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at net.rptools.maptool.client.swing.MapToolEventQueue.dispatchEvent(MapToolEventQueue.java:38)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)

I thought it had added as a file, guess word doesn't cooperate with the forum :roll: . Anyway, here is the error log, sorry 'bout that.
Last edited by TheShadow on Tue Mar 25, 2014 2:48 pm, edited 1 time in total.

User avatar
aliasmask
RPTools Team
Posts: 9031
Joined: Tue Nov 10, 2009 6:11 pm
Location: California

Re: "To long" error

Post by aliasmask »

Without looking too closely, my first guess is you're putting a value in to a field that is too long. For example, the macroName (label) could be too many characters. Something that could do that is a quote that wasn't converted to an html entity. I don't know if that is the case, but I do think it may be related to the data you're entering and the macro not being able to account for it. So, what happens is things run out of bounds. Also, do you get the error running the macro (so no output at all) or when you submit your data?

If you could post the data you were trying to use to create the power, then that would help.

TheShadow
Kobold
Posts: 12
Joined: Wed Mar 19, 2014 9:43 pm

Re: "To long" error

Post by TheShadow »

No, it's not after I enter data. If i just click it, it just says error in chat, but when i click to edit it, it doesn't let me click OK to get out of it

Lee
Dragon
Posts: 958
Joined: Wed Oct 19, 2011 2:07 am

Re: "To long" error

Post by Lee »

Just passing by for a quick guess.

Judging by the error message, you're trying to create a global macro and your OS is Windows, correct? There's a character limit to the registry, where global macros, and other MapTool preferences are stored.

You have 2 options: The first is to create the macros elsewhere as all the other locations do not save to the registry. The 2nd is to wait for Mote, our MapTool fork, to become public. We have transferred all preferences to external file configurations which, in the case of global macros, eliminates the imposed character limit.

User avatar
Full Bleed
Demigod
Posts: 4736
Joined: Sun Feb 25, 2007 11:53 am
Location: FL

Re: "To long" error

Post by Full Bleed »

Lee wrote:Judging by the error message, you're trying to create a global macro and your OS is Windows, correct? There's a character limit to the registry, where global macros, and other MapTool preferences are stored.

You have 2 options: The first is to create the macros elsewhere as all the other locations do not save to the registry.
Interesting... I'm sure I've used bigger lists, but I don't use global macros so I've never seen this.

You could try making the listActionTypes list smaller just to see if it would run with a smaller value:

Code: Select all

[h: listActionTypes = "2. Traits, 3. Standard, 4. Move, 5. Minor, 6. Triggered"]
Or even smaller:

Code: Select all

[h: listActionTypes = "Traits, Standard, Move, Minor, Triggered"]

BTW, this should not be in the "bug reports" section.
Maptool is the Millennium Falcon of VTT's -- "She may not look like much, but she's got it where it counts."


TheShadow
Kobold
Posts: 12
Joined: Wed Mar 19, 2014 9:43 pm

Re: "To long" error

Post by TheShadow »

Lee wrote:Judging by the error message, you're trying to create a global macro and your OS is Windows, correct? There's a character limit to the registry, where global macros, and other MapTool preferences are stored.

You have 2 options: The first is to create the macros elsewhere as all the other locations do not save to the registry. The 2nd is to wait for Mote, our MapTool fork, to become public. We have transferred all preferences to external file configurations which, in the case of global macros, eliminates the imposed character limit.
Okay, I moved it to campaign and it worked, Thanks. There is something wrong with the coding and I give up on it. For anyone that wants to post links to good Attack Creating Macros, go ahead (Everyone needs them). :lol:

Post Reply

Return to “Macros”