4. Which version of WindBot?
WindBot for Client 11. Beta 30
5. Which version of Game Client?
Not sure, The one for beta 30
6. Do you have a Dedicated Graphics Card?
no
7. Detailed description of the problem.
When using the Private message script (worked well in previous windbot) it records the first 8 messages that you say in NPCs channel.
function inputevents(e)
if e.type == IEVENT_RMOUSEDOWN or e.type == IEVENT_MMOUSEDOWN then
HUD.Moving, HUD.Auxiliar = true, {$cursor.x - HUD.Position[1], $cursor.y - HUD.Position[2]}
elseif e.type == IEVENT_RMOUSEUP or e.type == IEVENT_MMOUSEUP then
HUD.Moving = false
elseif e.type == IEVENT_MOUSEWHEEL then
if iskeypressed(0x12) then
if e.value2 < 0 then
HUD.strStart, HUD.strEnd = HUD.strStart - 1, HUD.strEnd - 1
elseif e.value2 > 0 then
HUD.strStart, HUD.strEnd = HUD.strStart + 1, HUD.End + 1
end
if HUD.strStart > HUD.strMax then
HUD.strStart, HUD.strEnd = 1, 30
end
else
if #PrivateMessages > Config.MaxLines then
if e.value2 < 0 then
if HUD.Start <= #PrivateMessages - Config.MaxLines then
HUD.Start, HUD.End = HUD.Start + 1, HUD.End + 1
end
elseif e.value2 > 0 then
if HUD.End > Config.MaxLines then
HUD.Start, HUD.End = HUD.Start - 1, HUD.End - 1
end
end
end
end
elseif e.type == IEVENT_LMOUSEUP then
if e.elementid == HUD.Restart then
PrivateMessages = {}
end
end
end
local function displaytext(text, x, y, c)
addgradcolors(unpack(c))
local w, h = measurestring(text)
HUD.ColumnWidth[1], HUD.ColumnWidth[2] = math.max(HUD.ColumnWidth[1], w or 0), math.max(HUD.ColumnWidth[2], h or 0)
local t = drawroundrect(x, y, HUD.ColumnWidth[1] + 7, HUD.ColumnWidth[2], 2, 2)
drawtext(text, x + 2, y + math.floor(HUD.ColumnWidth[2] / 4) - 2.4)
return t
end
init end
if HUD.Moving then
auto(10)
HUD.Position = {$cursor.x - HUD.Auxiliar[1], $cursor.y - HUD.Auxiliar[2]}
$chardb:setvalue('AWE.PM', 'POSITION', table.concat(HUD.Position, ':'))
end
foreach newmessage m do
if m.channel:lower() ~= 'npcs' and (Config.Sent and m.type == MSG_SENT) or (Config.Received and m.type == MSG_PVT) then
table.insert(PrivateMessages, {text = string.format("%s %s [%s]: %s", os.date('%H:%M'), m.sender, m.level, m.content), color = m.type == MSG_PVT and HUD.Orange or HUD.Black})
end
end
local x, y, w, h = 0, 0, 0, 0
displaytext(" Private Messages:", x, y, HUD.Blue)
addgradcolors(unpack(#PrivateMessages > 0 and HUD.Green or HUD.Red))
w, h = measurestring("RESET")
HUD.ColumnWidth[1] = math.max(HUD.ColumnWidth[1], w)
HUD.Restart = drawroundrect(x - w + HUD.ColumnWidth[1], y, w + 7, h, 2, 2)
drawtext("RESET", 5 + x - w + HUD.ColumnWidth[1], y + math.floor(h / 4) - 2.4)
y = y + 20
for i = HUD.Start, HUD.End do
if PrivateMessages[i] then
local msg = PrivateMessages[i].text
local h, j = math.max(1, HUD.strStart), math.max(msg:len(), HUD.strEnd)
HUD.strMax = math.max(HUD.strMax, msg:len())
if h == 2 then
msg = "." .. msg:sub(h, j)
elseif h == 3 then
msg = ".." .. msg:sub(h, j)
elseif h >= 4 then
msg = "..." .. msg:sub(h, j)
else
msg = msg:sub(h, j)
end
displaytext(msg:fit(Config.Length or 60), x, y, PrivateMessages[i].color)
y = y + 16
end
end
setposition(HUD.Position[1], HUD.Position[2])
12-09-2016, 12:55 AM
Josh
Could you run this and post a screenshot of the console window (ctrl+E)? I'd like to see the output once you've reproduced the bug ofc.
init start
-- VERSION 2.2.0 --
local Config = {
Sent = true,
Received = true,
MaxLines = 8,
Scroll = true,
Length = 60,
}
function inputevents(e)
if e.type == IEVENT_RMOUSEDOWN or e.type == IEVENT_MMOUSEDOWN then
HUD.Moving, HUD.Auxiliar = true, {$cursor.x - HUD.Position[1], $cursor.y - HUD.Position[2]}
elseif e.type == IEVENT_RMOUSEUP or e.type == IEVENT_MMOUSEUP then
HUD.Moving = false
elseif e.type == IEVENT_MOUSEWHEEL then
if iskeypressed(0x12) then
if e.value2 < 0 then
HUD.strStart, HUD.strEnd = HUD.strStart - 1, HUD.strEnd - 1
elseif e.value2 > 0 then
HUD.strStart, HUD.strEnd = HUD.strStart + 1, HUD.End + 1
end
if HUD.strStart > HUD.strMax then
HUD.strStart, HUD.strEnd = 1, 30
end
else
if #PrivateMessages > Config.MaxLines then
if e.value2 < 0 then
if HUD.Start <= #PrivateMessages - Config.MaxLines then
HUD.Start, HUD.End = HUD.Start + 1, HUD.End + 1
end
elseif e.value2 > 0 then
if HUD.End > Config.MaxLines then
HUD.Start, HUD.End = HUD.Start - 1, HUD.End - 1
end
end
end
end
elseif e.type == IEVENT_LMOUSEUP then
if e.elementid == HUD.Restart then
PrivateMessages = {}
end
end
end
local function displaytext(text, x, y, c)
addgradcolors(unpack(c))
local w, h = measurestring(text)
HUD.ColumnWidth[1], HUD.ColumnWidth[2] = math.max(HUD.ColumnWidth[1], w or 0), math.max(HUD.ColumnWidth[2], h or 0)
local t = drawroundrect(x, y, HUD.ColumnWidth[1] + 7, HUD.ColumnWidth[2], 2, 2)
drawtext(text, x + 2, y + math.floor(HUD.ColumnWidth[2] / 4) - 2.4)
return t
end
init end
if HUD.Moving then
auto(10)
HUD.Position = {$cursor.x - HUD.Auxiliar[1], $cursor.y - HUD.Auxiliar[2]}
$chardb:setvalue('AWE.PM', 'POSITION', table.concat(HUD.Position, ':'))
end
foreach newmessage m do
if m.channel:lower() ~= 'npcs' and (Config.Sent and m.type == MSG_SENT) or (Config.Received and m.type == MSG_PVT) then
print("Channel name: " .. m.channel)
table.insert(PrivateMessages, {text = string.format("%s %s [%s]: %s", os.date('%H:%M'), m.sender, m.level, m.content), color = m.type == MSG_PVT and HUD.Orange or HUD.Black})
end
end
local x, y, w, h = 0, 0, 0, 0
displaytext(" Private Messages:", x, y, HUD.Blue)
addgradcolors(unpack(#PrivateMessages > 0 and HUD.Green or HUD.Red))
w, h = measurestring("RESET")
HUD.ColumnWidth[1] = math.max(HUD.ColumnWidth[1], w)
HUD.Restart = drawroundrect(x - w + HUD.ColumnWidth[1], y, w + 7, h, 2, 2)
drawtext("RESET", 5 + x - w + HUD.ColumnWidth[1], y + math.floor(h / 4) - 2.4)
y = y + 20
for i = HUD.Start, HUD.End do
if PrivateMessages[i] then
local msg = PrivateMessages[i].text
local h, j = math.max(1, HUD.strStart), math.max(msg:len(), HUD.strEnd)
HUD.strMax = math.max(HUD.strMax, msg:len())
if h == 2 then
msg = "." .. msg:sub(h, j)
elseif h == 3 then
msg = ".." .. msg:sub(h, j)
elseif h >= 4 then
msg = "..." .. msg:sub(h, j)
else
msg = msg:sub(h, j)
end
displaytext(msg:fit(Config.Length or 60), x, y, PrivateMessages[i].color)
Here you go! I got the same problem (this only works if the private message window down to the right is empty btw). I reproduced the bug from the marked console line and down.
12-09-2016, 11:48 AM
Raphael
I suspect this is being caused by another script. Can you yet and reproduce the bug on an empty script?
12-09-2016, 03:46 PM
jajjje
The problem is still there when I open a empty windbot and only use the code that I posted above. I can clearify that its the private message HUD script (was a bit drunk when I posted this originaly) and it seems to only fill up when you talk in the NPC channel. When the private message HUD is filled (8 lines) it stops filling it up. I havent had the chance of testing it with real PMs since I dont know anyone playing on that server. Hopefully this helps a bit and clearifies some stuff a bit!
12-09-2016, 03:58 PM
Raphael
@jajjje Did you try this same script on WindBot for Tibia 10? It seems to be pretty broken from what I read.
Maybe @RoxZin xD can give us some insight, considering it is his script.
12-09-2016, 04:17 PM
jajjje
Well it worked on windbot for tibia 9.99 (or whatever version was before tibia 10). And this bug is just when I use WindBot for tibia 11 :)
Btw, awesome work with the new windbot client! This is the only thing ive noticed so far and its a really small (unnecessary) thing really, but useful ^^
12-09-2016, 06:03 PM
RoxZin xD
Quote:
Originally Posted by Raphael
@jajjje Did you try this same script on WindBot for Tibia 10? It seems to be pretty broken from what I read.
Maybe @RoxZin xD can give us some insight, considering it is his script.
The script originally doesn't have that, so I got no idea.