Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Savage Worlds (http://forums.wolflair.com/forumdisplay.php?f=59)
-   -   Coding Help (http://forums.wolflair.com/showthread.php?t=57627)

whtknt February 5th, 2017 08:48 PM

Coding Help
 
If I can solve two more conundrums, I can offer the Ultimate Characters Guide (Mystical Throne Entertainment) dataset. One of them is just a matter of doing the work (I'm lazy). The other is below:

I need an Edge to check for a Knowledge skill. Not a particular Knowledge skill, just to see if there is a Knowledge skill at d8 present. Below is the code I have now, but it doesn't work. The dataset will load, but the program invalidates the Knowledge requirement, even if the character has it.

foreach pick in hero where "thingid.skKnow"
if (eachpick.field[trtFinal].value >= 4) then
endif
nexteach
if (@ispick <> 0) then
altpick.linkvalid = 0
endif

zarlor 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.

whtknt February 6th, 2017 03:02 PM

Okay, I see (I think). Thanks!

SeeleyOne February 6th, 2017 05:26 PM

I usually put a ? at the end of know as it is a wildcard.

Nevermind, I forgot that people still type in the knowledge skills in the core set. I have been using my modded version for so long that I forgot that people do not. All that you need to do is reference the Knowledge skill itself.


All times are GMT -8. The time now is 07:08 AM.

Powered by vBulletin® - Copyright ©2000 - 2020, vBulletin Solutions, Inc.
wolflair.com copyright 1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.