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

[0.3.6pl1] How to verify if a tile exists before using getThingfromPos ?

devianceone

Lua Scripter
Joined
Jan 24, 2009
Messages
756
Reaction score
29
Im using a script like the following to scan a multi floor room for players.
PHP:
	for x = WaitingRoom.fromX, WaitingRoom.toX do
		for y = WaitingRoom.fromY, WaitingRoom.toY do
			for z = WaitingRoom.fromZ, WaitingRoom.toZ do
				local PlayerCheck = getThingfromPos({x=x, y=y, z=z,stackpos = 253})
				if isPlayer(PlayerCheck.uid) then

The problem is, both floors aren't completely tiled and using getThingfromPos on a tile that has nothing at all on it gives an error "Tile not found". Its searching hundreds of different tiles and it's causing the server to lag out because of the spam it creates in console.

The script works fine when only searching a completely tiled single floor, so how can i verify a tile exists on floors that are not fully tiled before using the function getThingfromPos on it to prevent any errors?
 
Back
Top