Page 2 of 2 First 12
  1. #11
    Quote Originally Posted by Moon Wizard View Post
    How are you getting a node with no path? Was it deleted during the script?

    JPG
    The processEffects() calls processEffect() for each effect. ProcessEffect runs the "DMGO" effect and because I removed the effect in the processing of the DMGO if the PC died in manager_action_damage.lua when the processEffect() continued trying to use the effect it would bomb.

    I ended up not removing the effect because of all the hackery I had to do to make it work... I did get it working it just seemed a bit over the top and I really dont want to override CoreRPG unless I have to...
    Last edited by celestian; June 1st, 2019 at 06:15.
    ---
    DM/Play: AD&D (any flavor)
    Coding the Official AD&D Ruleset

  2. #12
    Sorry if this was already addressed, but can you not do:

    if not next(databasenode) then
    Debug.console('Table is Empty')
    else
    Debug.console('Table is not Empty')
    end

  3. #13
    Quote Originally Posted by celestian View Post
    I had actually tried that (tho I wasn't hopeful) and the error when trying that was....

    Code:
    Runtime Notice: Reloading ruleset
    Script Error: [string "scripts/manager_effect_adnd.lua"]:564: bad argument #1 to 'next' (table expected, got userdata)
    The type() of the variable is databasenode so I am pretty sure that's why it barfed.
    ...

    Quote Originally Posted by scleavelin View Post
    Sorry if this was already addressed, but can you not do:

    if not next(databasenode) then
    Debug.console('Table is Empty')
    else
    Debug.console('Table is not Empty')
    end
    See above, doesn't work ;(
    ---
    DM/Play: AD&D (any flavor)
    Coding the Official AD&D Ruleset

  4. #14
    Ah, sorry I missed the part of the next call not seeing the databasenode as a table.

  5. #15
    Can you try something like:

    local node = DB.findNode('Somemissingnode');
    local node2 = DB.findNode('currencies.id-00001.name')

    local nodeType = type(node2);

    print(node2)

    if type(node) == 'databasenode' then
    print('Node Found')
    else
    print('Node Not Found')
    end

    if type(node2) == 'databasenode' then
    print('Node2 Found')
    else
    print('Node2 Not Found')
    end

  6. #16
    Quote Originally Posted by scleavelin View Post
    Can you try something like:

    local node = DB.findNode('Somemissingnode');
    local node2 = DB.findNode('currencies.id-00001.name')

    local nodeType = type(node2);

    print(node2)

    if type(node) == 'databasenode' then
    print('Node Found')
    else
    print('Node Not Found')
    end

    if type(node2) == 'databasenode' then
    print('Node2 Found')
    else
    print('Node2 Not Found')
    end
    I cannot get the path string of the node without .getPath(). nodeEffect.getPath() would fail... the first post contained the only solution available to my knowledge.

    Code:
        -- check if effect still exists. removed in fCustomOnEffectActorStartTurn() probably
        -- we check the .getPath() through pcall and if it fails then just end this run.
        if not pcall(function () nodeEffect.getPath() end) then 
          Debug.console("manager_effect_adnd.lua","adnd_processEffect","nodeEffect removed in-line",nodeEffect);    
          return;
        end
    ---
    DM/Play: AD&D (any flavor)
    Coding the Official AD&D Ruleset

  7. #17
    Ok. Just trying to get a hang of coding this stuff.
    Trying to learn and all.

  8. #18
    I had a similar thing when deleting nodes if there was nothing in the node it would show that. What I did was check the if there were any children under the node
    Code:
    childCount = DB.getChildCount(nodeChar,"defenses.armour");
    			if (childCount > 0) then
    if there was something there child count would be more than zero. if there was nothing there it would be zero. Maybe that will help?

Thread Information

Users Browsing this Thread

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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

Log in

Log in