FG Spreadshirt Swag
  1. #1

    Help creating a ruleset

    Hi,

    I'm creating my own custom ruleset. I need to create a link from a script outside of the window that contains the said link (so I cannot access its windowreferencefield to use its getValue function). I tried to create a databasenode of type windowreference, which contained the subnodes class and recordname with the correct strings. The values are updated (even if the link doesn't work) until the campaign is saved, where the subnodes are deleted. Obviously must be another way of doing it, but I don't know how. Can anybody help me?

    Thanks.

  2. #2
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Moved to the Workshop forum - this is the best place to get help regarding ruleset coding.

    I'm not sure exactly what you're trying to do and where your code is running. Can you provide more details please?
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  3. #3
    I'm trying to do a random item generator. In my ruleset, the item record has a window list with bounded spells (consisting on a CoreRPG linkfield to the spell record and a stringlabel with the name). The script that creates the item requires to tell the linkfield where to find the bound spell. I tried to do it updating the databasenode of the linkfield instead of using the linkfield itself, as when the item is generated, the item window is not open. I did it this way:

    Code:
    local nodeListNew = nodeItem.createChild("powers");
    local nodeNewSpell = nodeListNew.createChild();
    local nodeLink = nodeNewSpell.createChild("link", "windowreference");
    DB.setValue(nodeLink, "class", "string", "power");
    DB.setValue(nodeLink, "recordname", "string", sPath);
    This creates the nodeLink node and its childs class and recordname with their values (checked via Debug.chat) but the linkfield still doesn't work. Also, as soon as the campaign is saved, the child nodes are deleted (I suppose because only nodes without type can have child nodes according to documentation). I imagine there must be a correct way of implementing this, but I don't know which is it.

  4. #4
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,362
    Thanks for the extra info, that helps a lot.

    This is something that I struggled with at first too. The database won't work correctly when trying to set the child data of the link node with individual setValue commands - which is what you're seeing, it's not saving in the database.

    The way to do it is set the class and recordname values in one setValue. Try: nodeLink.setValue("power", sPath)
    Private Messages: My inbox is forever filling up with PMs. Please don't send me PMs unless they are actually private/personal messages. General FG questions should be asked in the forums - don't be afraid, the FG community don't bite and you're giving everyone the chance to respond and learn!

  5. #5
    Thanks a lot, it did it.

    Maybe SmiteWorks should include it in the documentation, would be very useful.

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
  •  
DICE PACKS BUNDLE

Log in

Log in