Tibia Error [Hudtext2]
5 replies



08.10.16 06:14:03 am
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
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
2
3
function hudtxt2(id, "Hello World", 255255255, 320, 240, 1)
parse("hudtxt2 " .. id .. " " .. txtid .. " \"©" .. tostring(colour) .. text .. "\" " .. x .. " " .. y .. " " .. align)
end
parse("hudtxt2 " .. id .. " " .. txtid .. " \"©" .. tostring(colour) .. text .. "\" " .. x .. " " .. y .. " " .. align)
end
@
AleDarck:
Maybe?

Code:
1
2
3
4
5
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
function hudtxt2(id,text, colour,x,y,align)
parse("hudtxt2 " .. id .. " " .. txtid .. " \"©" .. tostring(colour) .. text .. "\" " .. x .. " " .. y .. " " .. align)
txtid=txtid+1
end
Maybe?

You completely destroyed the parameters in a function, that's why.
The default one looks like so:
To use a function, this is how it should look like:
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
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)


@
Cure Pikachu: Yes, that's the same as mine, but mine is auto increments the txtid.


@
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. 

Nope.
To use it, well,
color
argument won't work. Just put the colors inside the text
argument.Code:
1
2
3
2
3
function hudtxt2(id, textid, text, x, y, alignment)
parse('hudtxt2 ' .. id .. ' ' .. textid .. ' "' .. text .. '" ' .. x .. ' ' .. y .. ' ' .. alignment)
end
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



