Igor Milagres
Member
- Joined
- May 12, 2018
- Messages
- 76
- Reaction score
- 21
Good night, I have the following error in my npc that sells bps of runes, already tried but does not solve, the following error appears in the logs: If anyone knows what to do, it would help a lot, thank you. Attach the script
[Error - LuaInterface :: loadFile] data / npc / scripts / runenpc.lua: 194: 'end' expected (to close 'if' at line 161) near ''
[Warning - NpcEvents :: NpcEvents] Can not load script: data / npc / scripts / runenpc.lua
data / npc / scripts / runenpc.lua: 194: 'end' expected (to close 'if' at line 161) near ''
SCRIPT:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
if msgcontains(msg, 'bp of ultimate healing') then
npcHandler:say('Do you want to buy a backpack of ultimate healing rune for 3000 gold coins?')
talk_state = 1
elseif msgcontains(msg, 'yes') and talk_state == 1 then
if getPlayerMoney(cid) >= 3000 then
blue_bp = doPlayerAddItem(cid, 2002, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doPlayerRemoveMoney(cid, 3000)
npcHandler:say('Thank you for buying.')
talk_state = 0
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end
end
if msgcontains(msg, 'bp of sudden death') then
npcHandler:say('Do you want to buy a backpack of sudden death rune for 6000 gold coins?')
talk_state = 2
elseif msgcontains(msg, 'yes') and talk_state == 2 then
if getPlayerMoney(cid) >= 5500 then
grey_bp = doPlayerAddItem(cid, 2003, 1)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doPlayerRemoveMoney(cid, 5500)
npcHandler:say('Thank you for buying.')
talk_state = 0
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end
end
if msgcontains(msg, 'bp of heavy magic missile') then
npcHandler:say('Do you want to buy a backpack of heavy magic missile rune for 2000 gold coins?')
talk_state = 3
elseif msgcontains(msg, 'yes') and talk_state == 3 then
if getPlayerMoney(cid) >= 2000 then
purple1_bp = doPlayerAddItem(cid, 2001, 1)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doPlayerRemoveMoney(cid, 2000)
npcHandler:say('Thank you for buying.')
talk_state = 0
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end
end
if msgcontains(msg, 'bp of great fireball') then
npcHandler:say('Do you want to buy a backpack of great fireball rune for 3000 gold coins?')
talk_state = 4
elseif msgcontains(msg, 'yes') and talk_state == 4 then
if getPlayerMoney(cid) >= 3000 then
red_bp = doPlayerAddItem(cid, 2000, 1)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doPlayerRemoveMoney(cid, 3000)
npcHandler:say('Thank you for buying.')
talk_state = 0
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end
end
if msgcontains(msg, 'bp of explosion') or msgcontains(msg, 'bp of explo') then
npcHandler:say('Do you want to buy a backpack of explosion rune for 4000 gold coins?')
talk_state = 5
elseif msgcontains(msg, 'yes') and talk_state == 5 then
if getPlayerMoney(cid) >= 4000 then
purple2_bp = doPlayerAddItem(cid, 2001, 1)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doPlayerRemoveMoney(cid, 4000)
npcHandler:say('Thank you for buying.')
talk_state = 0
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end
[Error - LuaInterface :: loadFile] data / npc / scripts / runenpc.lua: 194: 'end' expected (to close 'if' at line 161) near ''
[Warning - NpcEvents :: NpcEvents] Can not load script: data / npc / scripts / runenpc.lua
data / npc / scripts / runenpc.lua: 194: 'end' expected (to close 'if' at line 161) near ''
SCRIPT:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() end
-- OTServ event handling functions end
function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
if msgcontains(msg, 'bp of ultimate healing') then
npcHandler:say('Do you want to buy a backpack of ultimate healing rune for 3000 gold coins?')
talk_state = 1
elseif msgcontains(msg, 'yes') and talk_state == 1 then
if getPlayerMoney(cid) >= 3000 then
blue_bp = doPlayerAddItem(cid, 2002, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doAddContainerItem(blue_bp, 2273, 1)
doPlayerRemoveMoney(cid, 3000)
npcHandler:say('Thank you for buying.')
talk_state = 0
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end
end
if msgcontains(msg, 'bp of sudden death') then
npcHandler:say('Do you want to buy a backpack of sudden death rune for 6000 gold coins?')
talk_state = 2
elseif msgcontains(msg, 'yes') and talk_state == 2 then
if getPlayerMoney(cid) >= 5500 then
grey_bp = doPlayerAddItem(cid, 2003, 1)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doAddContainerItem(grey_bp, 2268, 3)
doPlayerRemoveMoney(cid, 5500)
npcHandler:say('Thank you for buying.')
talk_state = 0
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end
end
if msgcontains(msg, 'bp of heavy magic missile') then
npcHandler:say('Do you want to buy a backpack of heavy magic missile rune for 2000 gold coins?')
talk_state = 3
elseif msgcontains(msg, 'yes') and talk_state == 3 then
if getPlayerMoney(cid) >= 2000 then
purple1_bp = doPlayerAddItem(cid, 2001, 1)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doAddContainerItem(purple1_bp, 2311, 5)
doPlayerRemoveMoney(cid, 2000)
npcHandler:say('Thank you for buying.')
talk_state = 0
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end
end
if msgcontains(msg, 'bp of great fireball') then
npcHandler:say('Do you want to buy a backpack of great fireball rune for 3000 gold coins?')
talk_state = 4
elseif msgcontains(msg, 'yes') and talk_state == 4 then
if getPlayerMoney(cid) >= 3000 then
red_bp = doPlayerAddItem(cid, 2000, 1)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doAddContainerItem(red_bp, 2304, 4)
doPlayerRemoveMoney(cid, 3000)
npcHandler:say('Thank you for buying.')
talk_state = 0
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end
end
if msgcontains(msg, 'bp of explosion') or msgcontains(msg, 'bp of explo') then
npcHandler:say('Do you want to buy a backpack of explosion rune for 4000 gold coins?')
talk_state = 5
elseif msgcontains(msg, 'yes') and talk_state == 5 then
if getPlayerMoney(cid) >= 4000 then
purple2_bp = doPlayerAddItem(cid, 2001, 1)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doAddContainerItem(purple2_bp, 2313, 3)
doPlayerRemoveMoney(cid, 4000)
npcHandler:say('Thank you for buying.')
talk_state = 0
else
npcHandler:say('You don\'t have enough money.')
talk_state = 0
end