It'll show all the private messages sent and received on your screen.
Configuration
Change Sent to true to show messages sent by your character on the display, set it to false to hide them.
Change Received to true to show messages received by your character on the display, set it to false to hide them.
Change MaxLines to the number of lines you want to display.
Change Scroll to true to enable mouse scroll between messages on the display, set it to false to ignore this feature.
Change Length to the maximum text length you want to display.
Code
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
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)
I've got problem with this script.
I have to put it in Persistent , ye?
When I try to enable it :
14:43:19 error in Persistent script NewPersistentScript:
["HUD.ColumnWidth[1] = math.max(H..."]:NewPersistentScript:108 bad argument #2 to 'max' (number expected, got nil)
stack traceback:
["HUD.ColumnWidth[1] = math.max(HUD.ColumnWidth[1], w)"]:NewPersistentScript:108 in user script
08-04-2014, 07:05 PM
Leonardo
Quote:
Originally Posted by ralixi
I've got problem with this script.
I have to put it in Persistent , ye?
When I try to enable it :
14:43:19 error in Persistent script NewPersistentScript:
["HUD.ColumnWidth[1] = math.max(H..."]:NewPersistentScript:108 bad argument #2 to 'max' (number expected, got nil)
stack traceback:
["HUD.ColumnWidth[1] = math.max(HUD.ColumnWidth[1], w)"]:NewPersistentScript:108 in user script
No, you need to put it in HUD.
08-31-2014, 09:14 PM
Rickiey
Thanks for this lovely script
09-07-2014, 07:14 PM
firiots
would be nice if it has auto scroll.
11-26-2014, 07:49 PM
Banantwist
Hey there!
How can I move this HUD to the bottom left side instead of the right side? :)
What lines do I edit?
11-26-2014, 09:13 PM
Dragoon
Quote:
Originally Posted by Banantwist
Hey there!
How can I move this HUD to the bottom left side instead of the right side? :)
What lines do I edit?
Just hold down your middle mouse button on the blue bar and you can drag it wherever you like :)
11-27-2014, 12:18 AM
Banantwist
Quote:
Originally Posted by Dragoon
Just hold down your middle mouse button on the blue bar and you can drag it wherever you like :)
You're awesome! Thanks a lot! :)
12-23-2014, 10:29 AM
strahowski
Ever since adding this HUD to a script, I've had odd crashes (bot crashing that is) within minutes of starting it.
01-06-2015, 11:39 PM
Leonardo
Quote:
Originally Posted by strahowski
Ever since adding this HUD to a script, I've had odd crashes (bot crashing that is) within minutes of starting it.
Sorry for the long delay between this response, this is a Windows problem and by far can't be fixed, the solution is to go back to v2 if you have these problems
Me too .. windbot crashes whenever this HUD is enabled, even with the old version you gave to us.
Is there any fix for this situation?
I really would appreciate (and even pay for it!) a working PM HUD script.
01-19-2015, 08:50 PM
Leonardo
Quote:
Originally Posted by Pitoquinha
Me too .. windbot crashes whenever this HUD is enabled, even with the old version you gave to us.
Is there any fix for this situation?
I really would appreciate (and even pay for it!) a working PM HUD script.
Quote:
Originally Posted by leleog
I have the same problem, even with the v2.0.0, :(
Using Windows 8.1
Not that I don't want to do a working version, I can't recreate the error, it works good for me. I was talking with Lucas about it and he'll be checking future crash reports for this so I can find the bug, just make sure you use this hud again tomorrow and send the picture of your crash reports.
01-19-2015, 08:55 PM
Pitoquinha
Quote:
Originally Posted by Leonardo
Not that I don't want to do a working version, I can't recreate the error, it works good for me. I was talking with Lucas about it and he'll be checking future crash reports for this so I can find the bug, just make sure you use this hud again tomorrow and send the picture of your crash reports.
Where is the crash reports located? Is there a log or something I could check?
Because the bot doesnt shows up any alert box or anything, it just completely closes.
01-19-2015, 09:38 PM
Borges
Quote:
Originally Posted by Pitoquinha
Where is the crash reports located? Is there a log or something I could check?
Because the bot doesnt shows up any alert box or anything, it just completely closes.
windbot folder
01-19-2015, 09:50 PM
Leonardo
Quote:
Originally Posted by Pitoquinha
Where is the crash reports located? Is there a log or something I could check?
Because the bot doesnt shows up any alert box or anything, it just completely closes.
The crashes are sent to Lucas if there are any, but only if they appear in the screen I guess.
02-07-2015, 01:33 PM
downloadkct
Its not crashing for me but if i keep the bot running ANY script with this PMhud it will suddenly close itself without any kind of crash. Died twice because i didnt notice the windbot wasnt running anymore. Deleting this hud made it stop
02-07-2015, 01:41 PM
Pitoquinha
Quote:
Originally Posted by downloadkct
Its not crashing for me but if i keep the bot running ANY script with this PMhud it will suddenly close itself without any kind of crash. Died twice because i didnt notice the windbot wasnt running anymore. Deleting this hud made it stop
Yep, thats exactly what happens .. the bot simply closes.
02-10-2015, 02:03 AM
downloadkct
I saw it happening
Someone sent me a message then the PMHUD was partially black and totally to the right (like a giant message) and 2 seconds later the entire windbot wasnt responding, then it closed itself with no crashes. Maybe decreasing the Length = 60 to 20~30 will solve the problem (decreasing to 20~30 will make the message unreadable but atleast we will know someone sent a message when we wasnt looking)
Edit:
SEEMS to be working, didnt test it long enough but i tested some spam and stuff:
Code:
init start
-- VERSION 2.2.0a --
local Config = {
Sent = false,
Received = true,
MaxLines = 5,
Scroll = false,
Length = 20,
}
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])
01-22-2016, 10:53 PM
zoxovsky
Quote:
Originally Posted by downloadkct
I saw it happening
Someone sent me a message then the PMHUD was partially black and totally to the right (like a giant message) and 2 seconds later the entire windbot wasnt responding, then it closed itself with no crashes. Maybe decreasing the Length = 60 to 20~30 will solve the problem (decreasing to 20~30 will make the message unreadable but atleast we will know someone sent a message when we wasnt looking)
Edit:
SEEMS to be working, didnt test it long enough but i tested some spam and stuff:
Code:
init start
-- VERSION 2.2.0a --
local Config = {
Sent = false,
Received = true,
MaxLines = 5,
Scroll = false,
Length = 20,
}
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])
Work good, but its possible to make it automatic scrool when is 6+msgs?
01-22-2016, 11:41 PM
downloadkct
Test changing the Scroll = false to Scroll = true then you can scroll the messages but i dont know if it will automatic scroll down
01-23-2016, 12:37 AM
zoxovsky
Quote:
Originally Posted by downloadkct
Test changing the Scroll = false to Scroll = true then you can scroll the messages but i dont know if it will automatic scroll down
I replace it before, i must scroll it :/
02-15-2016, 09:42 PM
Kaszta
can u make script to answer private and default msg on huntingcave? like "hello im here, like 4h."
02-15-2016, 10:37 PM
blakw
Quote:
Originally Posted by Kaszta
can u make script to answer private and default msg on huntingcave? like "hello im here, like 4h."
Not that I don't want to do a working version, I can't recreate the error, it works good for me. I was talking with Lucas about it and he'll be checking future crash reports for this so I can find the bug, just make sure you use this hud again tomorrow and send the picture of your crash reports.
For me it crashes when writing "å", "ä", or "ö" and probably some other special characters.
Might be a hint for you :)
12-18-2016, 12:05 PM
knoxknox
Has someone got the autoscroll? I just can have 6PM then I don't know if anyone else is msg me.
12-23-2016, 02:24 PM
skolzacker
It crashed (windbot just closed) to me and I didnt received any PM.. Editing the length to 20 solve that problem?
12-23-2016, 04:32 PM
downloadkct
Quote:
Originally Posted by skolzacker
It crashed (windbot just closed) to me and I didnt received any PM.. Editing the length to 20 solve that problem?
Edit the length to 20 and the bug is solved. @Leonardo could you please update your main thread ? Lenght 60 is crashing windbot. Actually i tried some config and lenght that does not crash is 20, 30 crashes as well