Jump to content
  • 0

Server Uptime


RAWRs

Question


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  76
  • Reputation:   1
  • Joined:  11/17/11
  • Last Seen:  

Any script for showing how long my server run'd after restart? something like @uptime but in chatroom

Link to comment
Share on other sites

13 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1131
  • Joined:  05/27/12
  • Last Seen:  

Something like this?

prontera,159,187,4    script    Uptime    858,{
function Add_Zero; function Add_S;

   mes
       "[uptime]",
       "The server has been online for ",
       ((.t[1])?Add_S(.t[1],"hour")+", ":"")+
       ((.t[1]||.t[2])?Add_S(.t[2],"minute")+" ":"")+
       ((getarraysize(.t)>2)?"and ":"")+Add_S(.t[3],"second")+", "+
       "and counting!";
   close;

   function Add_Zero { return ((getarg(0)<10)?"0":"")+getarg(0); }
   function Add_S { return "^0055FF"+getarg(0)+" "+getarg(1)+((getarg(0)==1)?"":"s")+"^000000"; }

OnInit:
   set .t[0], gettimetick(2);
   waitingroom "   [ 00:00:00 ]",0;
   initnpctimer;
   end;

OnTimer950:
   set .@t, gettimetick(2)-.t[0];
   set .t[1], .@t/3600;
   set .t[2], .@t/60-.t[1]*60;
   set .t[3], .@t%60;
   end;

OnTimer990:
   initnpctimer;
   delwaitingroom;
   waitingroom "   [ "+Add_Zero(.t[1])+":"+Add_Zero(.t[2])+":"+Add_Zero(.t[3])+" ]",0;
   end;
}

  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  76
  • Reputation:   1
  • Joined:  11/17/11
  • Last Seen:  

Yeah its working Euphy, Thank You! /no1

But is it possible to make it for month,years? If yes,can you edit your previous script,add the Years & Months.

Edited by RAWRs
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1131
  • Joined:  05/27/12
  • Last Seen:  

How would you want that displayed o.o?

// This is pretty much unreadable.
yr:mo:dy:hr:mn:sc
00:00:00:00:00:00

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  76
  • Reputation:   1
  • Joined:  11/17/11
  • Last Seen:  

How would you want that displayed o.o?

// This is pretty much unreadable.
yr:mo:dy:hr:mn:sc
00:00:00:00:00:00

Yeah.So it impossible to do it?

yr:mo:dy:hr:mn:sc

0:00:000:00:00:00

Edited by RAWRs
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  76
  • Reputation:   1
  • Joined:  11/17/11
  • Last Seen:  

How would you want that displayed o.o?

// This is pretty much unreadable.
yr:mo:dy:hr:mn:sc
00:00:00:00:00:00

Well what about days?

Link to comment
Share on other sites


  • Group:  Developer
  • Topic Count:  10
  • Topics Per Day:  0.00
  • Content Count:  2407
  • Reputation:   613
  • Joined:  07/05/12
  • Last Seen:  

Just days

dy:hr:mn:sc

00:00:00:00

prontera,159,187,4	script	Uptime	858,{
function Add_Zero; function Add_S;

mes
	"[uptime]",
	"The server has been online for ",
	((.t[1])?Add_S(.t[1],"day")+", ":"")+
	((.t[2])?Add_S(.t[2],"hour")+", ":"")+
	((.t[2]||.t[3])?Add_S(.t[3],"minute")+" ":"")+
	((getarraysize(.t)>2)?"and ":"")+Add_S(.t[4],"second")+", "+
	"and counting!";
close;

function Add_Zero { return ((getarg(0)<10)?"0":"")+getarg(0); }
function Add_S { return "^0055FF"+getarg(0)+" "+getarg(1)+((getarg(0)==1)?"":"s")+"^000000"; }

OnInit:
set .t[0], gettimetick(2);
waitingroom "  [ 00:00:00 ]",0;
initnpctimer;
end;

OnTimer950:
set .@t, gettimetick(2)-.t[0];
set .t[1], .@t/(3600*24);
set .t[2], .@t/3600-.t[1]*24;
set .t[3], .@t/60-.t[2]*60;
set .t[4], .@t%60;
end;

OnTimer990:
initnpctimer;
delwaitingroom;
waitingroom "  [ "+Add_Zero(.t[1])+":"+Add_Zero(.t[2])+":"+Add_Zero(.t[3])+":"+Add_Zero(.t[4])+" ]",0;
end;
}

I don't think it's useful to display month and years, reloadscript reset the count.

Edit : Fix one mistake.

Edited by Capuche
  • Upvote 1
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

Why not use a permanent scope?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1131
  • Joined:  05/27/12
  • Last Seen:  

@nanakiwurtz: He asked for temporary, unless I'm interpreting this incorrectly?

showing how long my server run'd after restart

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  81
  • Topics Per Day:  0.02
  • Content Count:  1654
  • Reputation:   583
  • Joined:  08/09/12
  • Last Seen:  

Hmhm.. I see.. I learned a lot, thanks Euphy and Capuche /no1

+1 for you both

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  17
  • Topics Per Day:  0.00
  • Content Count:  76
  • Reputation:   1
  • Joined:  11/17/11
  • Last Seen:  

Thanks to all of you /kis

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  40
  • Topics Per Day:  0.01
  • Content Count:  587
  • Reputation:   104
  • Joined:  11/19/11
  • Last Seen:  

@nanakiwurtz: He asked for temporary, unless I'm interpreting this incorrectly?

showing how long my server run'd after restart

Is it possible to prevent @reloadscript resetting the time?

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  72
  • Topics Per Day:  0.02
  • Content Count:  2997
  • Reputation:   1131
  • Joined:  05/27/12
  • Last Seen:  

The most accurate way is to get the time directly from your SQL database, as Brian posted here: http://www.eathena.ws/board/index.php?showtopic=207797

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  46
  • Topics Per Day:  0.01
  • Content Count:  131
  • Reputation:   1
  • Joined:  12/29/12
  • Last Seen:  


prontera,159,187,4	script	Uptime	858,{
function Add_Zero; function Add_S;

	mes
		"[Uptime]",
		"The server has been online for ",
		((.t[1])?Add_S(.t[1],"day")+", ":"")+
		((.t[2])?Add_S(.t[2],"hour")+", ":"")+
		((.t[2]||.t[3])?Add_S(.t[3],"minute")+" ":"")+
		((getarraysize(.t)>2)?"and ":"")+Add_S(.t[4],"second")+", "+
		"and counting!";
	close;

	function Add_Zero { return ((getarg(0)<10)?"0":"")+getarg(0); }
	function Add_S { return "^0055FF"+getarg(0)+" "+getarg(1)+((getarg(0)==1)?"":"s")+"^000000"; }

OnInit:
	set .t[0], gettimetick(2);
	waitingroom "  [ 00:00:00 ]",0;
	initnpctimer;
	end;

OnTimer950:
	set .@t, gettimetick(2)-.t[0];
	set .t[1], .@t/(3600*24);
	set .t[2], .@t/3600-.t[1]*24;
	set .t[3], .@t/60-.t[2]*60;
	set .t[4], .@t%60;
	end;

OnTimer990:
	initnpctimer;
	delwaitingroom;
	waitingroom "  [ "+Add_Zero(.t[1])+":"+Add_Zero(.t[2])+":"+Add_Zero(.t[3])+":"+Add_Zero(.t[4])+" ]",0;
	end;
}

found bug on this script.. if the server run for 12days its show like this d12:h00:m1234124:s00 the day wll not increase the time will add at minute..

 

then how to change this script like read when the server 1st start.

Edited by Cisqua
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...