Jump to content
  • 0

Time on Script


HD Scripts

Question


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  183
  • Reputation:   15
  • Joined:  06/10/12
  • Last Seen:  

hello '-'

I know how to put a time on a script ...

I think it would be something like:

OnPCLoginEvent:
set minute,minute +1;
dispbottom "Time logged: " + minute + " minute";
end;

but this does not work, someone has an idea?

Edited by Hurican Dooders
Link to comment
Share on other sites

9 answers to this question

Recommended Posts


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  36
  • Reputation:   4
  • Joined:  02/12/12
  • Last Seen:  

This o.O ?

dispbottom "Logged in at: "+gettimestr("%Y-%m/%d &H:%M:%S", 21);

@edit

lol, nvm now i understood what you want..

function	returnFormatTime	{
set .@remain_time,getarg(0);
if(.@remain_time > 0) {
	set .@time[0],.@remain_time / 86400;
	set .@remain_time,.@remain_time % 86400;
	set .@time[1],.@remain_time / 3600;
	set .@remain_time,.@remain_time % 3600;
	set .@time[2],.@remain_time / 60;
	set .@remain_time,.@remain_time % 60;
	set .@time[3],.@remain_time;
}
return (.@time[0] ? .@time[0]+"day(s) " : "")+(.@time[1] ? .@time[1]+"hour(s) " : "")+(.@time[2] ? .@time[2]+"minute(s) " : "")+(.@time[3] ? .@time[3]+"second(s) " : "");
}

OnPcLoginEvent:
set @logged_in,gettimetick(3);
if(loggedtime) {
dispbottom "Logged in time: "+returnFormatTime(loggedtime);
}

OnPcLogoutEvent:
set loggedtime, loggedtime + ( gettimetick(3) - @logged_in );

Try this.

Edited by Tribbiani
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  183
  • Reputation:   15
  • Joined:  06/10/12
  • Last Seen:  

i'm not in home, but i try this later

thanks '-'

@edit

Error x.x'

semttulojn.jpg

http://img542.imageshack.us/img542/2439/semttulojn.jpg

Edited by Hurican Dooders
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  36
  • Reputation:   4
  • Joined:  02/12/12
  • Last Seen:  

Did you add the tabs to the function?

function<tab>returnFormatTime<tab>{

@edit

Also add this.. I mean replace.

OnPcLogoutEvent:
if(@logged_in) {
   set loggedtime, loggedtime + ( gettimetick(3) - @logged_in );
}

Edited by Tribbiani
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  183
  • Reputation:   15
  • Joined:  06/10/12
  • Last Seen:  

cara, tu é brasileiro? O.O

@edit

if(Brasileiro) mes "Sim, coloquei as tabs corretamente...";

else

yes, tabs added correctly

Edited by Hurican Dooders
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  36
  • Reputation:   4
  • Joined:  02/12/12
  • Last Seen:  

function		returnFormatTime		{
	set .@remain_time,getarg(0);
	if(.@remain_time > 0) {
			set .@time[0],.@remain_time / 86400;
			set .@remain_time,.@remain_time % 86400;
			set .@time[1],.@remain_time / 3600;
			set .@remain_time,.@remain_time % 3600;
			set .@time[2],.@remain_time / 60;
			set .@remain_time,.@remain_time % 60;
			set .@time[3],.@remain_time;
	}
	return (.@time[0] ? .@time[0]+"day(s) " : "")+(.@time[1] ? .@time[1]+"hour(s) " : "")+(.@time[2] ? .@time[2]+"minute(s) " : "")+(.@time[3] ? .@time[3]+"second(s) " : "");
}

This function needs to be added inside the npc..

what i mean is.. you need to add this function inside the script.

example:

prontera,150,150,4<Tab>script<Tab>name<tab>849,{

function		returnFormatTime		{
	set .@remain_time,getarg(0);
	if(.@remain_time > 0) {
			set .@time[0],.@remain_time / 86400;
			set .@remain_time,.@remain_time % 86400;
			set .@time[1],.@remain_time / 3600;
			set .@remain_time,.@remain_time % 3600;
			set .@time[2],.@remain_time / 60;
			set .@remain_time,.@remain_time % 60;
			set .@time[3],.@remain_time;
	}
	return (.@time[0] ? .@time[0]+"day(s) " : "")+(.@time[1] ? .@time[1]+"hour(s) " : "")+(.@time[2] ? .@time[2]+"minute(s) " : "")+(.@time[3] ? .@time[3]+"second(s) " : "");
}

OnPcLoginEvent:
set @logged_in,gettimetick(3);
if(loggedtime) {
dispbottom "Logged in time: "+returnFormatTime(loggedtime);
}

OnPcLogoutEvent:
if(@logged_in) {
       set loggedtime, loggedtime + ( gettimetick(3) - @logged_in );
}



}

Edited by Tribbiani
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  183
  • Reputation:   15
  • Joined:  06/10/12
  • Last Seen:  

i go try this, edit here if not works '-'

Ok, it works...

I wanted to happen to that information every 1 minute

in this case, placing a OnTimer60000:

I tried this but no success;/

as it does?

Edited by Hurican Dooders
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   1
  • Joined:  06/22/12
  • Last Seen:  

If you want it to tell the logged in time, maybe to update in the player's client every 5 minutes, you could do this: http://upaste.me/raw/e75e52836dc5ba1

Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  183
  • Reputation:   15
  • Joined:  06/10/12
  • Last Seen:  

works... but tell:

You have been logged in for 0 minutes.

#edit

I fixed it ...

looked like this:


- script Online1min -1,{

OnPCLoginEvent:X:
sleep2 60000;
set @loggedtime, @loggedtime + 1;
set @logtimeupdate, @logtimeupdate + 1;
if ( @logtimeupdate >= 1 ) {

dispbottom "You have been logged in for " + @loggedtime + " minutes.";
}
goto X;
end;

OnPCLogoutEvent:
set @logtimeupdate, 0;
}

operating at every 1 minute, and counting correctly.

log out, resets the count and when log in again, begins to tell ...

thanks man, helped me a lot.

* ------ *

and thanks to @ Tribbiani for the help too.

can close

Edited by Hurican Dooders
Link to comment
Share on other sites


  • Group:  Members
  • Topic Count:  3
  • Topics Per Day:  0.00
  • Content Count:  23
  • Reputation:   1
  • Joined:  06/22/12
  • Last Seen:  

You don't need to set it to 0 when logging out. It's a temporary character variable so it resets to nothing once your char is logged out. No problem btw, & sorry about the 0 minute thing xD (I wrote it in a minute)

Edit: Fixed my font/color/ & size.

Edited by Yanji
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...