Starfinder Playlist
  1. #1

    Replacing script in layered setup

    So I'm having an issue using "my" version of a script over a one in a layered ruleset (5e).

    I'm trying to use my own "campaign\scripts\char_weapon.lua".

    When I have the file in the directory and included in the base.xml I get the following error when I bootup FG using this ruleset.

    Script Error: [string "campaign/scripts/char_weapon.lua"]:7: attempt to call global 'getDatabaseNode' (a nil value)

    I'm probably missing some procedure here but I can't seem to figure it out.

    I should mention this script (right now) is exactly like the one in the 5e ruleset. I just need to make some tweaks and this was my first step.
    Last edited by celestian; February 12th, 2017 at 00:14.

  2. #2
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,686
    Blog Entries
    1
    You probably need to include it the same way its been included in 5e - you will need the windowclass with a merge=join statement.

  3. #3
    Quote Originally Posted by damned View Post
    You probably need to include it the same way its been included in 5e - you will need the windowclass with a merge=join statement.
    The base.xml doesn't mention "char_weapon.lua" anywhere. Also checked that it wasn't in the CoreRPG ruleset.

    I included the .xml file (and the <includefile source="campaign/record_char_weapon.xml" />) where the script was included.

    Right now the changes I've made since work but I'd like to figure out what is up. I'm getting the impression somewhere FG is loading the 5e and the one I have both but I could be entirely wrong.

    I'll do a search everything for "merge" to see if I can find something.

  4. #4
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,686
    Blog Entries
    1
    char_weapon.lua is called by the windowclass char_weapon which is in the file campaign\record_char_weapon.xml
    you will either replicate the entire window class or you will use a merge statement to only include the minimum required to ensure that the
    <script file="campaign/scripts/char_weapon.lua" />
    line is loaded. this will load after corerpg and after 5e have loaded so it will be using your versions.

    I believe that you will get away with:

    <windowclass name="char_weapon" merge="join">
    <script file="campaign/scripts/char_weapon.lua" />
    </windowclass>

    depending on what else you have change in the lua...

  5. #5
    Quote Originally Posted by damned View Post
    char_weapon.lua is called by the windowclass char_weapon which is in the file campaign\record_char_weapon.xml
    you will either replicate the entire window class or you will use a merge statement to only include the minimum required to ensure that the
    <script file="campaign/scripts/char_weapon.lua" />
    line is loaded. this will load after corerpg and after 5e have loaded so it will be using your versions.

    I believe that you will get away with:

    <windowclass name="char_weapon" merge="join">
    <script file="campaign/scripts/char_weapon.lua" />
    </windowclass>

    depending on what else you have change in the lua...

    Thanks for taking the time to look into the code/scripts and reply!

    After you mentioned "merge" and "join" I found some examples and tried a few variations . One of which is the one you suggested above. I tried just adding the merge="join" (and keeping the xml in there as well) and it still caused the error. I then took your advice and trimmed down the class to just the above... it still has the error ;(

    I'll keep poking around.

    So, to rule out this was anything I was messing up I created a bare bones base.xml.

    Code:
    	<importruleset source="CoreRPG" />
    	<importruleset source="5E" />
    
    	<includefile source="campaign/record_char_weapon.xml" />
    	
    	<script name="CharWeapon" file="campaign/scripts/char_weapon.lua" />
    and then copied the campaign/record_char_weapon.xml and campaign/scripts/char_weapon.lua from 5e into it and then modified the line in record_char_weapon.xml

    Code:
    <windowclass name="char_weapon" merge="join">
    (and left the rest of the code, just added merge="join")

    And the error is still popping up.
    Last edited by celestian; February 12th, 2017 at 07:33.

  6. #6
    damned's Avatar
    Join Date
    Mar 2011
    Location
    Australia
    Posts
    26,686
    Blog Entries
    1
    Ok - are you creating a ruleset or an extension?
    You dont importruleset in an extension you do that in a layered ruleset.

    Why have you declared this script?
    <script name="CharWeapon" file="campaign/scripts/char_weapon.lua" />
    In the posts above we said you dont do that - thats not how the 5e ruleset calls this file - it calls it from within campaign/record_char_weapon.xml

    I created the extension exactly as suggested above in post #4 and added a Debug.console("Hello Strahd"); line to the lua file and it executes as expected and no errors are generated.

  7. #7
    Quote Originally Posted by damned View Post
    Ok - are you creating a ruleset or an extension?
    You dont importruleset in an extension you do that in a layered ruleset.
    I'm making a layered ruleset.

    Quote Originally Posted by damned View Post
    Why have you declared this script?
    <script name="CharWeapon" file="campaign/scripts/char_weapon.lua" />
    In the posts above we said you dont do that - thats not how the 5e ruleset calls this file - it calls it from within campaign/record_char_weapon.xml

    I created the extension exactly as suggested above in post #4 and added a Debug.console("Hello Strahd"); line to the lua file and it executes as expected and no errors are generated.
    Woops, yeah that was something I tested previously and just copied into the test. Removing that cleared up the error

    Apologies for the run around. Still trying to get my footing on how things work in FG. Thank you for your help!

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
  •  
STAR TREK 2d20

Log in

Log in