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

Lua [Console] Error About POI!

Sweddy

Well-Known Member
Joined
Feb 14, 2009
Messages
2,907
Reaction score
93
Location
Sweden
[03/07/2010 00:17:11] [Error - MoveEvents Interface]
[03/07/2010 00:17:11] data/movements/scripts/PitsOfInferno/MagicWallEntrance.lua:eek:nStepIn
[03/07/2010 00:17:11] Description:
[03/07/2010 00:17:11] (luaGetPlayerItemCount) Player not found

[03/07/2010 00:17:11] [Error - MoveEvents Interface]
[03/07/2010 00:17:11] data/movements/scripts/PitsOfInferno/MagicWallEntrance.lua:eek:nStepIn
[03/07/2010 00:17:11] Description:
[03/07/2010 00:17:11] ...ovements/scripts/PitsOfInferno/MagicWallEntrance.lua:5: attempt to compare boolean with number
[03/07/2010 00:17:11] stack traceback:
[03/07/2010 00:17:11] ...ovements/scripts/PitsOfInferno/MagicWallEntrance.lua:5: in function <...ovements/scripts/PitsOfInferno/MagicWallEntrance.lua:1>

Lua:
function onStepIn(cid, item, pos)
 local position = {x=412, y=1414, z=9}
 local position2 = {x=398, y=1380, z=9}
 
  if (getPlayerItemCount(cid, 1970) < 1) then
   doTeleportThing(cid, position)
   doSendMagicEffect(position,10)
  else
   doTeleportThing(cid, position2)
      doSendMagicEffect(position2,10)
  end
end
 
Long story short: Something is stepping on a square that activates the script, but the thing stepping on it is not a player.

Code:
[03/07/2010 00:17:11] (luaGetPlayerItemCount) Player not found

Is obvious since it's not a player stepping on the tile. Can't get an itemcount for a monster or similar.

Code:
[03/07/2010 00:17:11] ...ovements/scripts/PitsOfInferno/MagicWallEntrance.lua:5: attempt to compare boolean with number

Is a cascade effect due to the above thing, since it's not a player who is stepping on the tile the script cannot check if "cid" has items, and thus returns "FALSE", and in LUA, FALSE and 0 (And TRUE and 1) is two different things, and thus; "Cannot compare boolean (TRUE/FALSE) with number (0/1)"


To fix it simply insert an additional if clause that checks if the "onstepping" creature is a player, and if not then don't execute the script. :)

should be something like...

Code:
if (!isPlayer(cid)) then
return TRUE
end

placed right below "function onStepIn(cid, item, pos)"
 
Back
Top