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

unexpected symbol near 'T' what is this?

5lave Ots

Active Member
Joined
Oct 2, 2017
Messages
246
Solutions
1
Reaction score
40
Location
Ankrahmun
hello outlanders,
I wonder to know what is that error using windows tfs 0.4 tibia 860
when tfs starts to load the globalevents I got this error

[17:54:03.781] [Warning - Event::loadScript] Cannot load script (data/globalevents/scripts/staminaquest.lua)
[17:54:03.781] data/globalevents/scripts/staminaquest.lua:136: unexpected symbol near '┬'
and this is the code

Lua:
function del(pos, id)
    local thing = getTileItemById(pos, id).uid   <<--this is line 136
    if thing > 0 then
        doRemoveItem(thing)
    end
end

function onThink(interval, lastExecution)
local poss1 = {
{x = 1012, y = 997, z = 7},
{x = 1015, y = 1006, z = 7}
}

if getGlobalStorageValue(str) == 1 then -- remove 3rd walls and create first walls line

setGlobalStorageValue(str, 2)
for i  = 1, #poss3 do  --remove 3rd walllls
del(poss3[i], wall_id)
end
for i  = 1, #poss1 do  --create 1st walls
reset_walls(poss1[i], wall_id)
end
return true
this should remove some walls from some positions, then create others, remove them after x delay and create others...and so on
REP++
 
I can't edit my post, but you should check if the function closes properly.

Can't find a "end" for this code:
Lua:
if getGlobalStorageValue(str) == 1 then -- remove 3rd walls and create first walls line

And not sure if the function end's correct. (at least the code you posted, does not close the function)
 
Lua:
local poss1 = {
    {x = 1012, y = 997, z = 7},
    {x = 1015, y = 1006, z = 7}
}

function del(pos, id)
    local thing = getTileItemById(pos, id).uid
    if thing > 0 then
        doRemoveItem(thing)
    end
end

function onThink(interval, lastExecution)
    if getGlobalStorageValue(str) == 1 then
        setGlobalStorageValue(str, 2)
        for i  = 1, #poss3 do  --remove 3rd walllls
            del(poss3[i], wall_id)
        end

        for i  = 1, #poss1 do  --create 1st walls
            reset_walls(poss1[i], wall_id)
        end
    end
    return true
end
 
I can't edit my post, but you should check if the function closes properly.

Can't find a "end" for this code:
Lua:
if getGlobalStorageValue(str) == 1 then -- remove 3rd walls and create first walls line

And not sure if the function end's correct. (at least the code you posted, does not close the function)
I will share the whole script now
 
Lua:
local poss1 = {
{x = 1012, y = 997, z = 7},
{x = 1015, y = 998, z = 7},
{x = 1012, y = 1001, z = 7},
{x = 1015, y = 1002, z = 7},
{x = 1012, y = 1005, z = 7},
{x = 1015, y = 1006, z = 7}
}

local poss2 = {
{x = 1012, y = 996, z = 7},
{x = 1015, y = 997, z = 7},
{x = 1012, y = 1000, z = 7},
{x = 1015, y = 1001, z = 7},
{x = 1012, y = 1004, z = 7},
{x = 1015, y = 1005, z = 7}
}

local poss3 = {
{x = 1012, y = 995, z = 7},
{x = 1015, y = 996, z = 7},
{x = 1012, y = 999, z = 7},
{x = 1015, y = 1000, z = 7},
{x = 1012, y = 1003, z = 7},
{x = 1015, y = 1004, z = 7}
}

local wall_id = 1201
local str = 1524 --global storage to check which mw is created now
local delaay = 2500 --time between remove and create
--str -1 not working, 0 going to work, 1== wall 1 line will created, 2== wall line 2 will create now, 3== wall 3 will created
local function del(pos, id)
    local thing = getTileItemById(pos, id).uid
    if thing > 0 then
        doRemoveItem(thing)
    end
end

local function reset_walls(pos, id)
    local thing = getTileItemById(pos, id).uid
    if thing < 1 then
        doCreateItem(id, 1, pos)
    end
end

function onThink(interval, lastExecution)
if getGlobalStorageValue(str) == 1 then -- remove 3rd walls and create first walls line
setGlobalStorageValue(str, 2)
for i  = 1, #poss3 do  --remove 3rd walllls
del(poss3[i], wall_id)
end
for i  = 1, #poss1 do  --create 1st walls
reset_walls(poss1[i], wall_id)
end
return true

elseif getGlobalStorageValue(str) == 2 then -- remove 1st walls and create 2nd walls line
setGlobalStorageValue(str, 3)
for i  = 1, #poss1 do  --remove 1st walllls
del(poss1[i], wall_id)
end
for i  = 1, #poss2 do  --create 2nd walls
reset_walls(poss2[i], wall_id)
end
return true
elseelseif getGlobalStorageValue(str) == 3 then -- remove 1st walls and create 2nd walls line
setGlobalStorageValue(str, 1)
for i  = 1, #poss2 do  --remove 2nd walllls
del(poss2[i], wall_id)
end
for i  = 1, #poss3 do  --create 3rd walls
reset_walls(poss3[i], wall_id)
end
return true
end
return true
end

this is always working,, when storage is 1 it should remove walls' line 1 and create line 2 then set storage 2..with interval 3 seconds,, when storage is 2 it remove wall 2 and create walls on line 3,,, and so on the exe error line is >>> local thing = getTileItemById(pos, id).uid <<--
 
Lua:
local config = {
    poss1 = {
        {x = 1012, y = 997, z = 7},
        {x = 1015, y = 998, z = 7},
        {x = 1012, y = 1001, z = 7},
        {x = 1015, y = 1002, z = 7},
        {x = 1012, y = 1005, z = 7},
        {x = 1015, y = 1006, z = 7}
    },
    poss2 = {
        {x = 1012, y = 996, z = 7},
        {x = 1015, y = 997, z = 7},
        {x = 1012, y = 1000, z = 7},
        {x = 1015, y = 1001, z = 7},
        {x = 1012, y = 1004, z = 7},
        {x = 1015, y = 1005, z = 7}
    },
    poss3 = {
        {x = 1012, y = 995, z = 7},
        {x = 1015, y = 996, z = 7},
        {x = 1012, y = 999, z = 7},
        {x = 1015, y = 1000, z = 7},
        {x = 1012, y = 1003, z = 7},
        {x = 1015, y = 1004, z = 7}
    },
    wall_id = 1201,
    str = 1524, --global storage to check which mw is created now
    delaay = 2500 --time between remove and create
}

local function del(pos, id)
    local thing = getTileItemById(pos, id).uid
    if thing > 0 then
        doRemoveItem(thing)
    end
end
local function reset_walls(pos, id)
    local thing = getTileItemById(pos, id).uid
    if thing < 1 then
        doCreateItem(id, 1, pos)
    end
end
function onThink(interval, lastExecution)
    if getGlobalStorageValue(config.str) == 1 then -- remove 3rd walls and create first walls line
        setGlobalStorageValue(config.str, 2)
        for i  = 1, #config.poss3 do  --remove 3rd walllls
            del(config.poss3[i], config.wall_id)
        end
        for i  = 1, #config.poss1 do  --create 1st walls
            reset_walls(config.poss1[i], config.wall_id)
        end
        return true
    elseif getGlobalStorageValue(config.str) == 2 then -- remove 1st walls and create 2nd walls line
        setGlobalStorageValue(config.str, 3)
        for i  = 1, #config.poss1 do  --remove 1st walllls
            del(config.poss1[i], config.wall_id)
        end
        for i  = 1, #config.poss2 do  --create 2nd walls
            reset_walls(config.poss2[i], config.wall_id)
        end
        return true
    elseif getGlobalStorageValue(config.str) == 3 then -- remove 1st walls and create 2nd walls line
        setGlobalStorageValue(config.str, 1)
        for i  = 1, #config.poss2 do  --remove 2nd walllls
            del(config.poss2[i], config.wall_id)
        end
        for i  = 1, #config.poss3 do  --create 3rd walls
            reset_walls(config.poss3[i], config.wall_id)
        end
        return true
    end
    return true
end
 
again nothing happens
[23:8:06.345] [Warning - Event::loadScript] Cannot load script (data/globalevents/scripts/staminaquest.lua)
[23:8:06.345] data/globalevents/scripts/staminaquest.lua:105: unexpected symbol near '┬'

Code:
local config = {
    poss1 = {     <<-- this is line 105
 
I think its something related to above the code you posted.. 105th line.
Check the code above it.
 
I just replicated an error similar to this with some older code.
Click encoding menu convert to UTF-8 as Vulcan_ said.


If not delete the current file on both server and local pc and create new one, ensuring its utf8

Also, is unix LF or windows CR LF set down in the bottom right corner.

Some software can't handle the line breaks that the two offer.
 
Last edited:
Back
Top