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

TFS 1.2 onAdvance doesnt send full message

henkas

Well-Known Member
Joined
Jul 8, 2015
Messages
1,054
Solutions
5
Reaction score
62
Hello so this script doesnt send entire text it looks like it cant go above x amount characters because it cuts only longer text but shorter text sends just fine.

LUA:
local config = {
    --[skillType] = { "text", textColour, animationEffect}
    [SKILL_LEVEL]    = { "Test!",       TEXTCOLOR_LIGHTGREEN, CONST_ME_NONE },
    [SKILL_CLUB]     = { "Attack Tested!",        TEXTCOLOR_LIGHTGREEN, CONST_ME_NONE }, --cuts this part, sends only Attack Te (and it cuts other part of text)
    [SKILL_AXE]      = { "Test!",         TEXTCOLOR_LIGHTGREEN, CONST_ME_NONE },
    [SKILL_SWORD]    = { "Test!",       TEXTCOLOR_LIGHTGREEN, CONST_ME_NONE },
    [SKILL_DISTANCE] = { "Test!",    TEXTCOLOR_LIGHTGREEN, CONST_ME_NONE },
    [SKILL_SHIELD]   = { "Test!",      TEXTCOLOR_LIGHTGREEN, CONST_ME_NONE },
    [SKILL_FISHING]  = { "Test!",     TEXTCOLOR_LIGHTGREEN, CONST_ME_NONE },
    [SKILL_FIST]     = { "Test!",        TEXTCOLOR_LIGHTGREEN, CONST_ME_NONE },
    [SKILL_MAGLEVEL] = { "Testl!", TEXTCOLOR_LIGHTBLUE, CONST_ME_NONE }
}

local imageEffect = {
    {0, 0, 1, 0, 1, 0, 0},
    {0, 1, 0, 1, 0, 1, 0},
    {1, 0, 0, 0, 0, 0, 1},
    {1, 0, 0, 0, 0, 0, 1},
    {0, 1, 0, 0, 0, 1, 0},
    {0, 0, 1, 0, 1, 0, 0},
    {0, 0, 0, 1, 0, 0, 0}
}

function onAdvance(player, skill, oldLevel, newLevel)
    if oldLevel < newLevel then
        local info = config[skill]
        if info then
            local position = player:getPosition()
            Game.sendAnimatedText(info[1], position, info[2])
            local diff = math.ceil(#imageEffect[1] / 2)
            position = position + Position(-diff, -diff, 0)
            if info[3] == CONST_ME_NONE then
            return true
            end
            for k, v in pairs(imageEffect) do
                for l, b in pairs(v) do
                    if b ~= 0 then
                        (position + Position(l, k, 0)):sendMagicEffect(info[3])
                    end
                end
            end
        end
    end
    return true
end
 
I can edit just give me tutorial and i do it with hex editor i guess
Not better to add spaces to texts do IT doesnt contain gaps? Like " attack" "test ". I dont think there is a tutorial for that.

Sometimes its better to make easy solutions in few minutes instead of spending days trying to do IT in different way.
 
Not better to add spaces to texts do IT doesnt contain gaps? Like " attack" "test ". I dont think there is a tutorial for that.

Sometimes its better to make easy solutions in few minutes instead of spending days trying to do IT in different way.
So how would you edit the code then
 
So how would you edit the code then
Make something like [Skill_club] = { texts = {"text1", "text2"}} ... And then make loop which will add spaces to start of first world depending on text length. Then second loop which will do the same but adding spaces to the end od the second word. Then print first on player pos and second on +1x pos
 
Make something like [Skill_club] = { texts = {"text1", "text2"}} ... And then make loop which will add spaces to start of first world depending on text length. Then second loop which will do the same but adding spaces to the end od the second word. Then print first on player pos and second on +1x pos
It sounds a little bit to advanced for me lul
 
It sounds a little bit to advanced for me lul

Local maxLength = number of max chars you can print
Local length = get length of text here
Local spaces = ""
For i = 1, maxLength - length do
Spaces = spaces + " "
End
SendAnimatedText(spaces .. textYouWant)

And do the same with second text, just with textYouWant .. spaces
 
Local maxLength = number of max chars you can print
Local length = get length of text here
Local spaces = ""
For i = 1, maxLength - length do
Spaces = spaces + " "
End
SendAnimatedText(spaces .. textYouWant)

And do the same with second text, just with textYouWant .. spaces
Wait so the structure of local config is destroyed this way, isnt it?
 
Back
Top