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

error in console

kilirt

New Member
Joined
May 11, 2009
Messages
223
Reaction score
2
hello, i come here because i've an error in my movement script and i don't found where is error:

line 47:
Lua:
 local c = isCreatureInArea({x = 17010, y = 16607, z = 4},{x = 17020, y = 16617, z = 4}) -- Getting crss inside


Lua:
[22/7/2013 20:10:19] [Error - MoveEvents Interface] 
[22/7/2013 20:10:19] data/movements/scripts/pacman.lua:onStepIn
[22/7/2013 20:10:19] Description: 
[22/7/2013 20:10:19] data/movements/scripts/pacman.lua:47: attempt to call global 'isCreatureInArea' (a nil value)
[22/7/2013 20:10:19] stack traceback:
[22/7/2013 20:10:19] 	data/movements/scripts/pacman.lua:47: in function <data/movements/scripts/pacman.lua:20>
 
Lua:
-- Pacman script: Controller [TGY] 
pressedTiles = {}
gameStarted = false
dif = 1

local function pacmanCounter(text, start, col, dif)
	if start then 
		gameStarted = true
		doCreateMonster("Pacman Ghost", {x = 270, y = 2019, z = 9})
		if dif > 1 then
			doCreateMonster("Pacman Ghost", {x = 280, y = 2019, z = 9}) 
		end
		if dif > 2 then
			doCreateMonster("Pacman Ghost", {x = 275, y = 2019, z = 9}) 
		end
	end
	doSendAnimatedText({x = 275, y = 2024, z = 9}, text, col)
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if false == isPlayer(cid) then
		return
	end
	
	if item.actionid == 5301 and item.itemid == 426 then
		-- HANDLE TILE
		if not gameStarted then
			--doPlayerPopupFYI(cid, "x")
			doTeleportThing(cid, fromPosition, true)
			return true
		end
		doTransformItem(item.uid, 425)
		table.insert(pressedTiles, position)
		local cnt = #pressedTiles
		doSendAnimatedText(position, (cnt).."/84", TEXTCOLOR_GREEN)
		if cnt > 83 then
			doTeleportThing(cid, {x = 32369, y = 32241, z = 7}, true)
			doSendAnimatedText(position, ":D", TEXTCOLOR_GREEN)
			local prize = 5
			if dif == 2 then prize = 10 end
			if dif == 3 then prize = 20 end
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[PACMAN] You won ".. prize .." Game Tokens!")
			doPlayerAddItem(cid,6527,prize)
		end
	elseif item.actionid == 7392 then
		-- HANDLE JOINING PERSON
		local c = isCreatureInArea({x = 17010, y = 16607, z = 4},{x = 17020, y = 16617, z = 4}) -- Getting crss inside
		for _,v in pairs(c) do
			if isPlayer(v) then
				doTeleportThing(cid, fromPosition, true)
				return true
			end
		end
		-- Nobody is inside, check ticket/pick it - check exhaust first
		--doPlayerPopupFYI(cid, "You must wait " .. (math.floor((getPlayerStorageValue(cid, 7948)-os.time())/60)+1) .. " more minutes till you can play again.")
		if getPlayerStorageValue(cid, 7948) > 0 and (os.time() < getPlayerStorageValue(cid, 7948)) then
			doTeleportThing(cid, fromPosition, true)
			doPlayerPopupFYI(cid, "You must wait " .. (math.floor((getPlayerStorageValue(cid, 7948)-os.time())/60)+1) .. " more minute(s) till you can play again.")
			return true
		end
		if getPlayerItemCount(cid, 6527) < 1 then
			doTeleportThing(cid, fromPosition, true)
			doPlayerPopupFYI(cid, "You need 1 Game Token to play.")
			return true
		end
		doPlayerRemoveItem(cid, 6527, 1)
		setPlayerStorageValue(cid, 7948, os.time() + 900)
		-- Set difficulity variabele
		dif = 1
		if item.uid == 7396 then
			dif = 2
		elseif item.uid == 7397 then
			dif = 3
		end
		-- Clean the area and reset the tiles now
		for _,v in pairs(c) do
			doRemoveCreature(v)
		end
		for _,v in pairs(pressedTiles) do
			doItemSetAttribute(doCreateItem(426, v),"aid", 5301)
		end
		pressedTiles = {}
		gameStarted = false
		doTeleportThing(cid, {x = 17015, y = 16612, z = 4}, true)
		pacmanCounter("3", false, TEXTCOLOR_RED, dif)
		addEvent(pacmanCounter,1000,"2", false, TEXTCOLOR_ORANGE, dif)
		addEvent(pacmanCounter,2000,"1", false, TEXTCOLOR_YELLOW, dif)
		addEvent(pacmanCounter,3000,"GO!", true, TEXTCOLOR_GREEN, dif)
	end


	return true
end

- - - Updated - - -

Okey i fix it ! but new error:
Lua:
[22/7/2013 22:53:41] [Error - MoveEvents Interface] 
[22/7/2013 22:53:41] data/movements/scripts/pacman.lua:onStepIn
[22/7/2013 22:53:41] Description: 
[22/7/2013 22:53:41] data/lib/199-tgyfunctions.lua:3: attempt to index local 'toPos' (a nil value)
[22/7/2013 22:53:41] stack traceback:
[22/7/2013 22:53:41] 	data/lib/199-tgyfunctions.lua:3: in function 'isCreatureInArea'
[22/7/2013 22:53:41] 	data/movements/scripts/pacman.lua:47: in function <data/movements/scripts/pacman.lua:20>

Lua:
function isCreatureInArea(fromPos, toPos)
	local t = {}
	for z=fromPos.z, toPos.z do
		for y=fromPos.y, toPos.y do
			for x=fromPos.x, toPos.x do
				local v = getTopCreature({x=x,y=y,z=z})
				if v.itemid == 1 and table.find({1,2,3}, v.type) then
					table.insert(t, v.uid)
				end
			end
		end
	end
	return t
end

-- [TGY]
 
fixed but when i walk on tile they don't block in position 425 with no error.

Lua:
-- Pacman script: Controller [TGY] 
pressedTiles = {}
gameStarted = false
dif = 1

local function pacmanCounter(text, start, col, dif)
	if start then 
		gameStarted = true
		doCreateMonster("Inky", {x = 17020, y = 16607, z = 4})
		if dif > 1 then
			doCreateMonster("Pinky", {x = 17010, y = 16607, z = 4}) 
		end
		if dif > 2 then
			doCreateMonster("Blinky", {x = 17020, y = 16617, z = 4}) 
		end
	end
	doSendAnimatedText({x = 17015, y = 16612, z = 4}, text, col)
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if false == isPlayer(cid) then
		return
	end
	
	if item.actionid == 5301 and item.itemid == 426 then
		-- HANDLE TILE
		if not gameStarted then
			--doPlayerPopupFYI(cid, "x")
			doTeleportThing(cid, fromPosition, true)
			return true
		end
		doTransformItem(item.uid, 425)
		table.insert(pressedTiles, position)
		local cnt = #pressedTiles
		doSendAnimatedText(position, (cnt).."/84", TEXTCOLOR_GREEN)
		if cnt > 83 then
			doTeleportThing(cid, {x = 17022, y = 16609, z = 4}, true)
			doSendAnimatedText(position, ":D", TEXTCOLOR_GREEN)
			local prize = 5
			if dif == 2 then prize = 10 end
			if dif == 3 then prize = 20 end
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "[PACMAN] You won ".. prize .." Game Tokens!")
			doPlayerAddItem(cid,6527,prize)
		end
	elseif item.actionid == 7392 then
		-- HANDLE JOINING PERSON
		local c = isCreatureInArea({x = 17010, y = 16607, z = 4},{x = 17020, y = 16617, z = 4}) -- Getting crss inside
		for _,v in pairs(c) do
			if isPlayer(v) then
				doTeleportThing(cid, fromPosition, true)
				return true
			end
		end
		-- Nobody is inside, check ticket/pick it - check exhaust first
		--doPlayerPopupFYI(cid, "You must wait " .. (math.floor((getPlayerStorageValue(cid, 7948)-os.time())/60)+1) .. " more minutes till you can play again.")
		if getPlayerStorageValue(cid, 7948) > 0 and (os.time() < getPlayerStorageValue(cid, 7948)) then
			doTeleportThing(cid, fromPosition, true)
			doPlayerPopupFYI(cid, "You must wait " .. (math.floor((getPlayerStorageValue(cid, 7948)-os.time())/60)+1) .. " more minute(s) till you can play again.")
			return true
		end
		if getPlayerItemCount(cid, 6527) < 1 then
			doTeleportThing(cid, fromPosition, true)
			doPlayerPopupFYI(cid, "You need 1 Game Token to play.")
			return true
		end
		doPlayerRemoveItem(cid, 6527, 1)
		setPlayerStorageValue(cid, 7948, os.time() + 900)
		-- Set difficulity variabele
		dif = 1
		if item.uid == 7396 then
			dif = 2
		elseif item.uid == 7397 then
			dif = 3
		end
		-- Clean the area and reset the tiles now
		for _,v in pairs(c) do
			doRemoveCreature(v)
		end
		for _,v in pairs(pressedTiles) do
			doItemSetAttribute(doCreateItem(426, v),"aid", 5301)
		end
		pressedTiles = {}
		gameStarted = false
		doTeleportThing(cid, {x = 17015, y = 16612, z = 4}, true)
		pacmanCounter("3", false, TEXTCOLOR_RED, dif)
		addEvent(pacmanCounter,1000,"2", false, TEXTCOLOR_ORANGE, dif)
		addEvent(pacmanCounter,2000,"1", false, TEXTCOLOR_YELLOW, dif)
		addEvent(pacmanCounter,3000,"GO!", true, TEXTCOLOR_GREEN, dif)
	end


	return true
end
 
just wrong configuration of position, my bad ^^ nothing happen with lib file
but now i've a new probleme :'( when i try the game with my god all work when i'm in ghost mode but when i put off ghost mode the tile don't stay in id 425 why :'( ?
 
You can add
Lua:
function onStepOut(cid, item, position, fromPosition)
	return true
end

Add new line in movements.xml
Use same actionid with StepOut instead of StepIn and you can use the same script if you add it in there.
 
Last edited:
Back
Top