Jump to content
  • 0

Question

Posted (edited)

How can get item every 60 minutes but per day ?

-	script	hourlypoints	-1,{

//--Start of the Script
OnPCLoginEvent:
attachnpctimer ""+strcharinfo(0)+"";
initnpctimer;
end;
    
OnTimer30000:
//Check if Vending (normal or @at)
if(checkvending() >= 1 || checkchatting() == 1) {
    dispbottom "The hourly points event stopped because you were vending / chatting. Please relog if you wish to start again.";
    stopnpctimer;
    end;
}
//Check if Idle
getmapxy( .@map$, .@x, .@y, 0 );
if(@map$ == .@map$ && @x == .@x && @y == .@y) {
    set @afk, @afk + 1;
}
//If move timer resets
else {
    set @afk, 0;
}
    set @map$, .@map$; set @x, .@x; set @y, .@y;
//Idle Check for 5 Minutes
if(@afk == 5) {
    dispbottom "The hourly points event stopped because you were idle for 5 minutes. Please relog if you wish to start again.";
    stopnpctimer;
    end;
}
end;

OnTimer60000:
set @minute, @minute + 1;
//Check for 1 Minute
if(@day<1) {
dispbottom "I'm sorry but you've already get this day";
}
if(@minute == 60){
    set @minute,0;
    getitem 7227,1;
    dispbottom "You received 1 "+getitemname( 7227 )+" by staying ingame for 1 hour";
    set @consecutive_hour, @consecutive_hour + 1;
    }
//Check for 12 hours consecutive
    if(@consecutive_hour == 6) {
    set @consecutive_hour,0;
    getitem 7227,1;
    dispbottom "You received 6 "+getitemname( 7227 )+" by staying ingame for consecutive of 6 hour";
    }
stopnpctimer;
initnpctimer;
end;

}

 

 

Edited by MukkiesftKies

8 answers to this question

Recommended Posts

Posted
-	script	hourlypoints	-1,{
OnPCLoginEvent:
	if( getd( ".L"+ getcharid(0) ) ) end;
	.@char_id = getcharid(0);
	setd ".L"+ .@char_id, 1;
	while(1) {
		.@loop__++;	// +1 loop every 30 secs
		if( #hourly_reward == gettime(8) ) {
			.@loop__ = 0;
			if( .re_log ) end;
		}
		else if( checkvending() || checkchatting() ) {
			dispbottom "The hourly points event stopped because you were vending / chatting. Please relog if you wish to start again.";
			end;
		}
		else if( checkidle() > 300 ) {
			if( .@loop__ > 1 )
				dispbottom "The hourly points event is re-initialized because you were idle more than 5 minutes.";
			.@loop__ = 0;
			if( .re_log ) end;
		}
		else if( .@loop__ == 60*2 ) {
			#hourly_reward = gettime(8);
			getitem .reward_ID,1;
			dispbottom "You received 1 "+ getitemname( .reward_ID ) +" by staying ingame for 1 hour.";
			if( .re_log ) end;
		}
		dispbottom "ok";
		sleep2 30000;
		if( !playerattached() ) {
			setd ".L"+ .@char_id, 0;
			end;
		}
	}
	end;
OnInit:
	.re_log = 0;		// player must relog to re-activate the hourly point ? (1: yes, 0: no)
	.reward_ID = 7227;	// item ID reward when player not idle and online more than 1 hour
	end;
}

There was a bug I didn't make enough check.

Posted
-	script	hourlypoints	-1,{
OnPCLoginEvent:
	while(1) {
		sleep2 30000;
		@loop__++;	// +1 loop every 30 secs
		if( hourly_reward == gettime(8) ) {
			@loop__ = 0;
			if( .re_log ) end;
		}
		else if( checkvending() || checkchatting() ) {
			dispbottom "The hourly points event stopped because you were vending / chatting. Please relog if you wish to start again.";
			end;
		}
		else if( checkidle() > 300 ) {
			if( @loop__ > 1 )
				dispbottom "The hourly points event is re-initialized because you were idle more than 5 minutes.";
			@loop__ = 0;
			if( .re_log ) end;
		}
		else if( @loop__ == 60*2 ) {
			hourly_reward = gettime(8);
			getitem .reward_ID,1;
			dispbottom "You received 1 "+ getitemname( .reward_ID ) +" by staying ingame for 1 hour.";
			if( .re_log ) end;
		}
	}
	end;
OnInit:
	.re_log = 0;		// player must relog to re-activate the hourly point ? (1: yes, 0: no)
	.reward_ID = 7227;	// item ID reward when player not idle and online more than 1 hour
	end;
}

1 reward by player if he stay online 1 hour and is not idle.

Replace hourly_reward by #hourly_reward if you want 1 reward by account.

Posted

Hard to i explain cause i don't know to speak english , hehe. 

 

like this i mean :-

Play a total of 1 hour each day (limit: 1 item per day).

 

 

I have tried the script, but there is an error in else if( checkidle() > 300 ) {

Posted

Checkidle is implemented since r17126

 

Play a total of 1 hour each day (limit: 1 item per day).

Okay.

Another question: 1 item in the day by character or by account ?

 

-	script	hourlypoints	-1,{
OnPCLoginEvent:
	if( hourly_reward$ != "" )
		explode( .@tmp$, hourly_reward$, "|" );
	if( atoi( .@tmp$ ) == gettime(8) ) end;
	@day_ = atoi( .@tmp$ );
	@timer_count = atoi( .@tmp$[1] );
	while(1) {
		sleep2 30000;
		@timer_count = @timer_count + 30;
		if( checkvending() || checkchatting() ) {
			dispbottom "The hourly points event stopped because you were vending / chatting. Please relog if you wish to start again.";
			end;
		}
		// else if( checkidle() > 300 ) {
			// if( @loop__ > 1 )
				// dispbottom "The hourly points event is re-initialized because you were idle more than 5 minutes.";
			// @loop__ = 0;
		// }
		else if( @timer_count == 3600 ) {
			@day_ = gettime(8);
			@timer_count = 0;
			getitem .reward_ID,1;
			dispbottom "You received 1 "+ getitemname( .reward_ID ) +" by staying ingame for 1 hour.";
			end;
		}
	}
	end;
OnPCLogoutEvent:
	hourly_reward$ = @day_ + "|" + @timer_count;
	end;
OnInit:
	.reward_ID = 7227;	// item ID reward when player not idle and online more than 1 hour
	end;
}

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...