Senior Member
Join Date: Mar 2007
Location: Muskegon, MI
Posts: 2,975
|
I've running script on a template that gets rid of some natural attacks and breath weapons (and any other mouth based specials) and I made a large foreach loop to get through the ~40 breath weapons in the editor. The problem is it seems my loop is crashing Hero Lab so I'm looking for suggestions to make it not crash.
Post-Levels/10000 Code:
var tentacles as number var tentstr as string foreach pick in hero from BaseNatWep where "thingid.wBite|thingid.wGore|thingid.wHeadButt" perform eachpick.assign[Hide.Weapon] tentacles += 1 nexteach ~foreach pick in hero from Ability where "thingid.raBraBreaW|thingid.raBreaWeap|thingid.raBreath|thingid.raCaiBreaW|thingid.raCalBreaW|thingid.raChiBreaW|thingid.raCloBreaW|thingid.raCraBreaW|thingid.raDraBreaW|thingid.raFaeBreaW|thingid.raFafBreaW|thingid.raFjoBreaW|thingid.raGorBreaW|thingid.raIceBreaW|thingid.raIroBreaW|thingid.raJyoBreaW|thingid.raKhaBrea|thingid.raRPDraBre|thingid.raRavBret|thingid.raSpiBreaW|thingid.raTaiBreaW|thingid.raTarBreaW|thingid.raTorBreaW|thingid.raUmbBreaW|thingid.raVemBreaW|thingid.raWyBreath|thingid.xAirMeBrth|thingid.xDustMeBrth|thingid.xEarMeBrth|thingid.xFirMeBrth|thingid.xHDBreath|thingid.xlcMeBrth|thingid.xOozMeBrth|thingid.xSalMeBrth|thingid.xSteMeBrth|thingid.xWatMeBrth" ~ perform eachpick.assign[Helper.SpcDisable] ~ perform eachpick.assign[Helper.SpcReplace] ~ tentacles += 1 ~nexteach tentacles += hero.child[wTentacle].tagvalue[Value.?] tentstr = "Value." & tentacles perform hero.child[wTentacle].delete[Value.?] perform hero.child[wTentacle].assignstr[tentstr] |
#1 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,217
|
Multiple foreaches, each handling some of them.
|
#2 |
Senior Member
Join Date: Mar 2007
Location: Muskegon, MI
Posts: 2,975
|
Guess its simpler than I thought, is there a suggested number of items that should be the limit in a foreach loop?
|
#3 |
Senior Member
Lone Wolf Staff
Join Date: May 2005
Posts: 13,217
|
Sorry, I'm not sure what the limit actually is.
|
#4 |
Senior Member
Join Date: Mar 2007
Location: Muskegon, MI
Posts: 2,975
|
Ok, I'll just play around with it.
|
#5 |
Senior Member
Join Date: Mar 2007
Location: Muskegon, MI
Posts: 2,975
|
Looks like the answer is about 7 to 8
|
#6 |
|
|