PDA

View Full Version : Problem with NPC attacks.



Litvyak
March 2nd, 2014, 22:04
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.

saithan
March 2nd, 2014, 23:38
you have to properly write them in.
http://enhanced.vlexofree.com/index.php/about-help/3-what-is-gurps-4enhanced

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

ranged:
Large Knife (thrown) (13): 1d-2 imp, Acc 0, Range 8/15, RoF 1

Gigermann
March 3rd, 2014, 14:55
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

Litvyak
March 3rd, 2014, 19:00
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:



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.

Gigermann
March 3rd, 2014, 23:35
Tested. Sure enough—if you remove all space and carriage returns from between the attacks it will parse correctly, and works normally.





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.

seycyrus
March 15th, 2014, 18:03
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.

Trenloe
March 16th, 2014, 18:26
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: http://www.fantasygrounds.com/forums/showthread.php?20651-Modifying-the-CoreRPG-ruleset. The GURPS ruleset will be in the GURPS_4e.pak file in the \rulesets directory I believe.

Gigermann
March 16th, 2014, 22:47
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

sclose1970
April 26th, 2014, 15:11
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.

saithan
April 26th, 2014, 15:32
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.