There was a lot of talk recently about how HUDs were super laggy on VPS, and personally I'm not a fan of having 2 huge colourful blocks at each side of the screen, so I decided to come up with what I think is an ideal solution to both problems... I give you, XJHUD:
It's not exactly the most stylish, and the code behind it is absolutely disgusting right now (it's basically hacked together from a variety of other HUDs), but it does work and it should be fairly efficient for VPS purposes. It looks the part for my purposes also. There are no gradients to render (which could be a cause of resource consumption on VPS), and the information is concise but useful. There are no useless labels to render, and it should show all the information required. To elaborate on what information is listed:
- Experience to level / Time to level
- Experience per hour
- Stamina remaining
- Ping
- Item ID of item under mouse cursor
- Loot - Waste = profit/waste
- State switches for cavebot, looting, targeting, spell healer, potion healer, condition healer, mana trainer.
It's worth noting that in the screenshot it lists the number of mana potions left. I removed that from the code below but it could be re-added by adding a newline before line #75 with the following:
{color = 0xcccccc, text = 'Manas: ', value = servercount("strong mana potion") .. " MP"},
Change "strong mana potion" for your getuseroption() or whatever. I don't think this is valuable to most people but I'm using this script to semi-afk bot a bit so I found it quite useful.
It might also be useful to know that I am using Ubuntu font - it's available free of charge on the Ubuntu Font website, alternatively you can edit line #41 where the font is specified. I have some serious wood for Ubuntu font so y'know, I highly recommend it.
Please accept my most sincere apologies for the state of the code. I will work on improving it when I next get a chance.
init start
setposition($clientwin.left+8, $clientwin.top+8)
local cursorPosition = {}
local moving
local engines = {'Cavebot', 'Looting', 'Targeting', 'Spell Healer', 'Potion Healer', 'Condition Healer', 'Mana Trainer'}
filterinput(false, true, false, false)
function inputevents(e)
if e.type == IEVENT_LMOUSEUP then
if e.elementid == closeButton then
closed = true
return
end
for _, v in ipairs(engines) do
if e.elementid == v.shape then
toggle(v.name:gsub(' ', '') .. '/Enabled')
return
end
end
elseif e.elementid ~= nil then
if e.type == IEVENT_MMOUSEDOWN then
moving = true
cursorPosition.x = $cursor.x
cursorPosition.y = $cursor.y
return
elseif e.type == IEVENT_MMOUSEUP then
moving = false
return
end
end
end
for k, v in ipairs(engines) do
engines[k] = {
name = v,
shape = nil
}
end
local fontsize = 10
local fontspacing = fontsize + 4
setfontstyle("Ubuntu", 10, 100, 0xCCCCCC, 1, 0x555555)
local maxsize = 150
setmaskcolorxp(0)
init end
auto(100)
if moving then
auto(10)
local curPosition = getposition()
setposition(
curPosition.x + ($cursor.x - cursorPosition.x),
curPosition.y + ($cursor.y - cursorPosition.y)
)
cursorPosition.x = $cursor.x
cursorPosition.y = $cursor.y
end
lootedvalue = 0
usedvalue = 0
foreach supplyitem m do
usedvalue = usedvalue + m.amountused * m.buyprice
end
foreach lootingitem m do
lootedvalue = lootedvalue + m.amountlooted * m.sellprice
end
local info = {
{color = 0xcccccc, text = 'Level up: ', value = num($exptonextlevel) .. ' exp / ' .. time(timetolevel()) .. " m"},
{color = 0xcccccc, text = 'Per hour: ', value = "X: " .. num($exphour/1000) .. "k/h | " .. "P: " .. num((lootedvalue - usedvalue) / ((($charactertime/1000)/60)/60)/1000) .. "k/h" },
{color = 0xcccccc, text = 'Stamina: ', value = num($stamina / 60) .. " h " .. num($stamina % 60) .. " m"},
{color = 0xcccccc, text = 'Ping: ', value = num($pingaverage) .. " ms"},
{color = 0xcccccc, text = 'ItemID: ', value = "ID: " .. $cursorinfo.id},
{color = 0xcccccc, text = 'Profit: ', value = math.floor(lootedvalue/1000) .. 'k - ' .. math.floor(usedvalue/1000) .. 'k = ' .. math.floor(lootedvalue / 1000) - math.floor(usedvalue / 1000) .. 'k'},
}
for i,j in ipairs(info) do
local posy = (i-1)*fontspacing
setfontcolor(j.color)
drawtext(j.value, 0, posy)
end
local startStatesY = (table.getn(info) * fontspacing) - 18
local isEnabled
for k, v in ipairs(engines) do
isEnabled = get(v.name:gsub(' ', '') .. '/Enabled') == 'yes'
setfillstyle('color', tern(isEnabled, 0x175B00, 0x7E241B))
engines[k].shape = addshape('roundrect', 0, k * 23 + startStatesY, 120, 20, 3, 3)
addtext(v.name, 6 + tern(isEnabled, 0, 0), k * 23 + 3 + startStatesY)
end