PDA

View Full Version : Get General Node



statik37
October 29th, 2019, 15:50
I am trying to call a generalized node. For example in my character sheet main XML file:



<basicnumber name="skill_acrobatics_foc" source="skills.acrobatics.foc">
<anchored to="skill_acrobatics_exp" position="right" offset="9,0" width="15" />
<nodrag />
<nodrop />
<default>0</default>
<min>-5</min>
<max>5</max>
<tabtarget>
<next>skill_acrobatics_exp</next>
<prev>skill_melee_exp</prev>
</tabtarget>
</basicnumber>
<basicnumber name="skill_acrobatics_tn" source="skills.acrobatics.tn">
<anchored to="skill_acrobatics_foc" position="right" offset="9,0" width="20" />
<nodrag />
<nodrop />
<noreset />
<nokeyedit />
<rollable/>
<script>
function onDoubleClick(x,y)
Library.taskcheck(dragInfo, window)
end
</script>
</basicnumber>


In Library.taskcheck, so far I have:



function taskcheck(draginfo, winFrame)
local nodeWin = winFrame.getDatabaseNode();
local node = DB.findNode(".");
local rActor = ActorManager.getActor("pc", nodeWin);
local rolling20 = DB.getValue(node, "curdie.curr");
local sides = 20;
local TN = DB.getValue(node, "TN");
local FC = ????

I want to be able to set FC to the node of this specific skill (acrobatics.foc), but I want to be able to use this function for all the skills. (Acrobatics, melee, etc.). How do I call that node, based on where the function derives from?

They are all setup the same skills.SKILL.foc. I tried setting up a source tag and in the lua file doing:



if source and source[1] then
FC = "skills." .. source[1] .. ".foc";
end


But that get returned as nil.

I threw a debug command into the if statement to see what it would generate, and it's not even running the if statement.

Moon Wizard
October 30th, 2019, 05:40
I'm not sure exactly what you are doing, so I'm completely guessing as to what your code should look like. There's not much context. Perhaps something like this:



function onDoubleClick(x,y)
Library.taskcheck(dragInfo, window, getValue())
end




function taskcheck(draginfo, winFrame, nSkillValue)
local nodeWin = winFrame.getDatabaseNode();
local rActor = ActorManager.getActor("pc", nodeWin);
local rolling20 = DB.getValue("curdie.curr");
local sides = 20;
local TN = DB.getValue(node, "TN");
local FC = nSkillValue;
...


Regards,
JPG