DICE PACKS BUNDLE
  1. #1

    Problem with NPC attacks.

    When trying to drag and drop an NPC attack other than the top one, I was getting the following error:

    Script Error: [string "scripts/npcattackfield.lua"]:255: attempt to concatenate local 'name' (a nil value)

    Investigating the problem, the culprit appears to be the parseComponents() function on the npcattackfield.lua script. When trying to drag any attack but the top option, the parseComponents() function includes the carriage return at the start of the line when populating the "all" and "skill" variables.

  2. #2
    you have to properly write them in.
    https://enhanced.vlexofree.com/index...urps-4enhanced

    Shortsword (14):[swing 1d+2 cut; C,1]

    ranged:
    Large Knife (thrown) (13): 1d-2 imp, Acc 0, Range 8/15, RoF 1
    Last edited by saithan; March 2nd, 2014 at 23:40.

  3. #3
    Quote Originally Posted by Litvyak View Post
    When trying to drag and drop an NPC attack other than the top one, I was getting the following error:

    Script Error: [string "scripts/npcattackfield.lua"]:255: attempt to concatenate local 'name' (a nil value)

    Investigating the problem, the culprit appears to be the parseComponents() function on the npcattackfield.lua script. When trying to drag any attack but the top option, the parseComponents() function includes the carriage return at the start of the line when populating the "all" and "skill" variables.
    You got farther than I did trying to diagnose the problem—didn't see that. Did you fix and test it locally?

    It's (technically) not the syntax on the attack line—that hasn't changed in my test campaign since before the latest updates, when it was working. I wonder if it would work with all the attacks on one line? :P
    It's hard to be religious when certain people are never incinerated by bolts of lightning.

  4. #4
    Quote Originally Posted by Gigermann View Post
    You got farther than I did trying to diagnose the problem—didn't see that. Did you fix and test it locally?

    It's (technically) not the syntax on the attack line—that hasn't changed in my test campaign since before the latest updates, when it was working. I wonder if it would work with all the attacks on one line? :P
    There's probably a more elegant way to fix it, but my quick and dirty fix was to add the following two lines after line 101 in npcattackfield.lua:

    Code:
    all = string.gsub(all, "\n", "");
    		
    skill = string.gsub(skill, "\n", "");
    It may or may not be syntax problem, but either way I'd rather make one fix in the code than have to fix the syntax every time I use /importnpc.

  5. #5
    Tested. Sure enough—if you remove all space and carriage returns from between the attacks it will parse correctly, and works normally.

    Quote Originally Posted by Litvyak View Post
    Code:
    all = string.gsub(all, "\n", "");
            
    skill = string.gsub(skill, "\n", "");
    This works for me as well.

    In the end, though, this is going to change anyway as the new version of the ruleset is being developed.
    Last edited by Gigermann; March 3rd, 2014 at 23:43.
    It's hard to be religious when certain people are never incinerated by bolts of lightning.

  6. #6

    Join Date
    May 2013
    Location
    East Coast USA.
    Posts
    945
    Forgive me for my ignorance guys, but which files are you modifying here, and what program/editor do you use to do the modification ? I've looked in both my program file directory and my FG apps directories and cant find a .lua file that might be associated with gurps.

  7. #7
    Trenloe's Avatar
    Join Date
    May 2011
    Location
    Colorado, USA
    Posts
    33,404
    Quote Originally Posted by seycyrus View Post
    Forgive me for my ignorance guys, but which files are you modifying here, and what program/editor do you use to do the modification ? I've looked in both my program file directory and my FG apps directories and cant find a .lua file that might be associated with gurps.
    While not specific to GURPS, this thread gives a lot of info regarding modifying rulesets: https://www.fantasygrounds.com/forum...oreRPG-ruleset. The GURPS ruleset will be in the GURPS_4e.pak file in the \rulesets directory I believe.
    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!

  8. #8
    Quote Originally Posted by seycyrus View Post
    Forgive me for my ignorance guys, but which files are you modifying here, and what program/editor do you use to do the modification ? I've looked in both my program file directory and my FG apps directories and cant find a .lua file that might be associated with gurps.
    Specifically, in GURPS_4e.pak (neverminding the extension, it's just a ZIP file), scripts/npcattackfield.lua
    It's hard to be religious when certain people are never incinerated by bolts of lightning.

  9. #9
    I'm having the same problem, but I'm not familiar enough with code editing to know exactly how to do this. Is there any chance you one of you guys could post the edited npcattackfield.lua here? Would I just create a new .zip file and rename it .pak after I added the edited file back in? Thanks for your help and time.

  10. #10
    it is better to add "\r?" (without the quotes) to the beginning of the regex. this will not only fix the prob, but make it more forgivin. for instance you can separate entries by a line.

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
  •  
FG Spreadshirt Swag

Log in

Log in