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

doSendAnimatedText(pos, text, color, player) --For 9.1+

Scarlet Ayleid

Advanced OT User
Senator
Joined
Jul 7, 2007
Messages
4,049
Reaction score
238
Okay, so everyone that has changed over to 9.1 has certainly noticed that the beloved doSendAnimatedText has dissapeared
However, the doPlayerSendTextMessage has gained 3 extra parameters that allows us to send animated text, so I thought of trying to replicate the old function, but it has 2 problems that I can't seem to fix:

1) I can't seem to send text, it is most likely a client limitation(afaik, please prove me wrong), which makes it impossible to send
2) This wasn't expected to be used simply for the animated text, so a message must always be sent, I have set the message to "", but on the game's console it'll still show an empty line, if it is possible to fix and someone knows how, please do post here :)

Code:
function doSendAnimatedText(pos, value, color, player)
    if(not tonumber(value))then
        return error("arg #2 in doSendAnimatedText is not a number")
    end
    
    if(isPlayer(player))then
        doPlayerSendTextMessage(player, MESSAGE_EXPERIENCE, "", value, color, pos)
    else
        for _, v in ipairs(getSpectators(pos, 7, 5, true)) do
            if(isPlayer(v))then
                doPlayerSendTextMessage(v, MESSAGE_EXPERIENCE, "", value, color, pos)
            end
        end
    end
end

I did this function mostly for newbies that still don't know how to use the new params, other coders might not use it because having it print the empty line is lame(I think it is)

Like I said, its here incase anyone wants it :)


EDIT:
Changed the code for Dalkon version, it's a lil better then mine :)
 
Last edited:
You can send numbers, with the extra of an empty line in your "Server Log" tab in the console. That's what this does.

Edit: I would rather have written this like such
Code:
function doSendAnimatedText(pos, value, color, player)
    if(not tonumber(value))then
        return error("arg #2 in doSendAnimatedText is not a number")
    end
    
    if(isPlayer(player))then
        doPlayerSendTextMessage(player, MESSAGE_EXPERIENCE, "", pos, value, color)
    else
        for _, v in ipairs(getSpectators(pos, 7, 5, true)) do
            if(isPlayer(v))then
                doPlayerSendTextMessage(v, MESSAGE_EXPERIENCE, "", pos, value, color)
            end
        end
    end
end
 
I said that in my first post, I also said that this is mostly for the people that don't know how to use the extra command/are too lazy to change all their scripts and don't mind the empty line being sent
 
Yes, as far as I can tell, its a limitation added by Cipsoft, so there's no way to work around it
 
the text is converted to a number, so if you use "+300", the server will show 300, but if you use "-300", the server will show -300 because its a negative value
 
maybe any time, some ninja guy, can edit the hex in the client of 9.10 and make this function work with strings again ;P
 
maybe any time, some ninja guy, can edit the hex in the client of 9.10 and make this function work with strings again ;P

I wouldn't recommend having people download a customized client just to have freakin' animated texts.
 
You can send numbers, with the extra of an empty line in your "Server Log" tab in the console. That's what this does.

Edit: I would rather have written this like such
Code:
function doSendAnimatedText(pos, value, color, player)
    if(not tonumber(value))then
        return error("arg #2 in doSendAnimatedText is not a number")
    end
    
    if(isPlayer(player))then
        doPlayerSendTextMessage(player, MESSAGE_EXPERIENCE, "", pos, value, color)
    else
        for _, v in ipairs(getSpectators(pos, 7, 5, true)) do
            if(isPlayer(v))then
                doPlayerSendTextMessage(v, MESSAGE_EXPERIENCE, "", pos, value, color)
            end
        end
    end
end
That wont work :p
 
You can't, maybe with source changes it might be possible, but this was made to be source-free, hence that happening, I know its annoying, it annoys me too, but its the only way to do this purely in Lua..
 
I got this error :(

[14/02/2013 23:17:02] Lua Script Error: [GlobalEvent Interface]
[14/02/2013 23:17:02] data/globalevents/scripts/effectile.lua:eek:nThink
[14/02/2013 23:17:03] data/globalevents/scripts/effectile.lua:20: arg #2 in doSendAnimatedText is not a number
[14/02/2013 23:17:03] stack traceback:
[14/02/2013 23:17:03] [C]: ?
[14/02/2013 23:17:03] [C]: in function 'doSendAnimatedText'
[14/02/2013 23:17:03] data/globalevents/scripts/effectile.lua:20: in function <data/globalevents/scripts/effectile.lua:17>
[14/02/2013 23:17:03] [Error - GlobalEvents::think] Failed to execute event: effect
 
that's looking good but it gives debug to all character when enter the pz zone

- - - Updated - - -

solved. problem was talktype :)
 
Back
Top