unexpected symbol near 'T' what is this?

Discussion in 'Support' started by 5lave Ots, Oct 12, 2018.

  1. 5lave Ots

    5lave Ots Member

    Joined:
    Oct 2, 2017
    Messages:
    64
    Likes Received:
    4
    Best Answers:
    0
    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

    Code (Lua):
    1.  
    2. function del(pos, id)
    3.     local thing = getTileItemById(pos, id).uid   <<--this is line 136
    4.     if thing > 0 then
    5.         doRemoveItem(thing)
    6.     end
    7. end
    8.  
    9. function onThink(interval, lastExecution)
    10. local poss1 = {
    11. {x = 1012, y = 997, z = 7},
    12. {x = 1015, y = 1006, z = 7}
    13. }
    14.  
    15. if getGlobalStorageValue(str) == 1 then -- remove 3rd walls and create first walls line
    16.  
    17. setGlobalStorageValue(str, 2)
    18. for i  = 1, #poss3 do  --remove 3rd walllls
    19. del(poss3[i], wall_id)
    20. end
    21. for i  = 1, #poss1 do  --create 1st walls
    22. reset_walls(poss1[i], wall_id)
    23. end
    24. return true
    25.  
    this should remove some walls from some positions, then create others, remove them after x delay and create others...and so on
    REP++
     
  2. Danger II

    Danger II FluppiX.com

    Joined:
    Nov 21, 2012
    Messages:
    1,555
    Likes Received:
    443
    Best Answers:
    11
    The code you posted seems correct, I doubt this is the right line, could you post the whole script?
     
  3. Danger II

    Danger II FluppiX.com

    Joined:
    Nov 21, 2012
    Messages:
    1,555
    Likes Received:
    443
    Best Answers:
    11
    I can't edit my post, but you should check if the function closes properly.

    Can't find a "end" for this code:
    Code (Lua):
    1. 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)
     
  4. flaviiojr

    flaviiojr Active Member

    Joined:
    Jan 20, 2017
    Messages:
    230
    Likes Received:
    36
    Best Answers:
    13
    Code (Lua):
    1. local poss1 = {
    2.     {x = 1012, y = 997, z = 7},
    3.     {x = 1015, y = 1006, z = 7}
    4. }
    5.  
    6. function del(pos, id)
    7.     local thing = getTileItemById(pos, id).uid
    8.     if thing > 0 then
    9.         doRemoveItem(thing)
    10.     end
    11. end
    12.  
    13. function onThink(interval, lastExecution)
    14.     if getGlobalStorageValue(str) == 1 then
    15.         setGlobalStorageValue(str, 2)
    16.         for i  = 1, #poss3 do  --remove 3rd walllls
    17.             del(poss3[i], wall_id)
    18.         end
    19.  
    20.         for i  = 1, #poss1 do  --create 1st walls
    21.             reset_walls(poss1[i], wall_id)
    22.         end
    23.     end
    24.     return true
    25. end
     
  5. 5lave Ots

    5lave Ots Member

    Joined:
    Oct 2, 2017
    Messages:
    64
    Likes Received:
    4
    Best Answers:
    0
    I will share the whole script now
     
  6. 5lave Ots

    5lave Ots Member

    Joined:
    Oct 2, 2017
    Messages:
    64
    Likes Received:
    4
    Best Answers:
    0
    Code (Lua):
    1.  
    2. local poss1 = {
    3. {x = 1012, y = 997, z = 7},
    4. {x = 1015, y = 998, z = 7},
    5. {x = 1012, y = 1001, z = 7},
    6. {x = 1015, y = 1002, z = 7},
    7. {x = 1012, y = 1005, z = 7},
    8. {x = 1015, y = 1006, z = 7}
    9. }
    10.  
    11. local poss2 = {
    12. {x = 1012, y = 996, z = 7},
    13. {x = 1015, y = 997, z = 7},
    14. {x = 1012, y = 1000, z = 7},
    15. {x = 1015, y = 1001, z = 7},
    16. {x = 1012, y = 1004, z = 7},
    17. {x = 1015, y = 1005, z = 7}
    18. }
    19.  
    20. local poss3 = {
    21. {x = 1012, y = 995, z = 7},
    22. {x = 1015, y = 996, z = 7},
    23. {x = 1012, y = 999, z = 7},
    24. {x = 1015, y = 1000, z = 7},
    25. {x = 1012, y = 1003, z = 7},
    26. {x = 1015, y = 1004, z = 7}
    27. }
    28.  
    29. local wall_id = 1201
    30. local str = 1524 --global storage to check which mw is created now
    31. local delaay = 2500 --time between remove and create
    32. --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
    33. local function del(pos, id)
    34.     local thing = getTileItemById(pos, id).uid
    35.     if thing > 0 then
    36.         doRemoveItem(thing)
    37.     end
    38. end
    39.  
    40. local function reset_walls(pos, id)
    41.     local thing = getTileItemById(pos, id).uid
    42.     if thing < 1 then
    43.         doCreateItem(id, 1, pos)
    44.     end
    45. end
    46.  
    47. function onThink(interval, lastExecution)
    48. if getGlobalStorageValue(str) == 1 then -- remove 3rd walls and create first walls line
    49. setGlobalStorageValue(str, 2)
    50. for i  = 1, #poss3 do  --remove 3rd walllls
    51. del(poss3[i], wall_id)
    52. end
    53. for i  = 1, #poss1 do  --create 1st walls
    54. reset_walls(poss1[i], wall_id)
    55. end
    56. return true
    57.  
    58. elseif getGlobalStorageValue(str) == 2 then -- remove 1st walls and create 2nd walls line
    59. setGlobalStorageValue(str, 3)
    60. for i  = 1, #poss1 do  --remove 1st walllls
    61. del(poss1[i], wall_id)
    62. end
    63. for i  = 1, #poss2 do  --create 2nd walls
    64. reset_walls(poss2[i], wall_id)
    65. end
    66. return true
    67. elseelseif getGlobalStorageValue(str) == 3 then -- remove 1st walls and create 2nd walls line
    68. setGlobalStorageValue(str, 1)
    69. for i  = 1, #poss2 do  --remove 2nd walllls
    70. del(poss2[i], wall_id)
    71. end
    72. for i  = 1, #poss3 do  --create 3rd walls
    73. reset_walls(poss3[i], wall_id)
    74. end
    75. return true
    76. end
    77. return true
    78. end
    79.  
    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 <<--
     
  7. flaviiojr

    flaviiojr Active Member

    Joined:
    Jan 20, 2017
    Messages:
    230
    Likes Received:
    36
    Best Answers:
    13
    Code (Lua):
    1. local config = {
    2.     poss1 = {
    3.         {x = 1012, y = 997, z = 7},
    4.         {x = 1015, y = 998, z = 7},
    5.         {x = 1012, y = 1001, z = 7},
    6.         {x = 1015, y = 1002, z = 7},
    7.         {x = 1012, y = 1005, z = 7},
    8.         {x = 1015, y = 1006, z = 7}
    9.     },
    10.     poss2 = {
    11.         {x = 1012, y = 996, z = 7},
    12.         {x = 1015, y = 997, z = 7},
    13.         {x = 1012, y = 1000, z = 7},
    14.         {x = 1015, y = 1001, z = 7},
    15.         {x = 1012, y = 1004, z = 7},
    16.         {x = 1015, y = 1005, z = 7}
    17.     },
    18.     poss3 = {
    19.         {x = 1012, y = 995, z = 7},
    20.         {x = 1015, y = 996, z = 7},
    21.         {x = 1012, y = 999, z = 7},
    22.         {x = 1015, y = 1000, z = 7},
    23.         {x = 1012, y = 1003, z = 7},
    24.         {x = 1015, y = 1004, z = 7}
    25.     },
    26.     wall_id = 1201,
    27.     str = 1524, --global storage to check which mw is created now
    28.     delaay = 2500 --time between remove and create
    29. }
    30.  
    31. local function del(pos, id)
    32.     local thing = getTileItemById(pos, id).uid
    33.     if thing > 0 then
    34.         doRemoveItem(thing)
    35.     end
    36. end
    37. local function reset_walls(pos, id)
    38.     local thing = getTileItemById(pos, id).uid
    39.     if thing < 1 then
    40.         doCreateItem(id, 1, pos)
    41.     end
    42. end
    43. function onThink(interval, lastExecution)
    44.     if getGlobalStorageValue(config.str) == 1 then -- remove 3rd walls and create first walls line
    45.         setGlobalStorageValue(config.str, 2)
    46.         for i  = 1, #config.poss3 do  --remove 3rd walllls
    47.             del(config.poss3[i], config.wall_id)
    48.         end
    49.         for i  = 1, #config.poss1 do  --create 1st walls
    50.             reset_walls(config.poss1[i], config.wall_id)
    51.         end
    52.         return true
    53.     elseif getGlobalStorageValue(config.str) == 2 then -- remove 1st walls and create 2nd walls line
    54.         setGlobalStorageValue(config.str, 3)
    55.         for i  = 1, #config.poss1 do  --remove 1st walllls
    56.             del(config.poss1[i], config.wall_id)
    57.         end
    58.         for i  = 1, #config.poss2 do  --create 2nd walls
    59.             reset_walls(config.poss2[i], config.wall_id)
    60.         end
    61.         return true
    62.     elseif getGlobalStorageValue(config.str) == 3 then -- remove 1st walls and create 2nd walls line
    63.         setGlobalStorageValue(config.str, 1)
    64.         for i  = 1, #config.poss2 do  --remove 2nd walllls
    65.             del(config.poss2[i], config.wall_id)
    66.         end
    67.         for i  = 1, #config.poss3 do  --create 3rd walls
    68.             reset_walls(config.poss3[i], config.wall_id)
    69.         end
    70.         return true
    71.     end
    72.     return true
    73. end
     
  8. 5lave Ots

    5lave Ots Member

    Joined:
    Oct 2, 2017
    Messages:
    64
    Likes Received:
    4
    Best Answers:
    0
    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 (Text):
    1. local config = {
    2.     poss1 = {     <<-- this is line 105
     
  9. Leesne

    Leesne Member

    Joined:
    Dec 4, 2017
    Messages:
    53
    Likes Received:
    18
    Best Answers:
    7
    I think its something related to above the code you posted.. 105th line.
    Check the code above it.
     
  10. Stigma

    Stigma Support Team Support Team

    Joined:
    Feb 14, 2015
    Messages:
    4,323
    Likes Received:
    2,027
    Best Answers:
    351
    save the file with utf-8 encoding
    or try utf-16
     
  11. 5lave Ots

    5lave Ots Member

    Joined:
    Oct 2, 2017
    Messages:
    64
    Likes Received:
    4
    Best Answers:
    0
    how I do this with lua file and notepad ++?



    its already now with utf 8 and utf 16 not exist with notepad plus plus
     
  12. Leesne

    Leesne Member

    Joined:
    Dec 4, 2017
    Messages:
    53
    Likes Received:
    18
    Best Answers:
    7
    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: Oct 14, 2018

Share This Page

Loading...