I just cleaned up the Lua-script "auxbox.lua" with texts for the message-box a bit (indentation and whitespace were rather messy). The script used to be in a subdirectory "clientscripts" (which doesn't seem to exist in the recent client-distribution any more, but could still be created again by hand). The script shows real-life-time and session-time in the message-box at the moment (this is my config, stats for damage per second would also be possible):
Code: Select all
filterTextLines = [[Hit the following keys
to filter item types:
w: weapons
W: wearables
p: potions
s: shields
u: usable
j: jewellry
f: food
U: unidentified
h: slot-head
t: slot-torso
l: slot-legs
b: slot-boots
g: slot-gloves
r: slot-rings
n: slot-neck
S: spells & scrolls
G: gems
R: reagants, etc
A: cancel filtering
v: cancel filtering]]
auxbox_next_line = 0
session_time = 0
sessionstart = os.time()
shiftkeys = {"Shift", "Alt", "Ctrl+Shift", "Shift+Alt",
"Ctrl+Alt", "Ctrl+Alt+Shift"}
function auxbox()
local w = d:auxbox_get_width()
local h = d:auxbox_get_height()
d:auxbox_clear()
auxbox_next_line = 0
if not d:ok_to_draw_play_window() then
return
end
local cd = d:get_curr_display()
local mode = d:get_statbox_mode()
local lineNr = 0
local txta = explode("\n", filterTextLines)
if cd == 1 then
if mode == SELECT_ABILITY then
auxbox_prop_line("Hit F-key to bind currently")
auxbox_prop_line("selected spell")
auxbox_blank_line()
auxbox_ability_binds()
else
for i = 1, #txta do
auxbox_prop_line(txta[i])
end
auxbox_blank_line()
auxbox_prop_line("Search with /")
if mode == SELECT_READY then
auxbox_prop_line("Press ENTER to equip")
elseif mode == SELECT_BUY then
auxbox_prop_line("Press ENTER to buy")
elseif mode == SELECT_BANK then
auxbox_prop_line("Press ENTER to transfer one")
auxbox_prop_line("Press Shift+ENTER for 10")
auxbox_prop_line("Press TAB for whole stack")
end
end
else
auxbox_time()
auxbox_blank_line()
-- auxbox_damage_per_second()
-- auxbox_blank_line()
-- auxbox_prop_line("Forums: forums.swut.net")
-- auxbox_prop_line("Manual: euotopia.com/manual")
if d:numlock() then
auxbox_blank_line()
auxbox_prop_line("Please turn numlock off!")
end
-- auxbox_prop_line("F12 for main menu.")
-- auxbox_blank_line()
-- auxbox_f5_message()
end
end
-- explode(seperator, string)
-- from http://lua-users.org/wiki/SplitJoin
function explode(d, p)
local t, ll
t = {}
ll = 0
if (#p == 1) then
return p
end
while true do
l = string.find(p, d, ll+1, true)
if l ~= nil then
table.insert(t, string.sub(p, ll, l-1))
ll = l + 1
else
table.insert(t, string.sub(p, ll))
break
end
end
return t
end
-- Real World Time - Duncan (PD) / Zen (Reg) / Brentoboy (forums)
function auxbox_time()
auxbox_prop_line("Real World Time:", string.format(os.date("%I:%M%p")))
if os.difftime(os.time(), sessionstart) > session_time then
session_time = os.difftime(os.time(), sessionstart)
session_d_float = session_time / 60 / 60 / 24
session_d = math.floor(session_d_float)
session_h = math.floor((session_d_float - session_d) * 24)
session_m = math.floor(((session_d_float - session_d) * 24 - session_h) * 60)
session_s = math.floor((((session_d_float - session_d) * 24 - session_h) * 60 - session_m) * 60)
end
if session_d ~= nil then
auxbox_prop_line("Session time:", string.format("%02.f:%02.f:%02.f:%02.f", session_d, session_h, session_m, session_s))
end
end
function auxbox_f5_message()
auxbox_prop_line("Press Alt-F5 to Reset", "")
end
function auxbox_prop_line(prop_name, prop_val)
local pvl = 0
if prop_name == nil then prop_name = "" end
if prop_val == nil then prop_val = "" end
local filler = string.rep(" ", 25 - string.len(prop_name) - string.len(prop_val))
auxbox_next_line = auxbox_next_line + 1
d:auxbox_set_line(auxbox_next_line, string.format("%s %s %s", prop_name, filler, prop_val))
end
function auxbox_blank_line()
auxbox_next_line = auxbox_next_line + 1
end
--- Damage Per Second -- original script proveded by LordMortiferus
last_session_seconds = 0
last_4_dpst = {g_dpst, g_dpst, g_dpst, g_dpst}
last_4_dtpst = {g_dtpst, g_dtpst, g_dtpst, g_dtpst}
last_dpst = g_dpst
recent_dmg = {0, 0, 0, 0}
function auxbox_damage_per_second()
local session_seconds = os.time() - sessionstart
if session_seconds > last_session_seconds then
last_session_seconds = session_seconds
last_4_dpst[4] = last_4_dpst[3]
last_4_dpst[3] = last_4_dpst[2]
last_4_dpst[2] = last_4_dpst[1]
last_4_dpst[1] = g_dpst
last_4_dtpst[4] = last_4_dtpst[3]
last_4_dtpst[3] = last_4_dtpst[2]
last_4_dtpst[2] = last_4_dtpst[1]
last_4_dtpst[1] = g_dtpst
end
if last_dpst ~= g_dpst then
recent_dmg[4] = recent_dmg[3]
recent_dmg[3] = recent_dmg[2]
recent_dmg[2] = recent_dmg[1]
recent_dmg[1] = g_dpst - last_dpst
last_dpst = g_dpst
end
auxbox_prop_line("Dmg Dealt / Sec", string.format("%d", (last_4_dpst[1] - last_4_dpst[4]) / 4))
auxbox_prop_line("Dmg Taken / Sec", string.format("%d", (last_4_dtpst[1] - last_4_dtpst[4]) / 4))
auxbox_prop_line("Recent Dmg Dealt", "")
auxbox_prop_line("", string.format("%d %d %d %d", recent_dmg[4], recent_dmg[3], recent_dmg[2], recent_dmg[1]))
end