-
November 17th, 2018, 22:12 #21
Current thought is to let the drag contain custom-data. Specificaly a number telling which part of the matrix was dropped. Then when the onMatrixUpdate triggers it goes in a loop over all the entries and uses a case to drop the proper value. Should be fairly fast at the least.
- Obe
-
November 17th, 2018, 22:33 #22
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
I would probably just use a custom drag type; and pass the value you need for the technique/form field. Easier to handle the drag field set. But, that’s just details that can be handled different ways. I think you’re on right track now.
Regards,
JPG
-
November 20th, 2018, 08:21 #23
That seems to be what does the trick best for me. Far easier to push change down-stream than pulling it from upstream.
Many thanks for the help.
- Obe
-
November 24th, 2018, 21:06 #24
I spoke to soon it seems. I have been wrestling with how to find the windowlist (named spelllist) so I can then go over it with a for k,v in ipairs( "The heck do I put here") and find the v.getChild("forms") and set it to the combined name and v.getChild("castingtotal").setValue() to the matrix-value.
... I am frustrated by my inability to do this to say the least. It has been some ages since I had to do it last and I can not for the life of me figure it out.
- Obe
-
November 24th, 2018, 22:19 #25
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
I would probably do something like this from the windowclass level script for the character spell tab window:
Code:function onMatrixChanged() for _,w in ipairs(spelllist.getWindows()) do w.updateSpellCastTotal(); end end
Code:function updateSpellCastTotal() local nNewCastingTotal = <Calculation>; catingtotal.setValue(nNewCastingTotal); end
The windowlist.getWindows() API returns a table with numeric keys pointing to each window instance.
Regards,
JPG
-
November 25th, 2018, 05:36 #26
Made a clunky proof of concept that now updates any spell using the forms of "CreoAnimal" on the character-sheet.
Code:function onValueChanged() local a = getValue(); b = getName(); for _,w in ipairs(window.spelllist.getWindows()) do local d = w.name.getValue() .. " form : " .. w.forms.getValue() .. " " .. w.castingtotal.getValue(); local form = w.forms.getValue(); if form == b then w.castingtotal.setValue(a); end print(d); end end
/Obe
-
November 26th, 2018, 22:17 #27
Supreme Deity
- Join Date
- Mar 2007
- Posts
- 20,561
I'd probably simply a bit:
In individual matrix field scripts:
Code:function onValueChanged() window.onMatrixChanged(getName(), getValue()); end
Code:function onMatrixChanged(sForm, nValue) for _,w in ipairs(spelllist.getWindows()) do if w.forms.getValue() == sForm then w.castingtotal.setValue(nValue); end end end
JPG
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks