• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Look here please! (NPC)

loginoob

New Member
Joined
Feb 6, 2008
Messages
93
Reaction score
0
Location
Brazil
Help please

[12/07/2009 14:07:03] [warning - npcscript::npcscript] cannot load script: Data/npc/scripts/blegs.lua
[12/07/2009 14:07:03] data/npc/scripts/blegs.lua:24: '=' expected near 'fix'

npc

-- based on a sweaty cyclops.lua (no credits since he didn't leave any names)
-- edited by krille09

local keywordhandler = keywordhandler:new()
local npchandler = npchandler:new(keywordhandler)
npcsystem.parseparameters(npchandler)

-- otserv event handling functions start
function oncreatureappear(cid) npchandler:eek:ncreatureappear(cid) end
function oncreaturedisappear(cid) npchandler:eek:ncreaturedisappear(cid) end
function oncreaturesay(cid, type, msg) npchandler:eek:ncreaturesay(cid, type, msg) end
function onthink() npchandler:eek:nthink() end
-- otserv event handling functions end

function creaturesaycallback(cid, type, msg)
-- place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
If(npchandler.focus ~= cid) then
return false
end

-- use the real conversation? (true/false)
real = false

if real == true then
trademsg = 'i can fix all the four pieces of the broken amulet into one!'
fourpobamsg = 'do you want me to fix all the four pieces of that broken amulet?'
hasnomsg = 'you need all four piece of the broken amulet to get all, or i can't fix it!'
nomsg = 'i have no time, i\'m a busy man, leave!'
else
trademsg = 'i can fix all the four pieces of the broken amulet into one!'
fourpobamsg = 'do you want me to fix all the four pieces of that broken amulet?'
hasnomsg = 'you need all four piece of the broken amulet to get all, or i can\'t fix it!'
nomsg = 'i have no time, i\'m a busy man, leave!'
end
if msgcontains(msg, 'trade') or msgcontains(msg, 'fix') then
selfsay(trademsg)
elseif msgcontains(msg, 'change') or msgcontains(msg, 'piece') or msgcontains(msg, 'four') then
selfsay(fourpobamsg)
talk_state = 1
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 1 then
if getplayeritemcount(cid,8262) >= 1 then
if getplayeritemcount(cid,8263) >= 1 then
if getplayeritemcount(cid,8264) >= 1 then
if getplayeritemcount(cid,8265) >= 1 then
if doplayertakeitem(cid,8262,1) == 0 then
if doplayertakeitem(cid,8263,1) == 0 then
if doplayertakeitem(cid,8264,1) == 0 then
if doplayertakeitem(cid,8265,1) == 0 then
selfsay('here you are.')
doplayeradditem(cid,8266,1)
end
else
selfsay(hasnomsg)
end
talk_state = 0

------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state == 1) then
selfsay(nomsg)
talk_state = 0
end
-- place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
Return true
end

npchandler:setcallback(callback_message_default, creaturesaycallback)
npchandler:addmodule(focusmodule:new())
 
lol.
fixed
Code:
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)
-- place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
If(npchandler.focus ~= cid) then
return false
end

-- use the real conversation? (true/false)
real = false

if real == true then
trademsg = 'i can fix all the four pieces of the broken amulet into one!'
fourpobamsg = 'do you want me to fix all the four pieces of that broken amulet?'
hasnomsg = 'you need all four piece of the broken amulet to get all, or i can\'t fix it!'
nomsg = 'i have no time, i\'m a busy man, leave!'
else
trademsg = 'i can fix all the four pieces of the broken amulet into one!'
fourpobamsg = 'do you want me to fix all the four pieces of that broken amulet?'
hasnomsg = 'you need all four piece of the broken amulet to get all, or i can\'t fix it!'
nomsg = 'i have no time, i\'m a busy man, leave!'
end
if msgcontains(msg, 'trade') or msgcontains(msg, 'fix') then
selfsay(trademsg)
elseif msgcontains(msg, 'change') or msgcontains(msg, 'piece') or msgcontains(msg, 'four') then
selfsay(fourpobamsg)
talk_state = 1
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 1 then
if getplayeritemcount(cid,8262) >= 1 then
if getplayeritemcount(cid,8263) >= 1 then
if getplayeritemcount(cid,8264) >= 1 then
if getplayeritemcount(cid,8265) >= 1 then
if doplayertakeitem(cid,8262,1) == 0 then
if doplayertakeitem(cid,8263,1) == 0 then
if doplayertakeitem(cid,8264,1) == 0 then
if doplayertakeitem(cid,8265,1) == 0 then
selfsay('here you are.')
doplayeradditem(cid,8266,1)
end
else
selfsay(hasnomsg)
end
talk_state = 0

------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state == 1) then
selfsay(nomsg)
talk_state = 0
end
-- place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
Return true
end

npchandler:setcallback(callback_message_default, creaturesaycallback)
npchandler:addmodule(focusmodule:new())
 
lol.
fixed
Code:
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)
-- place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
If(npchandler.focus ~= cid) then
return false
end

-- use the real conversation? (true/false)
real = false

if real == true then
trademsg = 'i can fix all the four pieces of the broken amulet into one!'
fourpobamsg = 'do you want me to fix all the four pieces of that broken amulet?'
hasnomsg = 'you need all four piece of the broken amulet to get all, or i can\'t fix it!'
nomsg = 'i have no time, i\'m a busy man, leave!'
else
trademsg = 'i can fix all the four pieces of the broken amulet into one!'
fourpobamsg = 'do you want me to fix all the four pieces of that broken amulet?'
hasnomsg = 'you need all four piece of the broken amulet to get all, or i can\'t fix it!'
nomsg = 'i have no time, i\'m a busy man, leave!'
end
if msgcontains(msg, 'trade') or msgcontains(msg, 'fix') then
selfsay(trademsg)
elseif msgcontains(msg, 'change') or msgcontains(msg, 'piece') or msgcontains(msg, 'four') then
selfsay(fourpobamsg)
talk_state = 1
------------------------------------------------ confirm yes ------------------------------------------------
elseif msgcontains(msg, 'yes') and talk_state == 1 then
if getplayeritemcount(cid,8262) >= 1 then
if getplayeritemcount(cid,8263) >= 1 then
if getplayeritemcount(cid,8264) >= 1 then
if getplayeritemcount(cid,8265) >= 1 then
if doplayertakeitem(cid,8262,1) == 0 then
if doplayertakeitem(cid,8263,1) == 0 then
if doplayertakeitem(cid,8264,1) == 0 then
if doplayertakeitem(cid,8265,1) == 0 then
selfsay('here you are.')
doplayeradditem(cid,8266,1)
end
else
selfsay(hasnomsg)
end
talk_state = 0

------------------------------------------------ confirm no ------------------------------------------------
elseif msgcontains(msg, 'no') and (talk_state == 1) then
selfsay(nomsg)
talk_state = 0
end
-- place all your code in here. Remember that hi, bye and all that stuff is already handled by the npcsystem, so you do not have to take care of that yourself.
Return true
end

npchandler:setcallback(callback_message_default, creaturesaycallback)
npchandler:addmodule(focusmodule:new())

[12/07/2009 18:31:59] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/blegs.lua
[12/07/2009 18:31:59] data/npc/scripts/blegs.lua:14: unexpected symbol near 'then'
 
try now but if it wont work , problem is here
Line 14
Lua:
if(npchandler.focus ~= cid) then

may be fixed
Lua:
local keywordhandler = keywordhandler:new()
local npchandler = npchandler:new(keywordhandler)
npcsystem.parseparameters(npchandler)

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

function creaturesaycallback(cid, type, msg)
if(npchandler.focus ~= cid) then
return false
end

real = false

if real == true then
trademsg = 'i can fix all the four pieces of the broken amulet into one!'
fourpobamsg = 'do you want me to fix all the four pieces of that broken amulet?'
hasnomsg = 'you need all four piece of the broken amulet to get all, or i can\'t fix it!'
nomsg = 'i have no time, i\'m a busy man, leave!'
else
trademsg = 'i can fix all the four pieces of the broken amulet into one!'
fourpobamsg = 'do you want me to fix all the four pieces of that broken amulet?'
hasnomsg = 'you need all four piece of the broken amulet to get all, or i can\'t fix it!'
nomsg = 'i have no time, i\'m a busy man, leave!'
end
if msgcontains(msg, 'trade') or msgcontains(msg, 'fix') then
selfsay(trademsg)
elseif msgcontains(msg, 'change') or msgcontains(msg, 'piece') or msgcontains(msg, 'four') then
selfsay(fourpobamsg)
talk_state = 1

elseif msgcontains(msg, 'yes') and talk_state == 1 then
if getplayeritemcount(cid,8262) >= 1 then
if getplayeritemcount(cid,8263) >= 1 then
if getplayeritemcount(cid,8264) >= 1 then
if getplayeritemcount(cid,8265) >= 1 then
if doplayertakeitem(cid,8262,1) == 0 then
if doplayertakeitem(cid,8263,1) == 0 then
if doplayertakeitem(cid,8264,1) == 0 then
if doplayertakeitem(cid,8265,1) == 0 then
selfsay('here you are.')
doplayeradditem(cid,8266,1)
end
else
selfsay(hasnomsg)
end
talk_state = 0


elseif msgcontains(msg, 'no') and (talk_state == 1) then
selfsay(nomsg)
talk_state = 0
end

Return true
end

npchandler:setcallback(callback_message_default, creaturesaycallback)
npchandler:addmodule(focusmodule:new())
 
try now but if it wont work , problem is here
Line 14
Lua:
if(npchandler.focus ~= cid) then

may be fixed
Lua:
local keywordhandler = keywordhandler:new()
local npchandler = npchandler:new(keywordhandler)
npcsystem.parseparameters(npchandler)

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

function creaturesaycallback(cid, type, msg)
if(npchandler.focus ~= cid) then
return false
end

real = false

if real == true then
trademsg = 'i can fix all the four pieces of the broken amulet into one!'
fourpobamsg = 'do you want me to fix all the four pieces of that broken amulet?'
hasnomsg = 'you need all four piece of the broken amulet to get all, or i can\'t fix it!'
nomsg = 'i have no time, i\'m a busy man, leave!'
else
trademsg = 'i can fix all the four pieces of the broken amulet into one!'
fourpobamsg = 'do you want me to fix all the four pieces of that broken amulet?'
hasnomsg = 'you need all four piece of the broken amulet to get all, or i can\'t fix it!'
nomsg = 'i have no time, i\'m a busy man, leave!'
end
if msgcontains(msg, 'trade') or msgcontains(msg, 'fix') then
selfsay(trademsg)
elseif msgcontains(msg, 'change') or msgcontains(msg, 'piece') or msgcontains(msg, 'four') then
selfsay(fourpobamsg)
talk_state = 1

elseif msgcontains(msg, 'yes') and talk_state == 1 then
if getplayeritemcount(cid,8262) >= 1 then
if getplayeritemcount(cid,8263) >= 1 then
if getplayeritemcount(cid,8264) >= 1 then
if getplayeritemcount(cid,8265) >= 1 then
if doplayertakeitem(cid,8262,1) == 0 then
if doplayertakeitem(cid,8263,1) == 0 then
if doplayertakeitem(cid,8264,1) == 0 then
if doplayertakeitem(cid,8265,1) == 0 then
selfsay('here you are.')
doplayeradditem(cid,8266,1)
end
else
selfsay(hasnomsg)
end
talk_state = 0


elseif msgcontains(msg, 'no') and (talk_state == 1) then
selfsay(nomsg)
talk_state = 0
end

Return true
end

npchandler:setcallback(callback_message_default, creaturesaycallback)
npchandler:addmodule(focusmodule:new())

[12/07/2009 20:38:17] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/blegs.lua
[12/07/2009 20:38:17] data/npc/scripts/blegs.lua:57: '=' expected near 'true'
 
Back
Top