
Originally Posted by
Fatality
They both work for me o.0

Originally Posted by
Fatality
If you want it to return the same as the snippet of code, you could use this
lua code:
local time = os.date("*t", 906000490)
print('%s %d', time.hour, time.min)
And if you want it as a variable, not just printing it, you can do this.
lua code:
local time = os.date("*t", 906000490)
local tmp = "%s %s"
local stamp = time1:format(time.hour, time.min)
print(time)
Thanks - working on finding an exact repro. I tried to simplify too much, might be a Lua implementation issue (e.g one of the XB functions). Investigating, will update shortly.
The exact code, if anyone wants to investigate in tandem:
Code:
--[[
This is a XenoBot example script, intended to
teach new users about the scripting API and
act as script that is usable in actual play.
recentPrivateMessageHUD.lua - displays a HUD
showing your most recent private messages.
** DO NOT EDIT THIS FILE. INSTEAD, COPY IT TO
"Documents\XenoBot\Scripts" AND EDIT THE COPY. **
]]--
--set the title of the HUD
local title = "Recent Private Messages:"
local showTitle = true
--set the number of messages to show
local messageCount = 4
--set the maximum message length (including sender name)
local messageLength = 60
--set the top left x and y coordinates of the HUD
local location =
{
x = 25,
y = 5
}
--set the colors for the HUD
local colors =
{
message = {95, 247, 247},
title = {225, 225, 225},
}
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------
--this creates the title HUD
if (showTitle == true) then
local HUDTitle = HUD.CreateTextDisplay(location.x, location.y, title, unpack(colors.title))
location.y = location.y + 20 -- just offsets the y axis to below the header
end
--loop from 1 until messageCount, creating HUD objects for each
local HUDData = {}
for index = 1, messageCount do
local data = {}
-- no message yet
data.message = ""
--create the label HUD
data.label = HUD.CreateTextDisplay(
location.x,
-- +12 pixels to the y axis for every item
location.y + ((index - 1) * 12),
data.message,
-- text color
unpack(colors.message)
)
--store the data to use later
HUDData[index] = data
end
--this is a proxy event which gets invoked when a private message is received
PrivateMessageProxy.OnReceive("pmProxy", function (proxy, speaker, level, text)
--create the message from the data
local currentTime = os.date("*t")
local message = currentTime.hour .. ":" .. currentTime.min .. " | " .. speaker .. " [" .. level .. "]: " .. text
--if the message is too long, this will shorten it
if (string.len(message) > messageLength) then
message = string.sub(message, 0, messageLength - 3) .. "..."
end
--this will move each message "up" (from index 4 to 3, 3 to 2, 2 to 1, etc)
for index = 1, messageCount-1 do
HUDData[index].message = HUDData[index+1].message
HUDData[index].label:SetText(HUDData[index].message)
end
--this will put the new message in the last index
HUDData[messageCount].message = message
HUDData[messageCount].label:SetText(message)
end)
The line
Code:
local message = currentTime.hour .. ":" .. currentTime.min .. " | " .. speaker .. " [" .. level .. "]: " .. text
Remove the | and one of the spaces next to it, send yourself a PM, and observe crash.
Edit: Not crashing for me. Did for @Luls. Not crashing for him now. What the very fuck is happening?!