Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - User Projects

Notices

Reply
 
Thread Tools Display Modes
RavenX
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2011
Location: Nowhere, Virginia
Posts: 3,633

Old June 19th, 2022, 04:00 PM
I am trying to make a script that adds one to the count for an advance only if the advance has a cost of 4 xp. I'd like for the iteration to ignore advances in the count if it has a cost other than 4xp. Ultimately, once the code is counting correctly I will divide it by 4 and round up so the advance applies to the level it was attained at.

Here is the code I came up with.
For some reason it's still counting the advances that cost less than 4 xp and I want it to not do that. How could I fix the code? Ideas?


Code:
      doneif (field[advCost].value <> 4)

      if (tagis[AdvanceCat.Advancement] <> 0) then

          var advcount as number
          var advcur as number
          var i as number

          advcur = field[advOrder].value
          for i = 1 to advcur
            if (field[advCost].value = 4) then
              advcount += 1 
              endif
            next

            field[advCount].value = advcount 
            advcount /= 4
            advcount = round(advcount,0,1)


        endif

RavenX Pronouns: She/Her

Please do not PM me to inquire about datafiles I coded "for personal use" such as Exalted, World of Darkness, AD&D, or Warhammer 40K Roleplaying. I appreciate your interest, but I do not own the Intellectual Property rights to these game systems. Nor do I have permission from any of the Publishers to distribute the data files. As such, I cannot distribute the work I have done with community on these files. They are "for personal use" only. Thank you.

I am far too busy these days to answer emails. If you message me here there is no guarantee I will get back to you at all.
RavenX is offline   #1 Reply With Quote
RavenX
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2011
Location: Nowhere, Virginia
Posts: 3,633

Old June 19th, 2022, 05:16 PM
Attached you will see the error issue, it's counting an iteration when the tag I am looking for is not present. In the source code its looking for a fieldval equal to 4 for a specific field but I tried it with a tag and it still gives me the error. How can I get it to not count those when running the iterative script?
Attached Images
File Type: jpg Advances and tier counting error.jpg (133.5 KB, 3 views)

RavenX Pronouns: She/Her

Please do not PM me to inquire about datafiles I coded "for personal use" such as Exalted, World of Darkness, AD&D, or Warhammer 40K Roleplaying. I appreciate your interest, but I do not own the Intellectual Property rights to these game systems. Nor do I have permission from any of the Publishers to distribute the data files. As such, I cannot distribute the work I have done with community on these files. They are "for personal use" only. Thank you.

I am far too busy these days to answer emails. If you message me here there is no guarantee I will get back to you at all.
RavenX is offline   #2 Reply With Quote
RavenX
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2011
Location: Nowhere, Virginia
Posts: 3,633

Old June 19th, 2022, 05:33 PM
I just tried doing it like this thinking it would go through each of the items in advances and pick off a count for only certain ones but it seems to not work like I intended.

Code:
      doneif (field[advCost].value <> 4)

      if (tagis[AdvanceCat.Advancement] <> 0) then

          var advcount as number
          var advcur as number
          var i as number

          advcur = field[advOrder].value
 
            i = 1
            foreach pick in hero from Advance where "AdvanceCat.Advancement"
              while (i <= field[advOrder].value)
                if (eachpick.field[advCost].value = 4) then
                  advcount += 1
                  endif
                i += 1
                loop
              nexteach

            field[advCount].value = advcount 
            advcount /= 4
            advcount = round(advcount,0,1)

          endif

RavenX Pronouns: She/Her

Please do not PM me to inquire about datafiles I coded "for personal use" such as Exalted, World of Darkness, AD&D, or Warhammer 40K Roleplaying. I appreciate your interest, but I do not own the Intellectual Property rights to these game systems. Nor do I have permission from any of the Publishers to distribute the data files. As such, I cannot distribute the work I have done with community on these files. They are "for personal use" only. Thank you.

I am far too busy these days to answer emails. If you message me here there is no guarantee I will get back to you at all.
RavenX is offline   #3 Reply With Quote
ploturo
Member
 
Join Date: May 2021
Posts: 84

Old June 19th, 2022, 06:59 PM
What is this part of the script supposed to be doing?

Code:
          advcur = field[advOrder].value
          for i = 1 to advcur
            if (field[advCost].value = 4) then
              advcount += 1 
              endif
            next
It is checking the same field on the same pick over and over again, so advCount will either be 0 (if field[advCost] isn't 4) or advcur (if field[advCost] is 4)?
ploturo is offline   #4 Reply With Quote
RavenX
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2011
Location: Nowhere, Virginia
Posts: 3,633

Old June 21st, 2022, 08:11 PM
Quote:
Originally Posted by ploturo View Post
What is this part of the script supposed to be doing?

Code:
          advcur = field[advOrder].value
          for i = 1 to advcur
            if (field[advCost].value = 4) then
              advcount += 1 
              endif
            next
It is checking the same field on the same pick over and over again, so advCount will either be 0 (if field[advCost] isn't 4) or advcur (if field[advCost] is 4)?
For each of the picks, I wanted it to cycle through the previous picks and determine if the cost field or tag was present, then increment the field. If the advancement costs 4 xp, increment the field. The idea was for the script to cycle through all the picks and increment only for the ones that meet the 4 xp requirement.

If the pick has an advOrder field of 3, it should count picks from 1 to 3 and increment only if the pick has an xp value of 4 xp.

RavenX Pronouns: She/Her

Please do not PM me to inquire about datafiles I coded "for personal use" such as Exalted, World of Darkness, AD&D, or Warhammer 40K Roleplaying. I appreciate your interest, but I do not own the Intellectual Property rights to these game systems. Nor do I have permission from any of the Publishers to distribute the data files. As such, I cannot distribute the work I have done with community on these files. They are "for personal use" only. Thank you.

I am far too busy these days to answer emails. If you message me here there is no guarantee I will get back to you at all.
RavenX is offline   #5 Reply With Quote
RavenX
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2011
Location: Nowhere, Virginia
Posts: 3,633

Old June 21st, 2022, 08:22 PM
I think I found a work around for it.

Code:
    <!-- If we're a character advancement, lock us into the first available slot on the advances array  -->
    <eval index="8" phase="Final" priority="8000" name="Assign To Table"><![CDATA[
      doneif (tagis[AdvanceCat.Advancement] = 0) 
      var i as number

      for i=0 to 23
        if (empty(herofield[acXPAdvTier].arraytext[i]) <> 0) then
          herofield[acXPAdvTier].arraytext[i] = field[name].text
          field[advCount].value = i
          done
          endif
        next



      ]]></eval>

    <!-- If we're an advancement that uses a tier slot, we have a text to display -->
    <eval index="9" phase="Render" priority="8500" name="Assign Advance Tier Count"><![CDATA[
      if (tagis[AdvanceCat.Advancement] <> 0) then
        field[advCount].value += 1
        field[advTier].value = field[advCount].value
        endif
      ]]></eval>

    <!-- If we're an advancement that uses a tier slot, we have a text to display -->
    <eval index="10" phase="Render" priority="10000" name="Assign Tier Advance"><![CDATA[
      if (tagis[AdvanceCat.Advancement] <> 0) then
        if (tagis[Advance.LongTerm] <> 0) then
          field[advTierTxt].text &= "Tier " & field[advTier].value
          endif
        endif
      ]]></eval>
Doing it this way the numbers are coming out correctly, though I had to force feed them into an array... consequently I think I figured out how skills get modifiers in arrays with this bit of coding though...

RavenX Pronouns: She/Her

Please do not PM me to inquire about datafiles I coded "for personal use" such as Exalted, World of Darkness, AD&D, or Warhammer 40K Roleplaying. I appreciate your interest, but I do not own the Intellectual Property rights to these game systems. Nor do I have permission from any of the Publishers to distribute the data files. As such, I cannot distribute the work I have done with community on these files. They are "for personal use" only. Thank you.

I am far too busy these days to answer emails. If you message me here there is no guarantee I will get back to you at all.
RavenX is offline   #6 Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 12:02 AM.


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