• 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!

Solved Npc error in console

Legoland

Legoland OT
Joined
Mar 3, 2013
Messages
75
Reaction score
4
Location
Sweden
Hello again otland! Im posting a new .lua script i need help with and now its a NPC error in my console.

here is my error in my console:
Code:
[15/02/2014 21:45:39] [Error - LuaScriptInterface::loadFile] data/npc/scripts/Peter.lua:16: unexpected symbol near '['
[15/02/2014 21:45:39] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/Peter.lua
[15/02/2014 21:45:39] data/npc/scripts/Peter.lua:16: unexpected symbol near '['

This is my bugged npc. The guy should be making you change sex if you have the doll item 2110.
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end

[COLOR="#FF0000"]local itemtochange = [/COLOR]
[COLOR="#800080"]local counttochange = 1[/COLOR]

local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if(msgcontains(msg, 'change') or msgcontains(msg, 'sex')) then
selfSay('I can change your sex per '..counttochange..' [COLOR="#00FFFF"][B]ITEMNAME[/B][/COLOR] gold pieces! Do you want?', cid)
talkState[talkUser] = 7
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 7) then
if(getPlayerItemCount(cid, itemtochange) >= counttochange) then
doPlayerRemoveItem(cid, itemtochange, counttochange)
doPlayerSetSex(cid, getPlayerSex(cid) == PLAYERSEX_FEMALE and PLAYERSEX_MALE or PLAYERSEX_FEMALE)
doSendMagicEffect(getCreaturePosition(cid), 35)
selfSay('You have changed your gender and lost '..counttochange..' [COLOR="#00FFFF"][B]ITEMNAME[/B][/COLOR].', cid)
else
selfSay('Sorry, not enough '..counttochange..' of [COLOR="#00FFFF"][B]ITEMNAME[/B][/COLOR].', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end

return true
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Hope you can help me with this simple console error and thank you for reading my thread!
 
Code:
[COLOR="#FF0000"]local itemtochange = [/COLOR]
[COLOR="#800080"]local counttochange = 1[/COLOR]
change to

local itemtochange =
local counttochange = 1
 

Similar threads

Back
Top