Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Pathfinder Roleplaying Game (http://forums.wolflair.com/forumdisplay.php?f=62)
-   -   VMC Witch Remake (http://forums.wolflair.com/showthread.php?t=67672)

Mediator9292 March 6th, 2023 01:39 PM

VMC Witch Remake
 
O Great and Powerful Gods of Code, I beseech thee for guidance on my novice attempt at redesigning the Variant Multiclass Witch (Secondary Class tab in the Editor). My goal to make the VMC Witch a bit more meaningful, since it seems an order of magnitude less powerful than most of the other VMCs. Here's what I had outlined, but calling it the 'Wiccan' so I don't have to deal with replacing a file entirely.
Patron: At 1st level, she chooses a patron.
Familiar: At 3rd level, she gains a familiar, treating her character level as her effective witch level.
Hex: At 7th level, she gains a hex of her choice, treating her effective witch level as half her character level.
Hex: At 11th level, she gains a second hex, treating her effective witch level as half her character level.
Improved Hexes: At 15th level, she gains a third hex, treating her effective witch level as her character level for all hexes.
Major Hex: At 19th level, she gains a major hex.

This mostly involved using the same code as the original VMC Witch, but the complicated part now involves the eval script for determining the effective witch level regarding the hexes at different levels - below is my current attempt, run during the Post-levels Phase, Priority 151, with the Timing's Before Script set as Incorporate xEffectLev

var mod as number
foreach pick in hero from BaseCustSp where "CustTaken.csWitch"
if (eachpick.field[custOrder].value = 1) then
if (field[cTotalLev].value >= 15) then
mod = field[cTotalLev].value
else
mod = round(field[cTotalLev].value/2,0,1)
endif
elseif (eachpick.field[custOrder].value = 2) then
if (field[cTotalLev].value >= 15) then
mod = field[cTotalLev].value
else
mod = round(field[cTotalLev].value/2,0,1)
endif
elseif (eachpick.field[custOrder].value = 3) then
mod = field[cTotalLev].value
endif
elseif (eachpick.field[custOrder].value = 4) then *(line with error)*
mod = field[cTotalLev].value
endif
eachpick.field[xEffectLev].value += mod
nexteach

The issue I'm running into is that for some reason that I can't solve, HL keeps hitting this error:
Syntax error in 'eval' script for Thing 'csWiccan' (Eval Script '#1') on line 18
-> Encountered a mismatched 'if' and/or 'while' statement context
Can anybody help me figure out why the syntax is wrong? It follows exactly the same syntax and goal as line 15, so I'm at a loss, since I'm not a programmer and can't actually speak XML...

Mathias March 6th, 2023 01:59 PM

My usual trick for this sort of thing is to count "if" statements as +1, and endif as -1, and then you figure out why your total is not 0 at the end. (elseif and else are +0). Also, if you ever go negative along the way, right there is your error, because every if must be closed by an endif, so there will never be more endifs than ifs.

Indentation also helps a lot - in this forum, in the advanced mode, there's a code option you can encapsulate all the code in, and then it'll preserve the indentation. That's really helpful for matching the if statements with the endifs that stop them.

Mathias March 6th, 2023 02:00 PM

Code:

var mod as number
foreach pick in hero from BaseCustSp where "CustTaken.csWitch"
  if (eachpick.field[custOrder].value = 1) then
    if (field[cTotalLev].value >= 15) then
      mod = field[cTotalLev].value
    else
      mod = round(field[cTotalLev].value/2,0,1)
      endif
  elseif (eachpick.field[custOrder].value = 2) then
    if (field[cTotalLev].value >= 15) then
      mod = field[cTotalLev].value
    else
      mod = round(field[cTotalLev].value/2,0,1)
      endif
  elseif (eachpick.field[custOrder].value = 3) then
    mod = field[cTotalLev].value
    endif
  elseif (eachpick.field[custOrder].value = 4) then    *(line with error)*
    mod = field[cTotalLev].value
    endif
  eachpick.field[xEffectLev].value += mod
  nexteach


Mathias March 6th, 2023 02:01 PM

There's your code shown with indentations - watch where the endifs are - are they ending the block of tests you expect them to end?

Mediator9292 March 6th, 2023 04:44 PM

That was an extremely well-crafted lesson that I was able to understand and utilize with minimal effort - you are truly one of the greatest Gods of this realm, O Mathias!

However, now that this code has completed the Test Now Gauntlet, we face a new series of challenges. Upon selection of 'Wiccan' as a VMC, the following error message appears:
Code:

Invalid tag expression specified for 'foreach' statement
Location: 'eval' script for Component 'Class' (Eval Script 'Calc cSpecial') near line 261
- - -
Agent pick is referenced by template 'cTitle', but no agent pick is defined
- - -
Agent pick is referenced by template 'clsInfo', but no agent pick is defined
- - -
Agent pick is referenced by template 'clsTurn', but no agent pick is defined
- - -
Agent pick is referenced by template 'cHelpStats', but no agent pick is defined
- - -
Agent pick is referenced by template 'powerinfo', but no agent pick is defined
- - -
Agent pick is referenced by template 'spellinfo', but no agent pick is defined

Any advice on where to start?

Mathias March 6th, 2023 09:38 PM

The Test Now! button is lightweight and can't handle everything. In the develop menu, back in the main HL, make sure enable data file debugging is turned on, and then you can use quick-reload from that menu.



If that's not it, there may also be some extra steps I'm not remembering - it's been years since I've worked with VMCs and I'll need time to study them, and this week's not great for that.

Mediator9292 March 8th, 2023 11:00 AM

I noticed that if I fill in the 'Replaces Thing Id' with csWitch, then the error messages disappear! The big problem is then that in addition to creating a fully-functional 'Wiccan' VMC tab, it also creates a dead 'Witch' VMC tab, and softly cries out that I have 'Too many secondary classes added!'

This isn't a big problem in and of itself, but a host of hard-to-miss inconsistencies begin to pop up, namely that it calculates *most of the class DCs and all of the 'x per level' abilities as if the witch levels were double what they actually are, suggesting that it is counting both tabs as equal levels in witch. This also grants 'legal' access to Major Hexes earlier, and Grand Hexes, which aren't even supposed to be an option. I suppose this isn't a major problem that can't be overcome with a few Adjustments on the character sheet, but it's still something I'd like to fix if possible!

Mathias March 8th, 2023 11:58 AM

Replacements have some major limitations, and you've encountered the big one - things that depend on counting tags get doubled when you create a replacement, because the replacement has the original identity tags and the new identity tags - the custom tabs get doubled, too - one for each.

We never use replacements for our internal code, so setting up the code to work properly with a replacement is not usually part of our process.

In order to help, I need to know what the error messages are. HL's pop-up error messages can be right-clicked and copied, so you can paste them here.


All times are GMT -8. The time now is 01:46 AM.

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