DICE PACKS BUNDLE
Page 11 of 11 First ... 91011
  1. #101

  2. #102
    Quote Originally Posted by damned View Post
    You either do an onValueChanged() on the Red value or you put some DB.addHandler() in the mix.
    Thank you for the tip.

    I dug a little bit more so I can explain the challenge a bit better.
    I'm used to using onValueChanged() in my scripts. But I can't find a proper way to find the path to each "strength_bonus" to use with onValueChanged().

    The trouble here is that the value of strength bonus is in each line of the list.
    I think that the path (for my setup) would be

    nodeWin.getChild("weaponlist").getChild("id-0000X").getChild("strength_bonus")();

    Now, each line of the list has an id, which I need to go through.

    I.E. I have three weapons in the list, that means I have to go through id-00001, id-00002 and id-00003 and find the "strength_bonus" in each and update that.

  3. #103
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,638
    Blog Entries
    1
    You will need to use a

    for loop

    You will do something like

    for k, v in pairs

    You will need to post more code so we can try and suggest the right syntax to use

  4. #104
    Okey, I will try to post what I've found

    Code:
    function sbonus()
    local nodeWin = window.getDatabaseNode();
    local nS = nodeWin.getChild("totS").getValue();
    
    local nSB = math.floor(nS/10)
    
    local test = nodeWin.getChild("weaponlist");
    
    for _,v in pairs(test.getChildren()) do
            v.strength_bonus.setValue(nSB);
            end
    
    end
    Does this make any sense? It certainly doesn't work.

    I think the path is nodeWin.weaponlist.id-0000X.strength_bonus.

    where x = the listnumber in the weaponlist.

  5. #105
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,638
    Blog Entries
    1
    I km not near my computer but first start with debug statements

    Debug.chat(nodeWin)
    Debug.chat(nS)
    Debug.chat(test)
    Debug.chat(v)

  6. #106
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,638
    Blog Entries
    1
    Assuming test is valid then this should work:

    Code:
    	for k,v in pairs (test.getChildren())
    		v.getChild("strength_bonus").setValue(nSB));
    	end

  7. #107
    Quote Originally Posted by damned View Post
    Assuming test is valid then this should work:

    Code:
    	for k,v in pairs (test.getChildren())
    		v.getChild("strength_bonus").setValue(nSB));
    	end
    Thank you! I will try this when I get home from work, and get back to you.

  8. #108
    Haha! That worked perfectly! Thank you very much damned!

    One step closer

  9. #109

  10. #110
    goodmanje's Avatar
    Join Date
    Aug 2016
    Location
    Greenville, Tx
    Posts
    507
    I ended up just buying Foundry.... They have an official ruleset that works well. I'd much rather play in FG but I don't think there is any interest in making an official ruleset.

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