PDA

View Full Version : Not Understanding Error


sklead
08-06-2014, 10:26 PM
So I've been trying to figure out this lua system for writing quests since all my perl quest files don't work. It was pretty much alright until recently. I wrote 2 different quests and modified one I had wrote before. The one I modified worked perfectly, but the 2 new ones didn't work. When I did a #questerrors on the NPCs I got the following error: quests/eastkarana/Translocator_Nerduin.lua:6: ')' expected near ';'

I figured that meant I put an extra semi-colon in there somewhere, but I've read, re-read, and even did a ctrl+f search for ; on the quest and the only ones there are the ones that should be there. Here's one of the 2 quests I'm getting the error on:

function event_say(e)
local level = e.other:GetLevel();

if(level >= 15) then
if(e.message:findi("hail")) then
e.self:Say("Whenever you're [" .. eq.say_link("ready",false,"ready" .. "] just give me word and hold on!");
elseif(e.message:findi("ready")) then
e.other:MovePC(333, 1300.3, 190.4, -57.9, 64.0);
end
end
else
e.self:Say("I'm sorry, but Balian has instructed me to keep you here until you've become stronger. Come back when you feel better and I'll send you to the Shadowhaven.");
end
end

So where is this extra semi-colon or what else is the problem? The quest that's working fine looks like this:

function event_say(e)
if(e.message:findi("hail")) then
e.self:Say("I see you're finally awake! You were almost left behind, but Balian refused to let that happen. It seems your armor was lost, though. Luckily we can [" .. eq.say_link("craft",false,"craft") .. "] some new armor for you!");
elseif(e.message:findi("craft")) then
e.self:Say("Crafting armor, weapons, and other items will be paramount to your success here. Almost everything will have a use in crafting! Take this kit, then go get some armor patterns from the merchant. Once you collect enough [" .. eq.say_link("materials",false,"materials") .. "] simply combine them with the pattern in the crafting kit to create your armor. It won't be much, but we can't have you fighting without protection!");
e.other:SummonItem(8886);
elseif(e.message:findi("materials")) then
e.self:Say("If you wear leather you need Gnoll Hides, or plate you need Metal Bits, for chain you need Chain Links, and lastly cloth you need Silk Patches. All of these can be found from the Gnolls in the area that roam, or if you have a group you may try the Gnoll camp to the West.");
end
end

Scorpious2k
08-06-2014, 11:10 PM
Try changing
e.self:Say("Whenever you're [" .. eq.say_link("ready",false,"ready" .. "] just give me word and hold on!");

to

e.self:Say("Whenever you're [" .. eq.say_link("ready",false,"ready") .. "] just give me word and hold on!");

demonstar55
08-06-2014, 11:26 PM
Semi-colons ( ; ) are optional in lua (only required if you want to do multiple statements on a single line.)
Also these are all equivalent (as they are with Perl)

eq.say_link("materials", false, "materials")
eq.say_link("materials", false)
eq.say_link("materials")

sklead
08-07-2014, 09:17 PM
Try changing
e.self:Say("Whenever you're [" .. eq.say_link("ready",false,"ready" .. "] just give me word and hold on!");

to

e.self:Say("Whenever you're [" .. eq.say_link("ready",false,"ready") .. "] just give me word and hold on!");

Unfortunately that just presented me with another error. Removing the level check fixed the problem, although now anyone below level 15 can use the porter, which isn't what I intended.

demonstar55
08-07-2014, 10:14 PM
You have an extra end. (Line 9 if I counted right)