• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Text on tp.

Varev

New Member
Joined
Mar 23, 2015
Messages
29
Reaction score
0
I have this script in globalevents:

Code:
local t = {
    {"TEKST", {x=1022, y=1042, z=7}, CONST_ME_GIFT_WRAPS, color = TEXTCOLOR_LIGHTGREEN},
    {"TEKST", {x=1015, y=1025, z=7}, CONST_ME_TELEPORT, color = TEXTCOLOR_ORANGE}
}

function onThink(interval)
    for i = 1, #t do
        local v = t[i]
        doSendAnimatedText(v[2], v[1], v.color)
        doSendMagicEffect(v[2], v[3])
    end
    return true
end

And it's doesnt work...
I have TFS 8.6 CryingDamson 0.3.6
Please help...
 
In your code everything is correct. I tested it now in lua online editor: Lua: demo

The functions in loop are executed properly.

Try adding some print function to see if this globalevent is even executed.

Like this:
Code:
print("Are we here?")

Add it after and before onThink(interval) function.

And see in your console if its there.
 
0.3.6 can't use "doSendAnimatedText", you'll need to use "doCreatureSay(uid, text, type[, ghost = false[, cid = 0[, pos]]])"

p49JpEd.png

Code:
text = "You can make a whole bunch of lines.\nYou could put the city here.\nAnd some level requirements here.\nThen something snazzy here.\n^.^ Xikini ^.^"
LUA:
local config = {
    [1] = {{x = 1000, y = 1000, z = 7}, "text 1"},
    [2] = {{x = 1000, y = 1000, z = 7}, "text 2"},
    [3] = {{x = 1000, y = 1000, z = 7}, "text 3"},
    [4] = {{x = 1000, y = 1000, z = 7}, "text 4"},
}

function onThink(cid, interval, lastExecution)
    local cid = 0
    for _, pid in ipairs(getPlayersOnline()) do
        if isPlayer(pid) then
            cid = pid
            break
        end
    end
    for i = 1, #config do
        if cid ~= 0 then
            doCreatureSay(cid, config[i][2], TALKTYPE_ORANGE_1, nil, nil, config[i][1])
        end
    end
    return true
end
 
0.3.6 can't use "doSendAnimatedText", you'll need to use "doCreatureSay(uid, text, type[, ghost = false[, cid = 0[, pos]]])"

p49JpEd.png

Code:
text = "You can make a whole bunch of lines.\nYou could put the city here.\nAnd some level requirements here.\nThen something snazzy here.\n^.^ Xikini ^.^"
LUA:
local config = {
    [1] = {{x = 1000, y = 1000, z = 7}, "text 1"},
    [2] = {{x = 1000, y = 1000, z = 7}, "text 2"},
    [3] = {{x = 1000, y = 1000, z = 7}, "text 3"},
    [4] = {{x = 1000, y = 1000, z = 7}, "text 4"},
}

function onThink(cid, interval, lastExecution)
    local cid = 0
    for _, pid in ipairs(getPlayersOnline()) do
        if isPlayer(pid) then
            cid = pid
            break
        end
    end
    for i = 1, #config do
        if cid ~= 0 then
            doCreatureSay(cid, config[i][2], TALKTYPE_ORANGE_1, nil, nil, config[i][1])
        end
    end
    return true
end

You don't need to loop through players online. Isn't it enough to use first element from array? :P

Like this:
Code:
local players = getPlayersOnline()
local cid = players[1]
 
Are you sure? Found this, been years since I used 0.x, so might be a modified source code; forgottenserver036pl1/luascript.cpp at master · peonso/forgottenserver036pl1 · GitHub
I dunno. xD
Just from personal experience animated text has never worked properly on 0.3.6 and 0.3.7
The only work-around that was available way-back when is to have numbers utilized by animated text and strings done by creaturesay


Can u tell me, where I should paste it?
We need your globalevents line.
show your globalevents.xml the line.
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<globalevents>
    <globalevent name="lottery" interval="3600" event="script" value="loteria.lua"/>
    <globalevent name="napis" interval="2500" script="napis.lua"/>
    <globalevent name="save" interval="900" event="script" value="save.lua"/>
    <globalevent name="clean" interval="7200" event="script" value="clean.lua"/>

    <globalevent name="serverstart" type="start" event="script" value="start.lua"/>
    <globalevent name="playersrecord" type="record" event="script" value="record.lua"/>

    <!-- <globalevent name="timer_example" time="21:35" event="script" value="my_script.lua"/> -->
</globalevents>
it's it
 
Code:
<?xml version="1.0" encoding="UTF-8"?>
<globalevents>
    <globalevent name="lottery" interval="3600" event="script" value="loteria.lua"/>
    <globalevent name="napis" interval="2500" script="napis.lua"/>
    <globalevent name="save" interval="900" event="script" value="save.lua"/>
    <globalevent name="clean" interval="7200" event="script" value="clean.lua"/>

    <globalevent name="serverstart" type="start" event="script" value="start.lua"/>
    <globalevent name="playersrecord" type="record" event="script" value="record.lua"/>

    <!-- <globalevent name="timer_example" time="21:35" event="script" value="my_script.lua"/> -->
</globalevents>
it's it
which line is setup with the above script?
Basically do this.
XML:
<globalevent name="script_name" interval="3000" script="script_name.lua"/>
LUA:
local config = {
    [1] = {{x = 1000, y = 1000, z = 7}, "text 1"},
    [2] = {{x = 1000, y = 1000, z = 7}, "text 2"},
    [3] = {{x = 1000, y = 1000, z = 7}, "text 3"},
    [4] = {{x = 1000, y = 1000, z = 7}, "text 4"},
}

function onThink(cid, interval, lastExecution)
    local cid = 0
    for _, pid in ipairs(getPlayersOnline()) do
        if isPlayer(pid) then
            cid = pid
            break
        end
    end
    for i = 1, #config do
        if cid ~= 0 then
            doCreatureSay(cid, config[i][2], TALKTYPE_ORANGE_1, nil, nil, config[i][1])
        end
    end
    return true
end
 
Back
Top