• 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 Teleport Scroll

Alyhide

Banned User
Joined
Aug 21, 2010
Messages
1,945
Reaction score
55
Location
Switzerland
Hey, I have a problem with my teleport scroll..

Code:
[06/08/2011 09:32:51] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/teleportpaper.lua:3: unexpected symbol near '['
[06/08/2011 09:32:51] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/teleportpaper.lua)
[06/08/2011 09:32:51] data/creaturescripts/scripts/teleportpaper.lua:3: unexpected symbol near '['
[06/08/2011 09:32:51] Reloaded creature events.

LUA:
 local t = {
	["Temple"] = {x = 3000, y = 2098, z = 7}, storage = 1337, time = 30},	
	["Teleports"] = {x = 2815, y = 2025, z = 7}, storage = 1338, time = 30},
	["Addons"] = {x = 1266, y = 880, z = 7}, storage = 1339, time = 30},
	["Addon Bosses"] = {x = 1127, y = 907,z = 6}, storage 1340, time = 30},
	["Trainers"] = {x = 2877, y = 2005, z = 7}, storage 1341, time = 30},
	["Donation Quest"] = {x = 3160, y = 1572, z = 7}, storage 1342, time = 30},
	["Shops"] = {x = 2940, y = 2075, z = 7}, storage 1343, time = 30},
	["Sailors Quarter"] = {x = 3010, y = 2192, z = 6}, storage 1344, time = 30},
}
 
function onTextEdit(cid, item, newText)
	if item.itemid == 1949 then
		if isInArray({'locations', 'places', 'place'}, newText) then
			local i = ''
			for text, x in pairs(t) do
				i = i .. " [" .. text .. "]"
			end
 
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleportation Locations: " .. i)
			return true
		end
 
		if isPlayerPzLocked(cid) then
			doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
			return true
		end
 
		local st = t[newText].storage
		if getCreatureStorage(cid, st) > os.time() then
			doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. ((getCreatureStorage(cid, st) - os.time()) == 1 and "" or "s") .. " to travel here again.", TALKTYPE_MONSTER)
			return true
		end
 
		local ti = t[newText].time
		local pos = t[newText][1]
		doTeleportThing(cid, pos, false)
		doSendMagicEffect(pos, CONST_ME_TELEPORT)
		doCreatureSetStorage(cid, st, os.time() + ti)
		doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
	end
 
	return true
end
 
LUA:
local t = {
	["Temple"] = {{x = 3000, y = 2098, z = 7}, storage = 1337, time = 30},	
	["Teleports"] = {{x = 2815, y = 2025, z = 7}, storage = 1338, time = 30},
	["Addons"] = {{x = 1266, y = 880, z = 7}, storage = 1339, time = 30},
	["Addon Bosses"] = {{x = 1127, y = 907,z = 6}, storage = 1340, time = 30},
	["Trainers"] = {{x = 2877, y = 2005, z = 7}, storage = 1341, time = 30},
	["Donation Quest"] = {{x = 3160, y = 1572, z = 7}, storage = 1342, time = 30},
	["Shops"] = {{x = 2940, y = 2075, z = 7}, storage = 1343, time = 30},
	["Sailors Quarter"] = {{x = 3010, y = 2192, z = 6}, storage = 1344, time = 30}
}
 
function onTextEdit(cid, item, newText)
	if item.itemid == 1949 then
		if isInArray({'locations', 'places', 'place'}, newText) then
			local i = ''
			for text, x in pairs(t) do
				i = i .. " [" .. text .. "]"
			end
 
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleportation Locations: " .. i)
			return true
		end
 
		if isPlayerPzLocked(cid) then
			doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
			return true
		end
 
		local st = t[newText].storage
		if getCreatureStorage(cid, st) > os.time() then
			doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. ((getCreatureStorage(cid, st) - os.time()) == 1 and "" or "s") .. " to travel here again.", TALKTYPE_MONSTER)
			return true
		end
 
		local ti = t[newText].time
		local pos = t[newText][1]
		doTeleportThing(cid, pos, false)
		doSendMagicEffect(pos, CONST_ME_TELEPORT)
		doCreatureSetStorage(cid, st, os.time() + ti)
		doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
	end
 
	return true
end
 
Code:
[06/08/2011 11:16:00] [Error - CreatureScript Interface] 
[06/08/2011 11:16:00] data/creaturescripts/scripts/teleportpaper.lua:onTextEdit
[06/08/2011 11:16:00] Description: 
[06/08/2011 11:16:00] data/creaturescripts/scripts/teleportpaper.lua:29: attempt to index field '?' (a nil value)
[06/08/2011 11:16:00] stack traceback:
[06/08/2011 11:16:00] 	data/creaturescripts/scripts/teleportpaper.lua:29: in function <data/creaturescripts/scripts/teleportpaper.lua:12>
 
try this
Code:
local t = {
	["Temple"] = {pos = {x = 3000, y = 2098, z = 7}, storage = 1337, time = 30},	
	["Teleports"] = {pos = {x = 2815, y = 2025, z = 7}, storage = 1338, time = 30},
	["Addons"] = {pos = {x = 1266, y = 880, z = 7}, storage = 1339, time = 30},
	["Addon Bosses"] = {pos = {x = 1127, y = 907,z = 6}, storage = 1340, time = 30},
	["Trainers"] = {pos = {x = 2877, y = 2005, z = 7}, storage = 1341, time = 30},
	["Donation Quest"] = {pos = {x = 3160, y = 1572, z = 7}, storage = 1342, time = 30},
	["Shops"] = {pos = {x = 2940, y = 2075, z = 7}, storage = 1343, time = 30},
	["Sailors Quarter"] = {pos = {x = 3010, y = 2192, z = 6}, storage = 1344, time = 30}
}
 
function onTextEdit(cid, item, newText)
	if item.itemid == 1949 then
		if isInArray({'locations', 'places', 'place'}, newText) then
			local i = ''
			for text, x in pairs(t) do
				i = i .. " [" .. text .. "]"
			end
 
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleportation Locations: " .. i)
		elseif isPlayerPzLocked(cid) then
			doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
		else
			local p = t[newText]
			if not p then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
				return false
			end

			local st = p.storage
			if getCreatureStorage(cid, st) > os.time() then
				doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
				return true
			end

			local ti = p.time
			local pos = p.pos
			doTeleportThing(cid, pos, true)
			doSendMagicEffect(pos, CONST_ME_TELEPORT)
			doCreatureSetStorage(cid, st, os.time() + ti)
			doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
		end
	end
	return true
end
 
Last edited:
Why are all my scripts like an error machine? lol

Code:
[06/08/2011 11:40:59] [Error - LuaScriptInterface::loadFile] data/creaturescripts/scripts/teleportpaper.lua:47: '<eof>' expected near 'end'
[06/08/2011 11:40:59] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/teleportpaper.lua)
[06/08/2011 11:40:59] data/creaturescripts/scripts/teleportpaper.lua:47: '<eof>' expected near 'end'
 
LuLzScript
Boys and Girls let's set sail for fail!
Script will still be usable during battles.
LUA:
local t = {
	["Temple"] = {pos = {x = 3000, y = 2098, z = 7}, storage = 1337, time = 30},	
	["Teleports"] = {pos = {x = 2815, y = 2025, z = 7}, storage = 1338, time = 30},
	["Addons"] = {pos = {x = 1266, y = 880, z = 7}, storage = 1339, time = 30},
	["Addon Bosses"] = {pos = {x = 1127, y = 907,z = 6}, storage = 1340, time = 30},
	["Trainers"] = {pos = {x = 2877, y = 2005, z = 7}, storage = 1341, time = 30},
	["Donation Quest"] = {pos = {x = 3160, y = 1572, z = 7}, storage = 1342, time = 30},
	["Shops"] = {pos = {x = 2940, y = 2075, z = 7}, storage = 1343, time = 30},
	["Sailors Quarter"] = {pos = {x = 3010, y = 2192, z = 6}, storage = 1344, time = 30}
}
 
function onTextEdit(cid, item, newText)
	if item.itemid == 1949 then
		if isPlayerPzLocked(cid) then
			doCreatureSay(cid, "You are in a battle!", TALKTYPE_MONSTER)
			return false
		end	
		if isInArray({'locations', 'places', 'place'}, newText) then
			local i = ''
			for text, x in pairs(t) do
				i = i .. "\n[" .. text .. "]"
			end
 
			doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Current Teleportation Locations: " .. i)
		else
			local p = t[newText]
			if not p then
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "Invalid location")
				return false
			end

			local st = p.storage
			if getCreatureStorage(cid, st) > os.time() then
				doCreatureSay(cid, "You must wait another " .. getCreatureStorage(cid, st) - os.time() .. ' second' .. (getCreatureStorage(cid, st) - os.time() == 1 and "" or "s") .. " to travel there again.", TALKTYPE_MONSTER)
				return true
			end

			local ti = p.time
			local pos = p.pos
			doTeleportThing(cid, pos, true)
			doSendMagicEffect(pos, CONST_ME_TELEPORT)
			doCreatureSetStorage(cid, st, os.time() + ti)
			doCreatureSay(cid, "You have been teleported!", TALKTYPE_MONSTER)
		end
	end
	return true
end
 
Back
Top