Okay I got it sort of working.
I was missing the linkage[basis] in the first incarnation of the code.
This gets the proper values, sort of.
If I add another advancement for the same skill both advancements get the latest skill value and cost out at that new value.
So if I go from not having the skill to having it costs correctly at 1 point.
As soon as I add the second advancement it costs 4, 2 for each. instead of 3. 1 and 2 respectively.
Code:
perform gizmo.findchild[none,"Advance.Gizmo"].setfocus
doneif (state.isfocus = 0)
perform focus.linkage[basis].setfocus
if (focus.tagis[Skill.?] <> 0) then
var value as number
value = focus.field[trtBonus].value
if (focus.tagis[User.Combat] = 0) then
var resLeft as number
resLeft = #resmax[resAdvNCSP] - #resspent[resAdvNCSP]
if (resLeft >= value) then
#resspent[resAdvNCSP] += value
elseif (resLeft > 0) then
#resspent[resAdvSP] += value - resLeft
#resspent[resAdvNCSP] += resLeft
else
#resspent[resAdvSP] += value
endif
else
#resspent[resAdvSP] += value
endif
endif