English Tibia Error [Hudtext2]

5 replies
Goto Page
To the start Previous 1 Next To the start
08.10.16 06:14:03 am
Up
AleDarck
User
Offline Off
good afternoon
I could help, is giving me this error in functions.lua
This is the error

sys/lua/cs2dtibia/funcions.lua:431: <name> or '...' expected near '0'

This is the line code 431

Code:
1
2
3
function hudtxt2(id, "Hello World", 255255255, 320, 240, 1)
     parse("hudtxt2 " .. id .. " " .. txtid .. " \"©" .. tostring(colour) .. text .. "\" " .. x .. " " .. y .. " " .. align)
end
08.10.16 09:47:22 am
Up
Buksee
User
Offline Off
@user AleDarck:
Code:
1
2
3
4
5
local txtid = 0
function hudtxt2(id,text, colour,x,y,align)
     parse("hudtxt2 " .. id .. " " .. txtid .. " \"©" .. tostring(colour) .. text .. "\" " .. x .. " " .. y .. " " .. align)
     txtid=txtid+1
end

Maybe?
08.10.16 09:51:40 am
Up
Cure Pikachu
User
Offline Off
You completely destroyed the parameters in a function, that's why.
The default one looks like so:
Code:
function hudtxt2(id, txtid, text, colour, x, y, align)
     parse("hudtxt2 " .. id .. " " .. txtid .. " \"©" .. tostring(colour) .. text .. "\" " .. x .. " " .. y .. " " .. align)
end

To use a function, this is how it should look like:
hudtxt2(id,49,"Hello World",255255255,320,240,1)
IMG:https://i.imgur.com/5UWPaft.png
IMG:https://i.imgur.com/xpsyQRX.png
08.10.16 09:59:56 am
Up
Buksee
User
Offline Off
@user Cure Pikachu: Yes, that's the same as mine, but mine is auto increments the txtid.
08.10.16 11:50:46 am
Up
Cure Pikachu
User
Offline Off
@user Buksee: The mod also uses
hudtxt2
in other regions as well (such as a name display), so auto increments to
txtid
is a bad idea.
IMG:https://i.imgur.com/5UWPaft.png
IMG:https://i.imgur.com/xpsyQRX.png
08.10.16 01:04:52 pm
Up
Ortimh
User
Offline Off
Nope.
color
argument won't work. Just put the colors inside the
text
argument.
Code:
1
2
3
function hudtxt2(id, textid, text, x, y, alignment)
     parse('hudtxt2 ' .. id .. ' ' .. textid .. ' "' .. text .. '" ' .. x .. ' ' .. y .. ' ' .. alignment)
end

To use it, well,
hudtxt2(1, 0, '\169255255255Hello, world!', 320, 240, 1)
.
I'm awesome ... and I really cookies
To the start Previous 1 Next To the start