PtokaX forum

Archive => Archived 4.0 boards => Finished Lua 4 scripts => Topic started by: BrokenBrick on 22 October, 2003, 00:36:37

Title: Uptime Script
Post by: BrokenBrick on 22 October, 2003, 00:36:37
This is a simple uptime script that I use, works in Td4 and IceCube.  It allows users to see the hubs running time (In days and hours) by typing +runtime.  I did not write this, but it works in both TD and IceCube as far as I know
_______________________________________

function DataArrival(USER,DATA)
if (strsub(DATA,1,1)=="<") then DATA=strsub(DATA,1,strlen(DATA)-1) s,e,CMD=strfind(DATA,".*%s+(%S+)")
if (strlower(CMD)=="+runtime") then local SC=clock()
USER:SendData("RUNTIME",floor(SC/86400).." days, "..floor(mod(SC/3600,24)).." hours, and "..floor(mod(SC/60,60)).." minutes.")
end
end
end
Title:
Post by: OpiumVolage on 22 October, 2003, 10:01:18
As far as i remember, comments where saying this part was extracted from retrobot.
Don't know who extracted it, i think it was skrollster.
Title:
Post by: BrokenBrick on 22 October, 2003, 22:50:15
Perhaps, I can't really remember, its been a while
Title:
Post by: Skrollster on 22 October, 2003, 23:49:58
i did it as far as i can remember... but i don't care, but write from where it was taken at least next time
Title:
Post by: BrokenBrick on 24 October, 2003, 06:07:38
I couldn't remember.  I was not claiming credit I can assure you of that.  I probably found it on the old forum as a response to someone problem and wanted to use it in my hub.  But that was months ago, and I have slept several times since then.  Sorry Skrollster
Title: uptime bot
Post by: [NL]trucker on 28 October, 2003, 23:16:08
ok folks i had this one stll in my archive and thought it would serve some use.

it is a combined script with hub up time and hub info.

i just hope i put it in the right section.


-- Uptime by extracted from retrobot By Skrollster
-- Retrobot is made by Tezlo
-- Hiding of command from MainChat is added by JenZen?


BotName = "hubinfo"

sek = 1000
min = sek*60
hour = min*60
days = hour*24

time = 1*hour

function Main()
SetTimer(time)
StartTimer()
end


function DataArrival(user, data)
-- remove end pipe
data=strsub(data,1,strlen(data)-1)
--extract command
_,_,cmd=strfind(data, "%b<>%s+(%S+)")
if(cmd == "uptime") then
local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)
sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
user:SendData("uptime", "*** "..days.." days, "..hrs.." hours "..min.."

minutes and "..sec.." seconds")
return 1;
end
end


function OnTimer()
local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)
sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
SendToAll(BotName,

"?=============="..frmHub:GetHubName().."=================| ?| ::Hub

Owner: xxxxx | ::Hub Info: Min Share xxx Gb | ::Hub Rules: Type !rules

or !help | ::Hub Op's: xxxx xxxxx xxxxxx | ::Hub E-Mail: xxxxxxxxxxx |

::Hub Address: xxxxxx or xxxxxx | ::Hub Network: xxxxxxxxx| ::Uptime =

"..days.." days, "..hrs.." hours "..min.." minutes and "..sec.."

seconds = ?")
SendToAll(BotName, "?============="..frmHub:GetUsersCount().." of

"..frmHub:GetMaxUsers().." Users Connected==================")
end
Title:
Post by: [NL]trucker on 28 October, 2003, 23:30:37
and another one whit out hubinfo .

i,m just not sure if it works for td4.

if so could anybody make it so that it will show automaticlly on a specific time-schedule?


--------------------------------------------------------------------------------
-- Uptime by extracted from retrobot By Skrollster
-- Retrobot is made by Tezlo
-- Hiding of command from MainChat is added by JenZen?

function DataArrival(user, data)
   -- remove end pipe
   data=strsub(data,1,strlen(data)-1)
   --extract command
   _,_,cmd=strfind(data, "%b<>%s+(%S+)")
   if(cmd == "uptime") then
local sec = clock()
local days = floor(sec/86400)
local hrs = floor((sec-(days*86400))/3600)
local min = floor((sec-(days*86400)-(hrs*3600))/60)
sec = floor(sec-(days*86400)-(hrs*3600)-(min*60))
user:SendData("uptime", "*** "..days.." days, "..hrs.." hours "..min.." minutes and "..sec.." seconds")
return 1;
   end
end
--------------------------------------------------------------------------------