• 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 Fishing TFS 0.3.6 not working

Dkadsfe

Member
Joined
Apr 1, 2016
Messages
280
Reaction score
22
Hello I recently took this script from somewhere I forgot but I edited the level and monsters and it has an error
Code:
[Error - LuaScriptInterface::loadFile] data/actions/scripts/fishing.lua:3: unexpected symbol near 'á'
[Warning - Event::loadScript] Cannot load script (data/actions/scripts/fishing.lua)
data/actions/scripts/fishing.lua:3: unexpected symbol near 'á'
I have no idea what that symbol beans



action.xml
Code:
    <action itemid="10223" event="script" value="fishing.lua" allowfaruse="1"/>

lua
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local config = {
    waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
    rateSkill = getConfigValue("rateSkill"),
    allowFromPz = false,
    useWorms = false
}
 
local monsters = {"L1 Prompt", "L2 Cache", "L3 Demon", "GGRD4", "GGRD5", "RGB", "Asus", "Tanktoa", "Cu Bu"}
 
    if(not isInArray(config.waterIds, itemEx.itemid)) then
        return false
    end
 
    if((config.allowFromPz or not getTileInfo(getCreaturePosition(cid)).protection) and itemEx.itemid ~= 493 and math.random(1, (100 + (getPlayerSkill(cid, SKILL_FISHING) / 10))) < getPlayerSkill(cid, SKILL_FISHING) and (not config.useWorms or (getPlayerItemCount(cid, ITEM_WORM) > 0 and doPlayerRemoveItem(cid, ITEM_WORM, 1)))) then
        if getPlayerLevel(cid) >= 500 and getPlayerSkillLevel(cid, SKILL_FISHING) >= 100 then
            randsummon = math.random(0,9)
        elseif getPlayerLevel(cid) >= 400 then
            randsummon = math.random(0,8)
        elseif getPlayerLevel(cid) >= 200 then
            randsummon = math.random(0,6)
        elseif getPlayerLevel(cid) >= 100 then
            randsummon = math.random(0,4)
        elseif getPlayerLevel(cid) >= 50 then
            randsummon = math.random(0,2)
        else
            doPlayerAddSkillTry(cid, SKILL_FISHING, config.rateSkill)
        end
 
        if randsummon == 0 then
            doPlayerAddSkillTry(cid, SKILL_FISHING, config.rateSkill)
        else
            doSummonMonster(monsters[randsummon], getCreaturePosition(cid))
            doPlayerAddSkillTry(cid, SKILL_FISHING, config.rateSkill)
        end
    end
 
    doSendMagicEffect(toPosition, CONST_ME_LOSEENERGY)
    return true
end
 
Solution
Which way is it? i tried putting it to the top and it has line error 2 then ima try both ways of the codes below
Code:
local config = {
    waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
    print(config.rateSkill),
    allowFromPz = false,
    useWorms = false
}

Code:
local config = {
    waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
    rateSkill = getConfigValue("rateSkill"),
print(config.rateSkill),
    allowFromPz = false,
    useWorms = false
}

Either way i save it, it has the same error but in different places like unexpected symbol a in line 8 or 3

Could anyone give...
Something tells me you are posting the wrong file. Make sure you have the right one: data/actions/scripts/fishing.lua
 
Just for fun, try moving this to the top of the script;
Lua:
local config = {
    waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
    rateSkill = getConfigValue("rateSkill"),
    allowFromPz = false,
    useWorms = false
}

If line numbers in the error is 1-6 then add this below the table;
Lua:
print(config.rateSkill)

And look what the output in your console is, TFS should care if the skillRate is bugged but give it a try.

If it was the encoding it should have given an error at the first or last line IMO.
 
Which way is it? i tried putting it to the top and it has line error 2 then ima try both ways of the codes below
Code:
local config = {
    waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
    print(config.rateSkill),
    allowFromPz = false,
    useWorms = false
}

Code:
local config = {
    waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
    rateSkill = getConfigValue("rateSkill"),
print(config.rateSkill),
    allowFromPz = false,
    useWorms = false
}

Either way i save it, it has the same error but in different places like unexpected symbol a in line 8 or 3

Could anyone give me a random tfs 0.3.6 action script that works? I just want to make sure its not because of my console and thx for trying to help me guys
 
Last edited by a moderator:
Which way is it? i tried putting it to the top and it has line error 2 then ima try both ways of the codes below
Code:
local config = {
    waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
    print(config.rateSkill),
    allowFromPz = false,
    useWorms = false
}

Code:
local config = {
    waterIds = {493, 4608, 4609, 4610, 4611, 4612, 4613, 4614, 4615, 4616, 4617, 4618, 4619, 4620, 4621, 4622, 4623, 4624, 4625},
    rateSkill = getConfigValue("rateSkill"),
print(config.rateSkill),
    allowFromPz = false,
    useWorms = false
}

Either way i save it, it has the same error but in different places like unexpected symbol a in line 8 or 3

Could anyone give me a random tfs 0.3.6 action script that works? I just want to make sure its not because of my console and thx for trying to help me guys

Please read the rules, you aren't allowed to double post within 24h
A tip is also to quote ppl that you respond to, that way we get a notification about it and can get back to you faster :)

Put the print after }, line 7 in the second code tag you did in the post above.
If you get a nil value or some weird characters in your console try to change rateSkill = ... to rateSkill = 5 and see if that works.

If it does it might be your TFS that is bugged or your rateSkill variable in config.lua.
 
Solution
I give up on this script no matter what i do it still has unexpected errors so im abandoning this
I've saved your first post's script on my computer, and it appears to be working.
I didn't edit anything, but it allowed me to use the fishing rod.
The way my server is set-up.. there's zero chance I can fully test this script though..

Good luck in any case.
 

Attachments

Back
Top