DICE PACKS BUNDLE
Page 3 of 3 First 123
  1. #21
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,620
    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
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  2. #22
    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

  3. #23
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,620
    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
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  4. #24
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,620
    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
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  5. #25
    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
    And something like this from the windowclass level script for the individual spells:
    Code:
    function updateSpellCastTotal()
        local nNewCastingTotal = <Calculation>;
        catingtotal.setValue(nNewCastingTotal);
    end
    In Lua, the pairs() construct will allow you to iterate over all key/value pairs in a table, but order is not guaranteed. The ipairs() construct will allow you to iterate (in order) over key/value pairs with numeric keys that start at 1; but will ignore non-numeric keys and will stop at any gaps. (i.e. if table has keys of 1, 2 and 4; then only 1 and 2 will be iterated over.)

    The windowlist.getWindows() API returns a table with numeric keys pointing to each window instance.

    Regards,
    JPG

  6. #26
    Oberoten's Avatar
    Join Date
    May 2006
    Location
    Älvsbyn, Sweden
    Posts
    2,620
    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
    Many thanks for all the help Jpg. It has been valuable to save my sanity. (Such as sanity is for a beholder to begin with)

    /Obe
    For your Ars Magica needs :
    https://fgrepository.com




    Atque in perpetuum frater, Ave atque vale.

  7. #27
    I'd probably simply a bit:

    In individual matrix field scripts:
    Code:
    function onValueChanged()
        window.onMatrixChanged(getName(), getValue());
    end
    In spell tab window script:
    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
    Cheers,
    JPG

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
5E Product Walkthrough Playlist

Log in

Log in