Thread: Coding Help
View Single Post
zarlor
Senior Member
 
Join Date: Nov 2010
Location: Metairie, LA, USA
Posts: 1,814

Old February 6th, 2017, 02:06 PM
What about:
Code:
foreach pick in hero where "thingid.skKnow"
   validif (eachpick.field[trtFinal].value >= 4)
nexteach
Since the foreach is going to loop through every Knowledge skill you won't really need an if loop in there as well. Your original code goes through each Knowledge skill, checks if it's >=4 (d8 or greater) then does nothing, just goes to the next pick and checks again doing nothing. So you've not made anything "valid" it's just "If this thing then end and do the next line with is 'nexteach', so it that sends it back to the top, the 'foreach' in this case, and just picks the next thing to look at."

The next little if loop is just an error trap that doesn't make anything valid, either. In fact it makes sure that if nothing valid was found that the value of "altpick.linvalid" is set to 0, so NOT valid. It's ensures it's not valid if nothing valid was found which is probably not needed in this case but in a case where you might have needed more than one thing to be valid it's probably useful to make sure that only when all of those multiple things were valid would a true valid state slip through, if I read that right.

Lenny Zimmermann
Metairie, LA, USA

Data files authored (please let me know if you see any issues with any of these if you have/use them):
Official (In the downloader)
50 Fathoms, Deadlands: Hell On Earth, Deadlands: Noir, East Texas University, Necessary Evil (requires Super Powers Companion), Pirates of the Spanish Main, Space 1889 (original file by Erich), Tour of Darkness, Weird War II, Weird Wars: Rome
Coming Eventually
Evernight (LWD has completed their review but I have some fixes to make first... although Pinnacle mentioned this might get an overhaul to SWADE so I may just wait for that first. If you just HAVE to have this now, though, just PM me)
zarlor is offline   #2 Reply With Quote