• 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 Most likely lib, compat, or global issues

aalqaq2

Trying to help, but I'm not too good at it.
Joined
Apr 10, 2017
Messages
112
Solutions
3
Reaction score
8
If anyone has any tips, I would really appreciate the help. Any files that you need me to post I'll be more than happy to.

data/actions/scripts/quests/holyWater.lua
data/actions/scripts/quests/holyWater.lua:23: attempt to index global 'Storage' (a nil value)
stack traceback:
[C]: in function '__index'
data/actions/scripts/quests/holyWater.lua:23: in main chunk
[Warning - Event::checkScript] Can not load script: scripts/quests/holyWater.lua


Lua Script Error: [Action Interface]
data/actions/scripts/buy_potions.lua: onUse
data/actions/scripts/buy_potions.lua:25: attempt to call method 'sendShopWindow' (a nil value)
stack traceback:
[C]: in function 'sendShopWindow'
data/actions/scripts/buy_potions.lua:25: in function <data/actions/scripts/buy_potions.lua:24>


Lua Script Error: [TalkAction Interface]
data/talkactions/scripts/reload.lua: onSay
data/talkactions/lib/talkactions.lua:10: attempt to call method 'trim' (a nil value)
stack traceback:
[C]: in function 'trim'
data/talkactions/lib/talkactions.lua:10: in function 'logCommand'
data/talkactions/scripts/reload.lua:65: in function <data/talkactions/scripts/reload.lua:56>


Lua Script Error: [Spell Interface]
data/spells/scripts/monster/energized raging mage skill reducer.lua
luaCreateCombatArea(). Invalid area table.
stack traceback:
[C]: in function 'createCombatArea'
.../scripts/monster/energized raging mage skill reducer.lua:4: in main chunk


Lua Script Error: [Spell Interface]
data/spells/scripts/monster/energized raging mage skill reducer.lua
luaCombatSetArea(). Area not found
stack traceback:
[C]: in function 'setArea'
.../scripts/monster/energized raging mage skill reducer.lua:5: in main chunk


Lua Script Error: [Npc interface]
data/npc/scripts/captain tibianus.lua
data/npc/scripts/captain tibianus.lua:13: attempt to call method 'titleCase' (a nil value)
stack traceback:
[C]: in function 'titleCase'
data/npc/scripts/captain tibianus.lua:13: in function 'addTravelKeyword'
data/npc/scripts/captain tibianus.lua:18: in main chunk
[Warning - NpcScript::NpcScript] Can not load script: captain tibianus.lua

data/npc/scripts/The Oracle.lua:178: unexpected symbol near ']'
 
Solution
Global: replace the file
Holy water: You are missing a table called Storage, if you are using ORTS you can add this; server/051-storages.lua at master · orts/server · GitHub
Buy potions: Player:sendShopWindow does not exist, (is it an OTX datapack or some custom function?)
Raging amge: AREA_CROSS6X6 is missing, check your lib (forgottenserver/spells.lua at master · otland/forgottenserver · GitHub), if you have that use AREA_CIRCLE6X6 insted.
Captain Tibianus: Missing libs again; server/string.lua at df28e225b3a1000872ee8cd7e9756ec0ff93ed01 · orts/server · GitHub
The oracle:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local...
Rules for the Support board
#5

Post these scripts;
Can not load script: scripts/quests/holyWater.lua
in function <data/actions/scripts/buy_potions.lua:24>
.../scripts/monster/energized raging mage skill reducer.lua:4: in main chunk
.../scripts/monster/energized raging mage skill reducer.lua:5: in main chunk
data/npc/scripts/captain tibianus.lua:13: attempt to call method 'titleCase' (a nil value)
data/npc/scripts/The Oracle.lua:178: unexpected symbol near ']'

To fix reload.lua, update global.lua forgottenserver/global.lua at master · otland/forgottenserver · GitHub
This is missing, probbly more;
Lua:
string.trim = function(str)
return str:match'^()%s*$' and '' or str:match'^%s*(.*%S)'
end
 
Sorry...Here's more information:

Server: The Forgotten Server 1.3
Client 10.98

My Global.lua:
Lua:
dofile('data/lib/lib.lua')
--Potion Buying Lever
dofile('data/lib/buy_potions.lua')
-- AutoLoot config
AUTO_LOOT_MAX_ITEMS = 5
-- Reserved storage
AUTOLOOT_STORAGE_START = 10000
AUTOLOOT_STORAGE_END = AUTOLOOT_STORAGE_START + AUTO_LOOT_MAX_ITEMS
-- AutoLoot config end
STORAGEVALUE_PROMOTION = 30018
ropeSpots = {384, 418, 8278, 8592, 13189, 14435, 14436, 15635, 19518}
doors = {[1209] = 1211, [1210] = 1211, [1212] = 1214, [1213] = 1214, [1219] = 1220, [1221] = 1222, [1231] = 1233, [1232] = 1233, [1234] = 1236, [1235] = 1236, [1237] = 1238, [1239] = 1240, [1249] = 1251, [1250] = 1251, [1252] = 1254, [1253] = 1254, [1539] = 1540, [1541] = 1542, [3535] = 3537, [3536] = 3537, [3538] = 3539, [3544] = 3546, [3545] = 3546, [3547] = 3548, [4913] = 4915, [4914] = 4915, [4916] = 4918, [4917] = 4918, [5082] = 5083, [5084] = 5085, [5098] = 5100, [5099] = 5100, [5101] = 5102, [5107] = 5109, [5108] = 5109, [5110] = 5111, [5116] = 5118, [5117] = 5118, [5119] = 5120, [5125] = 5127, [5126] = 5127, [5128] = 5129, [5134] = 5136, [5135] = 5136, [5137] = 5139, [5138] = 5139, [5140] = 5142, [5141] = 5142, [5143] = 5145, [5144] = 5145, [5278] = 5280, [5279] = 5280, [5281] = 5283, [5282] = 5283, [5284] = 5285, [5286] = 5287, [5515] = 5516, [5517] = 5518, [5732] = 5734, [5733] = 5734, [5735] = 5737, [5736] = 5737, [6192] = 6194, [6193] = 6194, [6195] = 6197, [6196] = 6197, [6198] = 6199, [6200] = 6201, [6249] = 6251, [6250] = 6251, [6252] = 6254, [6253] = 6254, [6255] = 6256, [6257] = 6258, [6795] = 6796, [6797] = 6798, [6799] = 6800, [6801] = 6802, [6891] = 6893, [6892] = 6893, [6894] = 6895, [6900] = 6902, [6901] = 6902, [6903] = 6904, [7033] = 7035, [7034] = 7035, [7036] = 7037, [7042] = 7044, [7043] = 7044, [7045] = 7046, [7054] = 7055, [7056] = 7057, [8541] = 8543, [8542] = 8543, [8544] = 8546, [8545] = 8546, [8547] = 8548, [8549] = 8550, [9165] = 9167, [9166] = 9167, [9168] = 9170, [9169] = 9170, [9171] = 9172, [9173] = 9174, [9267] = 9269, [9268] = 9269, [9270] = 9272, [9271] = 9272, [9273] = 9274, [9275] = 9276, [10276] = 10277, [10274] = 10275, [10268] = 10270, [10269] = 10270, [10271] = 10273, [10272] = 10273, [10471] = 10472, [10480] = 10481, [10477] = 10479, [10478] = 10479, [10468] = 10470, [10469] = 10470, [10775] = 10777, [10776] = 10777, [12092] = 12094, [12093] = 12094, [12188] = 12190, [12189] = 12190, [19840] = 19842, [19841] = 19842, [19843] = 19844, [19980] = 19982, [19981] = 19982, [19983] = 19984, [20273] = 20275, [20274] = 20275, [20276] = 20277, [17235] = 17236, [18208] = 18209, [13022] = 13023, [10784] = 10786, [10785] = 10786, [12099] = 12101, [12100] = 12101, [12197] = 12199, [12198] = 12199, [19849] = 19851, [19850] = 19851, [19852] = 19853, [19989] = 19991, [19990] = 19991, [19992] = 19993, [20282] = 20284, [20283] = 20284, [20285] = 20286, [17237] = 17238, [13020] = 13021, [10780] = 10781, [12095] = 12096, [12195] = 12196, [19845] = 19846, [19985] = 19986, [20278] = 20279, [10789] = 10790, [12102] = 12103, [12204] = 12205, [19854] = 19855, [19994] = 19995, [20287] = 20288, [10782] = 10783, [12097] = 12098, [12193] = 12194, [19847] = 19848, [19987] = 19988, [20280] = 20281, [10791] = 10792, [12104] = 12105, [12202] = 12203, [19856] = 19857, [19996] = 19997, [20289] = 20290}
verticalOpenDoors = {1211, 1220, 1224, 1228, 1233, 1238, 1242, 1246, 1251, 1256, 1260, 1540, 3546, 3548, 3550, 3552, 4915, 5083, 5109, 5111, 5113, 5115, 5127, 5129, 5131, 5133, 5142, 5145, 5283, 5285, 5289, 5293, 5516, 5737, 5749, 6194, 6199, 6203, 6207, 6251, 6256, 6260, 6264, 6798, 6802, 6902, 6904, 6906, 6908, 7044, 7046, 7048, 7050, 7055, 8543, 8548, 8552, 8556, 9167, 9172, 9269, 9274, 9274, 9269, 9278, 9282, 10270, 10275, 10279, 10283, 10479, 10481, 10485, 10483, 10786, 12101, 12199, 19851, 19853, 19991, 19993, 20284, 20286, 17238, 13021, 10790, 12103, 12205, 19855, 19995, 20288, 10792, 12105, 12203, 19857, 19997, 20290}
horizontalOpenDoors = {1214, 1222, 1226, 1230, 1236, 1240, 1244, 1248, 1254, 1258, 1262, 1542, 3537, 3539, 3541, 3543, 4918, 5085, 5100, 5102, 5104, 5106, 5118, 5120, 5122, 5124, 5136, 5139, 5280, 5287, 5291, 5295, 5518, 5734, 5746, 6197, 6201, 6205, 6209, 6254, 6258, 6262, 6266, 6796, 6800, 6893, 6895, 6897, 6899, 7035, 7037, 7039, 7041, 7057, 8546, 8550, 8554, 8558, 9170, 9174, 9272, 9276, 9280, 9284, 10273, 10277, 10281, 10285, 10470, 10472, 10476, 10474, 10777, 12094, 12190, 19842, 19844, 19982, 19984, 20275, 20277, 17236, 18209, 13023, 10781, 12096, 12196, 19846, 19986, 20279, 10783, 12098, 12194, 19848, 19988, 20281}
openSpecialDoors = {1224, 1226, 1228, 1230, 1242, 1244, 1246, 1248, 1256, 1258, 1260, 1262, 3541, 3543, 3550, 3552, 5104, 5106, 5113, 5115, 5122, 5124, 5131, 5133, 5289, 5291, 5293, 5295, 6203, 6205, 6207, 6209, 6260, 6262, 6264, 6266, 6897, 6899, 6906, 6908, 7039, 7041, 7048, 7050, 8552, 8554, 8556, 8558, 9176, 9178, 9180, 9182, 9278, 9280, 9282, 9284, 10279, 10281, 10283, 10285, 10474, 10476, 10483, 10485, 10781, 12096, 12196, 19846, 19986, 20279, 10783, 12098, 12194, 19848, 19988, 20281, 10790, 12103, 12205, 19855, 19995, 20288, 10792, 12105, 12203, 19857, 19997, 20290}
questDoors = {1223, 1225, 1241, 1243, 1255, 1257, 3542, 3551, 5105, 5114, 5123, 5132, 5288, 5290, 5745, 5748, 6202, 6204, 6259, 6261, 6898, 6907, 7040, 7049, 8551, 8553, 9175, 9177, 9277, 9279, 10278, 10280, 10475, 10484, 10782, 10791, 12097, 12104, 12193, 12202, 19847, 19856, 19987, 19996, 20280, 20289}
levelDoors = {1227, 1229, 1245, 1247, 1259, 1261, 3540, 3549, 5103, 5112, 5121, 5130, 5292, 5294, 6206, 6208, 6263, 6265, 6896, 6905, 7038, 7047, 8555, 8557, 9179, 9181, 9281, 9283, 10282, 10284, 10473, 10482, 10780, 10789, 10780, 12095, 12102, 12204, 12195, 19845, 19854, 19985, 19994, 20278, 20287}
keys = {2086, 2087, 2088, 2089, 2090, 2091, 2092, 10032}
function getDistanceBetween(firstPosition, secondPosition)
 local xDif = math.abs(firstPosition.x - secondPosition.x)
 local yDif = math.abs(firstPosition.y - secondPosition.y)
 local posDif = math.max(xDif, yDif)
 if firstPosition.z ~= secondPosition.z then
  posDif = posDif + 15
 end
 return posDif
end
function getFormattedWorldTime()
 local worldTime = getWorldTime()
 local hours = math.floor(worldTime / 60)
 local minutes = worldTime % 60
 if minutes < 10 then
  minutes = '0' .. minutes
 end
 return hours .. ':' .. minutes
end
table.contains = function(array, value)
 for _, targetColumn in pairs(array) do
  if targetColumn == value then
   return true
  end
 end
 return false
end
string.split = function(str, sep)
 local res = {}
 for v in str:gmatch("([^" .. sep .. "]+)") do
  res[#res + 1] = v
 end
 return res
end
string.trim = function(str)
 return str:match'^()%s*$' and '' or str:match'^%s*(.*%S)'
end
if not nextUseStaminaTime then
 nextUseStaminaTime = {}
end


Error 1 (Holy Water):
Lua:
local doorPosition = Position(32260, 32791, 7)
local shadowNexusPosition = Position(33115, 31702, 12)
local effectPositions = {
 Position(33113, 31702, 12),
 Position(33116, 31702, 12)
}
local function revertItem(position, itemId, transformId)
 local item = Tile(position):getItemById(itemId)
 if item then
  item:transform(transformId)
 end
end
local function nexusMessage(player, message)
 local spectators = Game.getSpectators(shadowNexusPosition, false, true, 3, 3)
 for i = 1, #spectators do
  player:say(message, TALKTYPE_MONSTER_YELL, false, spectators[i], shadowNexusPosition)
 end
end
local storages = {
 [4008] = Storage.TibiaTales.RestInHallowedGround.Graves.Grave1,
 [4009] = Storage.TibiaTales.RestInHallowedGround.Graves.Grave2,
 [4010] = Storage.TibiaTales.RestInHallowedGround.Graves.Grave3,
 [4011] = Storage.TibiaTales.RestInHallowedGround.Graves.Grave4,
 [4012] = Storage.TibiaTales.RestInHallowedGround.Graves.Grave5,
 [4013] = Storage.TibiaTales.RestInHallowedGround.Graves.Grave6,
 [4014] = Storage.TibiaTales.RestInHallowedGround.Graves.Grave7,
 [4015] = Storage.TibiaTales.RestInHallowedGround.Graves.Grave8,
 [4016] = Storage.TibiaTales.RestInHallowedGround.Graves.Grave9,
 [4017] = Storage.TibiaTales.RestInHallowedGround.Graves.Grave10,
 [4018] = Storage.TibiaTales.RestInHallowedGround.Graves.Grave11,
 [4019] = Storage.TibiaTales.RestInHallowedGround.Graves.Grave12,
 [4020] = Storage.TibiaTales.RestInHallowedGround.Graves.Grave13,
 [4021] = Storage.TibiaTales.RestInHallowedGround.Graves.Grave14,
 [4022] = Storage.TibiaTales.RestInHallowedGround.Graves.Grave15,
 [4023] = Storage.TibiaTales.RestInHallowedGround.Graves.Grave16
}
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
 -- Eclipse
 if target.actionid == 2000 then
  item:remove(1)
  toPosition:sendMagicEffect(CONST_ME_FIREAREA)
  -- The Inquisition Questlog- 'Mission 2: Eclipse'
  player:setStorageValue(Storage.TheInquisition.Mission02, 2)
  player:setStorageValue(Storage.TheInquisition.Questline, 5)
  return true
 -- Haunted Ruin
 elseif target.actionid == 2003 then
  if player:getStorageValue(Storage.TheInquisition.Questline) ~= 12 then
   return true
  end
  Game.createMonster('Pirate Ghost', toPosition)
  item:remove(1)
  -- The Inquisition Questlog- 'Mission 4: The Haunted Ruin'
  player:setStorageValue(Storage.TheInquisition.Questline, 13)
  player:setStorageValue(Storage.TheInquisition.Mission04, 2)
  local doorItem = Tile(doorPosition):getItemById(8697)
  if doorItem then
   doorItem:transform(8696)
  end
  addEvent(revertItem, 10 * 1000, doorPosition, 8696, 8697)
  return true
 end
 -- Shadow Nexus
 if isInArray({8753, 8755, 8757}, target.itemid) then
  target:transform(target.itemid + 1)
  target:decay()
  nexusMessage(player, player:getName() .. ' damaged the shadow nexus! You can\'t damage it while it\'s burning.')
  shadowNexusPosition:sendMagicEffect(CONST_ME_HOLYAREA)
 elseif target.itemid == 8759 then
  if player:getStorageValue(Storage.TheInquisition.Questline) < 22 then
   -- The Inquisition Questlog- 'Mission 7: The Shadow Nexus'
   player:setStorageValue(Storage.TheInquisition.Mission07, 2)
   player:setStorageValue(Storage.TheInquisition.Questline, 22)
  end
  for i = 1, #effectPositions do
   effectPositions[i]:sendMagicEffect(CONST_ME_HOLYAREA)
  end
  nexusMessage(player, player:getName() .. ' destroyed the shadow nexus! In 20 seconds it will return to its original state.')
  item:remove(1)
 elseif target.actionid > 4007 and target.actionid < 4024 then
  local graveStorage = storages[target.actionid]
  if player:getStorageValue(graveStorage) == 1
    or player:getStorageValue(Storage.TibiaTales.RestInHallowedGround.Questline) ~= 3 then
   return false
  end
  player:setStorageValue(graveStorage, 1)
  local cStorage = player:getStorageValue(Storage.TibiaTales.RestInHallowedGround.HolyWater)
  if cStorage < 14 then
   player:setStorageValue(Storage.TibiaTales.RestInHallowedGround.HolyWater, math.max(0, cStorage) + 1)
  elseif cStorage == 14 then
   player:setStorageValue(Storage.TibiaTales.RestInHallowedGround.HolyWater, -1)
   player:setStorageValue(Storage.TibiaTales.RestInHallowedGround.Questline, 4)
   item:transform(2006, 0)
  end
  toPosition:sendMagicEffect(CONST_ME_MAGIC_BLUE)
 end
 return true
end

Error 2 (buy potions):
Lua:
local potions = {
-- Config
 titleMsg = "Choose your Potion",
 mainMsg = "Please select how many potions you would like to buy.",
 moneyMsg = "You do not have enough money!", -- This is the message the player will recieve when he does not have enough money.
 capacityMsg = "I need more cap", -- This is the message the player will recieve when he does not have enough capactiy.
 buyMsg = "You have bought ", -- This is the message the player will recieve when he succesfully buys.
-- End Config
 -- Change prices in this table here price10 = price for 10 potions etc.
    [1] = {potion = "Health Potion", itemID = 7618, price10 = 450, price50 = 2250, price100 = 4500},
    [2] = {potion = "Strong Health Potion", itemID = 7588, price10 = 1000, price50 = 5000, price100 = 10000},
    [3] = {potion = "Great Health Potion", itemID = 7591, price10 = 1900, price50 = 9500, price100 = 19000},
    [4] = {potion = "Ultimate Health Potion", itemID = 8473, price10 = 3100, price50 = 15500, price100 = 31000},
    --[5] = {potion = "Supreme Health Potion", itemID = 7618, price10 = 760, price50 = 760, price100 = 760},
    [6] = {potion = "Mana Potion", itemID = 7620, price10 = 500, price50 = 2500, price100 = 5000},
    [7] = {potion = "Strong Mana Potion", itemID = 7589, price10 = 800, price50 = 4000, price100 = 8000},
    [8] = {potion = "Great Mana Potion", itemID = 7590, price10 = 1200, price50 = 6000, price100 = 12000},
    --[9] = {potion = "Ultimate Mana Potion", itemID = 7618, price10 = 760, price50 = 760, price100 = 760},
    [10] = {potion = "Great Spirit Potion", itemID = 8472, price10 = 1900, price50 = 9500, price100 = 19000},
    --[11] = {potion = "Ultimate Spirit Potion", itemID = 7618, price10 = 760, price50 = 760, price100 = 760},
}
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
    player:sendShopWindow(potions)
    return true
end


Error 4 (Energized Raging Mage):
Lua:
local combat = Combat()
combat:setParameter(COMBAT_PARAM_EFFECT, CONST_ME_ENERGYHIT)
local area = createCombatArea(AREA_CROSS6X6)
combat:setArea(area)
local condition = Condition(CONDITION_ATTRIBUTES)
condition:setParameter(CONDITION_PARAM_TICKS, 6000)
condition:setParameter(CONDITION_PARAM_SKILL_DISTANCEPERCENT, 50)
combat:setCondition(condition)
function onCastSpell(creature, variant)
 return combat:execute(creature, variant)
end


Error 6 (Captain Tibianus):
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
-- Travel
local function addTravelKeyword(keyword, cost, destination)
local travelKeyword = keywordHandler:addKeyword({keyword}, StdModule.say, {npcHandler = npcHandler, text = 'Do you seek a passage to ' .. keyword:titleCase() .. ' for |TRAVELCOST|?', cost = cost, discount = 'postman'})
travelKeyword:addChildKeyword({'yes'}, StdModule.travel, {npcHandler = npcHandler, premium = true, cost = cost, discount = 'postman', destination = destination})
travelKeyword:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, text = 'We would like to serve you some time.', reset = true})
end
addTravelKeyword('thais', 170, Position(32310, 32210, 6))
addTravelKeyword('venore', 150, Position(32955, 32025, 6))
addTravelKeyword('kazordoon', 130, Position(32569, 31957, 15))
addTravelKeyword('carlin', 130, Position(32387, 31820, 6))
addTravelKeyword('ab\'dendriel', 90, Position(32734, 31668, 6))
addTravelKeyword('liberty bay', 180, Position(32285, 32892, 6))
addTravelKeyword('port hope', 160, Position(32527, 32784, 6))
addTravelKeyword('ankrahmun', 150, Position(33092, 32883, 6))
addTravelKeyword('darashia', 110, Position(33289, 32481, 6))
addTravelKeyword('edron', 40, Position(33173, 31764, 6))
addTravelKeyword('svargrond', 150, Position(32341, 31108, 6))
addTravelKeyword('yalahar', 185, Position(32816, 31272, 6))
addTravelKeyword('farmine', 150, Position(33024, 31151, 10))
addTravelKeyword('gray beach', 250, Position(33196, 31984, 7))
addTravelKeyword('roshamuul', 250, Position(33495, 32569, 7))
addTravelKeyword('rathleton', 250, Position(33645, 31988, 6))

addTravelKeyword('trainer', 180, Position(21155, 16535, 7))
addTravelKeyword('rookgaard ruins', 200, Position(31972, 32278, 6))
addTravelKeyword('island of destruction', 200, Position(32098, 31969, 6))
addTravelKeyword('damshire', 240, Position(32912, 33064, 6))
addTravelKeyword('adriatica', 130, Position(32632, 33350, 5))

-- Basic
keywordHandler:addKeyword({'sail'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Thais}, {Carlin}, {Ab\'Dendriel}, {Port Hope}, {Edron}, {Darashia}, {Liberty Bay}, {Svargrond}, {Yalahar}, {Gray Beach}, {Trainer}, {Venore}, {Kazordoon}, {Farmine}, {Roshamuul}, {Rathleton}, {Rookgaard Ruins}, {Island of Destruction}, or {Ankrahmun}?'})
keywordHandler:addKeyword({'passage'}, StdModule.say, {npcHandler = npcHandler, text = 'Where do you want to go? To {Thais}, {Carlin}, {Ab\'Dendriel}, {Port Hope}, {Edron}, {Darashia}, {Liberty Bay}, {Svargrond}, {Yalahar}, {Gray Beach}, {Trainer}, {Venore}, {Kazordoon}, {Farmine}, {Roshamuul}, {Rathleton}, {Rookgaard Ruins}, {Island of Destruction}, or {Ankrahmun}?'})
keywordHandler:addKeyword({'job'}, StdModule.say, {npcHandler = npcHandler, text = 'I am the captain of this ship, and master of the seas!'})
keywordHandler:addKeyword({'captain'}, StdModule.say, {npcHandler = npcHandler, text = 'I am the captain of this ship, and master of the seas!'})
keywordHandler:addKeyword({'tibianic'}, StdModule.say, {npcHandler = npcHandler, text = 'This is the Tibianic. Where do you want to go?'})
keywordHandler:addKeyword({'name'}, StdModule.say, {npcHandler = npcHandler, text = 'My name is Captain Tibianus!'})
npcHandler:setMessage(MESSAGE_GREET, 'Welcome aboard the Tibianic, |PLAYERNAME|. Where shall I {sail} you today?')
npcHandler:setMessage(MESSAGE_FAREWELL, 'Farewell! I hope you enjoyed the luxury of the Tibianic. Come back soon!')
npcHandler:setMessage(MESSAGE_WALKAWAY, 'Good bye then.')
npcHandler:addModule(FocusModule:new())

Error 7 (The Oracle):
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local vocation = {}
local town = {}
local destination = {}
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
local function greetCallback(cid)
 local player = Player(cid)
 local level = player:getLevel()
 if level < 8 then
  npcHandler:say("CHILD! COME BACK WHEN YOU HAVE GROWN UP!", cid)
  return false
 elseif level > 9 then
  npcHandler:say(player:getName() .. ", I CAN'T LET YOU LEAVE - YOU ARE TOO STRONG ALREADY! YOU CAN ONLY LEAVE WITH LEVEL 9 OR LOWER.", cid)
  return false
 elseif player:getVocation():getId() > 0 then
  npcHandler:say("YOU ALREADY HAVE A VOCATION!", cid)
  return false
 end
 return true
end
local towns = {
  ['thais'] = {pos = Position(32369, 32241, 7), townid = 2},
  ['venore'] = {pos = Position(32957, 32076, 7), townid = 1},
  ['carlin'] = {pos = Position(32360, 31782, 7), townid = 4},
  ["ab'dendriel"] = {pos = Position(32732, 31634, 7), townid = 5},
 
}
local vocations = {
 ['sorcerer'] = 1,
 ['druid'] = 2,
 ['paladin'] = 3,
 ['knight'] = 4
}
function names(t_, d)
  local t = {}
  for name in pairs(t_) do
      table.insert(t, name)
  end
  if not d then
    return t
  else
    return table.concat(t, d)
  end
end
-----------------------------------------
-----------------------------------------
-- Without Rookgaard
local config = {
  [1] = {
    --equipment spellbook, wand of vortex, spirit cloak, soldier helmet, plate legs, leather boots, scarf
    items = {{2175, 1}, {2190, 1}, {8870, 1}, {2481, 1},  {2647, 1}, {2661, 1}, {2643, 1}},
    --container rope, shovel, 5 mana potion, 5 health potion, 1 crystal coin, 10 orichalcum pearls
    container = {{2120, 1}, {2554, 1}, {7620, 5}, {7618, 5}, {2160, 1}, {5022, 10}}
  },
  [2] = {
    --equipment spellbook, snakebite rod, spirit cloak, soldier helmet, plate legs, leather boots, scarf
    items = {{2175, 1}, {2182, 1}, {8870, 1}, {2481, 1}, {2647, 1}, {2661, 1}, {2643, 1}},
    --container rope, shovel, 5 mana potion, 5 health potion, 1 crystal coin, 10 orichalcum pearls
    container = {{2120, 1}, {2554, 1}, {7620, 5}, {7618, 5}, {2160, 1}, {5022, 10}}
  },
  [3] = {
    --equipment dwarven shield, 1 spear, scale armor, plate legs, scarf, soldier helmet
    items = {{2525, 1}, {2389, 5}, {2483, 1}, {8923, 1}, {2647, 1}, {2661, 1}, {2481, 1}},
    --container rope, shovel, 5 health potion, 5 mana potion, bow, 50 arrow, 1 crystal coin, 10 orichalcum pearls
    container = {{2120, 1}, {2554, 1}, {7618, 5} ,{7620, 5}, {2456, 1}, {2544, 50}, {2160, 1}, {5022, 10}}
  },
  [4] = {
    --equipment dwarven shield, jaggged sword, scale armor, soldier helmet, plate legs scarf
    items = {{2525, 1}, {8602, 1}, {2483, 1}, {2460, 1}, {2478, 1}, {2643, 1}, {2661, 1}},
    --container steel axe, daramian mace, rope, shovel, 5 health potion, 5 mana potion, 1 crystal coin, 10 orichalcum pearls
    container = {{8601, 1}, {2439, 1}, {2120, 1}, {2554, 1}, {7618, 5} ,{7620, 5}, {2160, 1}, {5022, 10}}
  }
}
--------------------------------------------
--------------------------------------------

local function creatureSayCallback(cid, type, msg)
 if not npcHandler:isFocused(cid) then
  return false
 end
 if msgcontains(msg, "yes") and npcHandler.topic[cid] == 0 then
        npcHandler:say("IN WHICH TOWN DO YOU WANT TO LIVE: {"..names(towns, ", "):upper().."}?", cid)
        npcHandler.topic[cid] = 1
 elseif npcHandler.topic[cid] == 1 then
        local nameOfTown = msg:lower()
        if isInArray(names(towns), nameOfTown) then
            town[cid] = towns[nameOfTown].townid
            destination[cid] = towns[nameOfTown].pos
            npcHandler:say("IN "..nameOfTown:upper().."! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
            npcHandler.topic[cid] = 2
        else
            npcHandler:say("IN WHICH TOWN DO YOU WANT TO LIVE: {"..names(towns, ", "):upper().."}?", cid)
        end
 elseif npcHandler.topic[cid] == 2 then
  local voc = msg:lower()
  if isInArray(names(vocations), voc) then
   npcHandler:say("A "..voc:upper().."! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
   npcHandler.topic[cid] = 3
   vocation[cid] = vocations[voc]
  else
   npcHandler:say("{KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
  end
 elseif npcHandler.topic[cid] == 3 then
  if msgcontains(msg, "yes") then
   local player = Player(cid)
   npcHandler:say("SO BE IT!", cid)
   player:setVocation(Vocation(vocation[cid]))
   player:setTown(Town(town[cid]))
   local destination = destination[cid]
   npcHandler:releaseFocus(cid)
   player:teleportTo(destination)
   player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
   destination:sendMagicEffect(CONST_ME_TELEPORT)
 
   ------------------------------------
   ------------------------------------
   ------------------------------------
   -- With Rookgaard
local firstItems = {2480, 2464, 2468, 2643, 2530, 2383,1988}
--function onLogin(cid)
 local player = Player(cid)
 --if player:getLastLoginSaved() <= 0 then
  for i = 1, #firstItems do
   player:removeItem(firstItems[i], 1)
  end
  --player:addItem(player:getSex() == 0 and 2651 or 2650, 1)
  --player:addItem(1988, 1)
  --player:addItem(2674, 1)
  --player:addItem(2120, 1)
  --player:addItem(2554, 1)
 --end
 --return true
--end
 local player = Player(cid)
 local targetVocation = config[player:getVocation():getId()]
 if not targetVocation then
  return true
 end
 -- if player:getLastLoginSaved() ~= 0 then
  -- return true
 -- end
 for i = 1, #targetVocation.items do
  player:addItem(targetVocation.items[i][1], targetVocation.items[i][2])
 end
 local backpack = player:addItem(1988)
 if not backpack then
  return true
 end
 for i = 1, #targetVocation.container do
  backpack:addItem(targetVocation.container[i][1], targetVocation.container[i][2])
 end
-- return true
--end
]]--
------------------------------------
------------------------------------
------------------------------------
  else
   npcHandler:say("THEN WHAT? {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
   npcHandler.topic[cid] = 2
  end
 end
 return true
end
local function onAddFocus(cid)
 town[cid] = 0
 vocation[cid] = 0
 destination[cid] = 0
end
local function onReleaseFocus(cid)
 town[cid] = nil
 vocation[cid] = nil
 destination[cid] = nil
end
npcHandler:setCallback(CALLBACK_ONADDFOCUS, onAddFocus)
npcHandler:setCallback(CALLBACK_ONRELEASEFOCUS, onReleaseFocus)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Global: replace the file
Holy water: You are missing a table called Storage, if you are using ORTS you can add this; server/051-storages.lua at master · orts/server · GitHub
Buy potions: Player:sendShopWindow does not exist, (is it an OTX datapack or some custom function?)
Raging amge: AREA_CROSS6X6 is missing, check your lib (forgottenserver/spells.lua at master · otland/forgottenserver · GitHub), if you have that use AREA_CIRCLE6X6 insted.
Captain Tibianus: Missing libs again; server/string.lua at df28e225b3a1000872ee8cd7e9756ec0ff93ed01 · orts/server · GitHub
The oracle:
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local vocation = {}
local town = {}
local destination = {}
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
local function greetCallback(cid)
 local player = Player(cid)
 local level = player:getLevel()
 if level < 8 then
  npcHandler:say("CHILD! COME BACK WHEN YOU HAVE GROWN UP!", cid)
  return false
 elseif level > 9 then
  npcHandler:say(player:getName() .. ", I CAN'T LET YOU LEAVE - YOU ARE TOO STRONG ALREADY! YOU CAN ONLY LEAVE WITH LEVEL 9 OR LOWER.", cid)
  return false
 elseif player:getVocation():getId() > 0 then
  npcHandler:say("YOU ALREADY HAVE A VOCATION!", cid)
  return false
 end
 return true
end
local towns = {
  ['thais'] = {pos = Position(32369, 32241, 7), townid = 2},
  ['venore'] = {pos = Position(32957, 32076, 7), townid = 1},
  ['carlin'] = {pos = Position(32360, 31782, 7), townid = 4},
  ["ab'dendriel"] = {pos = Position(32732, 31634, 7), townid = 5},

}
local vocations = {
 ['sorcerer'] = 1,
 ['druid'] = 2,
 ['paladin'] = 3,
 ['knight'] = 4
}
function names(t_, d)
  local t = {}
  for name in pairs(t_) do
      table.insert(t, name)
  end
  if not d then
    return t
  else
    return table.concat(t, d)
  end
end
-----------------------------------------
-----------------------------------------
-- Without Rookgaard
local config = {
  [1] = {
    --equipment spellbook, wand of vortex, spirit cloak, soldier helmet, plate legs, leather boots, scarf
    items = {{2175, 1}, {2190, 1}, {8870, 1}, {2481, 1},  {2647, 1}, {2661, 1}, {2643, 1}},
    --container rope, shovel, 5 mana potion, 5 health potion, 1 crystal coin, 10 orichalcum pearls
    container = {{2120, 1}, {2554, 1}, {7620, 5}, {7618, 5}, {2160, 1}, {5022, 10}}
  },
  [2] = {
    --equipment spellbook, snakebite rod, spirit cloak, soldier helmet, plate legs, leather boots, scarf
    items = {{2175, 1}, {2182, 1}, {8870, 1}, {2481, 1}, {2647, 1}, {2661, 1}, {2643, 1}},
    --container rope, shovel, 5 mana potion, 5 health potion, 1 crystal coin, 10 orichalcum pearls
    container = {{2120, 1}, {2554, 1}, {7620, 5}, {7618, 5}, {2160, 1}, {5022, 10}}
  },
  [3] = {
    --equipment dwarven shield, 1 spear, scale armor, plate legs, scarf, soldier helmet
    items = {{2525, 1}, {2389, 5}, {2483, 1}, {8923, 1}, {2647, 1}, {2661, 1}, {2481, 1}},
    --container rope, shovel, 5 health potion, 5 mana potion, bow, 50 arrow, 1 crystal coin, 10 orichalcum pearls
    container = {{2120, 1}, {2554, 1}, {7618, 5} ,{7620, 5}, {2456, 1}, {2544, 50}, {2160, 1}, {5022, 10}}
  },
  [4] = {
    --equipment dwarven shield, jaggged sword, scale armor, soldier helmet, plate legs scarf
    items = {{2525, 1}, {8602, 1}, {2483, 1}, {2460, 1}, {2478, 1}, {2643, 1}, {2661, 1}},
    --container steel axe, daramian mace, rope, shovel, 5 health potion, 5 mana potion, 1 crystal coin, 10 orichalcum pearls
    container = {{8601, 1}, {2439, 1}, {2120, 1}, {2554, 1}, {7618, 5} ,{7620, 5}, {2160, 1}, {5022, 10}}
  }
}
--------------------------------------------
--------------------------------------------

local function creatureSayCallback(cid, type, msg)
 if not npcHandler:isFocused(cid) then
  return false
 end
 if msgcontains(msg, "yes") and npcHandler.topic[cid] == 0 then
        npcHandler:say("IN WHICH TOWN DO YOU WANT TO LIVE: {"..names(towns, ", "):upper().."}?", cid)
        npcHandler.topic[cid] = 1
 elseif npcHandler.topic[cid] == 1 then
        local nameOfTown = msg:lower()
        if isInArray(names(towns), nameOfTown) then
            town[cid] = towns[nameOfTown].townid
            destination[cid] = towns[nameOfTown].pos
            npcHandler:say("IN "..nameOfTown:upper().."! AND WHAT PROFESSION HAVE YOU CHOSEN: {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
            npcHandler.topic[cid] = 2
        else
            npcHandler:say("IN WHICH TOWN DO YOU WANT TO LIVE: {"..names(towns, ", "):upper().."}?", cid)
        end
 elseif npcHandler.topic[cid] == 2 then
  local voc = msg:lower()
  if isInArray(names(vocations), voc) then
   npcHandler:say("A "..voc:upper().."! ARE YOU SURE? THIS DECISION IS IRREVERSIBLE!", cid)
   npcHandler.topic[cid] = 3
   vocation[cid] = vocations[voc]
  else
   npcHandler:say("{KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
  end
 elseif npcHandler.topic[cid] == 3 then
  if msgcontains(msg, "yes") then
   local player = Player(cid)
   npcHandler:say("SO BE IT!", cid)
   player:setVocation(Vocation(vocation[cid]))
   player:setTown(Town(town[cid]))
   local destination = destination[cid]
   npcHandler:releaseFocus(cid)
   player:teleportTo(destination)
   player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
   destination:sendMagicEffect(CONST_ME_TELEPORT)

   ------------------------------------
   ------------------------------------
   ------------------------------------
   -- With Rookgaard
local firstItems = {2480, 2464, 2468, 2643, 2530, 2383,1988}
--function onLogin(cid)
 local player = Player(cid)
 --if player:getLastLoginSaved() <= 0 then
  for i = 1, #firstItems do
   player:removeItem(firstItems[i], 1)
  end
  --player:addItem(player:getSex() == 0 and 2651 or 2650, 1)
  --player:addItem(1988, 1)
  --player:addItem(2674, 1)
  --player:addItem(2120, 1)
  --player:addItem(2554, 1)
 --end
 --return true
--end
 local player = Player(cid)
 local targetVocation = config[player:getVocation():getId()]
 if not targetVocation then
  return true
 end
 -- if player:getLastLoginSaved() ~= 0 then
  -- return true
 -- end
 for i = 1, #targetVocation.items do
  player:addItem(targetVocation.items[i][1], targetVocation.items[i][2])
 end
 local backpack = player:addItem(1988)
 if not backpack then
  return true
 end
 for i = 1, #targetVocation.container do
  backpack:addItem(targetVocation.container[i][1], targetVocation.container[i][2])
 end
-- return true
--end
------------------------------------
------------------------------------
------------------------------------
  else
   npcHandler:say("THEN WHAT? {KNIGHT}, {PALADIN}, {SORCERER}, OR {DRUID}?", cid)
   npcHandler.topic[cid] = 2
  end
 end
 return true
end
local function onAddFocus(cid)
 town[cid] = 0
 vocation[cid] = 0
 destination[cid] = 0
end
local function onReleaseFocus(cid)
 town[cid] = nil
 vocation[cid] = nil
 destination[cid] = nil
end
npcHandler:setCallback(CALLBACK_ONADDFOCUS, onAddFocus)
npcHandler:setCallback(CALLBACK_ONRELEASEFOCUS, onReleaseFocus)
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

But where did you get this datapack? ORTS and TFS indent with tabs, not 1 or 2 spaces.
Could it be an OTX datapack that you are trying to run with a TFS server?
Anyway try the scripts and see if the errors go away, but something is really wrong ..
 
Solution
Something is wrong with my copy/paste function on this website or my computer, or both. They're indented properly on my end. :/

I can't remember because it was months ago, but I have some hybrid of ORTS, OTX, and TFS.
 
Last edited:
Something is wrong with my copy/paste function on this website or my computer, or both. They're indented properly on my end. :/

I can't remember because it was months ago, but I have some hybrid or ORTS, OTX, and TFS.

You really can't mix them up, OTX is OTX aka the land of bugs :p

So either go with TFS and use this datapack; [10.77][TFS 1.2] ORTS, a real map project
If you prefer TFS 1.3, you can download this datapack; TFS update by WibbenZ · Pull Request #302 · orts/server · GitHub
Might not be fully up to date ATM, but should work.

Or go with OTX and use this datapack; [10.00/11] OTXServer Full Global Daily Updated!
 
Back
Top