Jump to content
  • 0

Hourly Vending Timer Stop ?


Bringer

Question


  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  746
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

-	script	hourly_point_main	-1,{
    
    OnInit:
        .duration = 1800;
	.vip_multi = 1;
        .npc_name$ = strnpcinfo(3);
	.delay   = 1000;       //Delay for idle re-check check. ( Default: 1000 [ = 1 Second ] )
	.idle    = 60*5;       //Player is idle after not moving for this many seconds. ( Default: 60*5 [ = 5 Minutes ] )
	set .2cpoint_amt, 20; //Points gained for consecutive time online.
	set .3cpoint_amt, 30; //Points gained for consecutive time online.
	set .4cpoint_amt, 40; //Points gained for consecutive time online.
	set .5cpoint_amt, 50; //Points gained for consecutive time online.
	set .6cpoint_amt, 60; //Points gained for consecutive time online.
	set .7cpoint_amt, 70; //Points gained for consecutive time online.
	set .8cpoint_amt, 80; //Points gained for consecutive time online.    
	set .point_amt, 10; //Normal points gained.
        bindatcmd "reward",    .npc_name$ + "::OnCheck";
        end;

    OnUpdate:
	//Check for idle.
	while(checkvending() >= 1 || checkchatting() == 1 || checkidle() >= .idle) {
		if( .@mes$ == "" ) {
			dispbottom set( .@mes$, "The hourly points event stopped because you were vending, chatting, or idle!" );
		}
		sleep2 .delay;
	}
	set #HourlyPoints, #HourlyPoints + .point_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
	dispbottom "You received "+.point_amt+" Reward Hourly Points by staying ingame for 1 hour";
	dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	set @consecutive_hour, @consecutive_hour + 1;

	//Check for 2 hours consecutive
	if(@consecutive_hour == 2) {
		set #HourlyPoints, #HourlyPoints + .2cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.2cpoint_amt+" Reward Hourly Points due to playing for 2 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 3 hours consecutive
	else if(@consecutive_hour == 3) {
		set #HourlyPoints, #HourlyPoints + .3cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.3cpoint_amt+" Reward Hourly Points due to playing for 3 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 4 hours consecutive
	else if(@consecutive_hour == 4) {
		set #HourlyPoints, #HourlyPoints + .4cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.4cpoint_amt+" Reward Hourly Points due to playing for 4 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 5 hours consecutive
	else if(@consecutive_hour == 5) {
		set #HourlyPoints, #HourlyPoints + .5cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.5cpoint_amt+" Reward Hourly Points due to playing for 5 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 6 hours consecutive
	else if(@consecutive_hour == 6) {
		set #HourlyPoints, #HourlyPoints + .6cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.6cpoint_amt+" Reward Hourly Points due to playing for 6 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 7 hours consecutive
	else if(@consecutive_hour == 7) {
		set #HourlyPoints, #HourlyPoints + .7cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.7cpoint_amt+" Reward Hourly Points due to playing for 7 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 8 hours consecutive
	else if(@consecutive_hour == 8) {
		set @consecutive_hour,0;
		set #HourlyPoints, #HourlyPoints + .8cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.8cpoint_amt+" Reward Hourly Points due to playing for 8 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
	@timer = gettimetick(2) + .duration;
	addtimer ( .duration * 1000 ), .npc_name$+"::OnUpdate";
	end;
       
    OnPCLoginEvent:
        atcommand "@refresh "+strcharinfo(0);
	@timer = gettimetick(2) + .duration;
	addtimer ( .duration * 1000 ), .npc_name$+"::OnUpdate";
	dispbottom "Hourly Rewards have been started for this character.";
	end;

    OnCheck:
        .@min = (@timer - gettimetick(2))/60;
        .@sec = (@timer - gettimetick(2))%60;
        dispbottom "War Server",0x9ae2d7;
        dispbottom "Total Hours Online " +@consecutive_hour+ "",0x9ae2d7;
        dispbottom "Reward Hourly Points : ^FF0000[ "+#HourlyPoints+" ]^000000",0x9ae2d7;
        dispbottom "[ Hourly Rewards ] Your next reward will be achieved in " +
                    ((.@min)?            "[ " + .@min + " ] minute"         + ((.@min > 1)?"s":""):"") +
                    ((.@min && .@sec)?    " and ":"") +
                    ((.@sec)?            "[ " + .@sec + " ] second"    + ((.@sec > 1)?"s":""):"") +
                    "!",0x9ae2d7;
        end;            
}

 

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

2 hours ago, Bringer said:

-	script	hourly_point_main	-1,{
    
    OnInit:
        .duration = 1800;
	.vip_multi = 1;
        .npc_name$ = strnpcinfo(3);
	.delay   = 1000;       //Delay for idle re-check check. ( Default: 1000 [ = 1 Second ] )
	.idle    = 60*5;       //Player is idle after not moving for this many seconds. ( Default: 60*5 [ = 5 Minutes ] )
	set .2cpoint_amt, 20; //Points gained for consecutive time online.
	set .3cpoint_amt, 30; //Points gained for consecutive time online.
	set .4cpoint_amt, 40; //Points gained for consecutive time online.
	set .5cpoint_amt, 50; //Points gained for consecutive time online.
	set .6cpoint_amt, 60; //Points gained for consecutive time online.
	set .7cpoint_amt, 70; //Points gained for consecutive time online.
	set .8cpoint_amt, 80; //Points gained for consecutive time online.    
	set .point_amt, 10; //Normal points gained.
        bindatcmd "reward",    .npc_name$ + "::OnCheck";
        end;

    OnUpdate:
	//Check for idle.
	while(checkvending() >= 1 || checkchatting() == 1 || checkidle() >= .idle) {
		if( .@mes$ == "" ) {
			dispbottom set( .@mes$, "The hourly points event stopped because you were vending, chatting, or idle!" );
		}
		sleep2 .delay;
	}
	set #HourlyPoints, #HourlyPoints + .point_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
	dispbottom "You received "+.point_amt+" Reward Hourly Points by staying ingame for 1 hour";
	dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	set @consecutive_hour, @consecutive_hour + 1;

	//Check for 2 hours consecutive
	if(@consecutive_hour == 2) {
		set #HourlyPoints, #HourlyPoints + .2cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.2cpoint_amt+" Reward Hourly Points due to playing for 2 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 3 hours consecutive
	else if(@consecutive_hour == 3) {
		set #HourlyPoints, #HourlyPoints + .3cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.3cpoint_amt+" Reward Hourly Points due to playing for 3 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 4 hours consecutive
	else if(@consecutive_hour == 4) {
		set #HourlyPoints, #HourlyPoints + .4cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.4cpoint_amt+" Reward Hourly Points due to playing for 4 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 5 hours consecutive
	else if(@consecutive_hour == 5) {
		set #HourlyPoints, #HourlyPoints + .5cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.5cpoint_amt+" Reward Hourly Points due to playing for 5 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 6 hours consecutive
	else if(@consecutive_hour == 6) {
		set #HourlyPoints, #HourlyPoints + .6cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.6cpoint_amt+" Reward Hourly Points due to playing for 6 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 7 hours consecutive
	else if(@consecutive_hour == 7) {
		set #HourlyPoints, #HourlyPoints + .7cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.7cpoint_amt+" Reward Hourly Points due to playing for 7 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 8 hours consecutive
	else if(@consecutive_hour == 8) {
		set @consecutive_hour,0;
		set #HourlyPoints, #HourlyPoints + .8cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.8cpoint_amt+" Reward Hourly Points due to playing for 8 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
	@timer = gettimetick(2) + .duration;
	addtimer ( .duration * 1000 ), .npc_name$+"::OnUpdate";
	end;
       
    OnPCLoginEvent:
        atcommand "@refresh "+strcharinfo(0);
	@timer = gettimetick(2) + .duration;
	addtimer ( .duration * 1000 ), .npc_name$+"::OnUpdate";
	dispbottom "Hourly Rewards have been started for this character.";
	end;

    OnCheck:
        .@min = (@timer - gettimetick(2))/60;
        .@sec = (@timer - gettimetick(2))%60;
        dispbottom "War Server",0x9ae2d7;
        dispbottom "Total Hours Online " +@consecutive_hour+ "",0x9ae2d7;
        dispbottom "Reward Hourly Points : ^FF0000[ "+#HourlyPoints+" ]^000000",0x9ae2d7;
        dispbottom "[ Hourly Rewards ] Your next reward will be achieved in " +
                    ((.@min)?            "[ " + .@min + " ] minute"         + ((.@min > 1)?"s":""):"") +
                    ((.@min && .@sec)?    " and ":"") +
                    ((.@sec)?            "[ " + .@sec + " ] second"    + ((.@sec > 1)?"s":""):"") +
                    "!",0x9ae2d7;
        end;            
}

 

a bit more information about your question will be helpfull,

your script already having vending check

//Check for idle.
	while(checkvending() >= 1 || checkchatting() == 1 || checkidle() >= .idle) {
		if( .@mes$ == "" ) {
			dispbottom set( .@mes$, "The hourly points event stopped because you were vending, chatting, or idle!" );
		}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  746
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

13 minutes ago, Cyro said:

a bit more information about your question will be helpfull,

your script already having vending check


//Check for idle.
	while(checkvending() >= 1 || checkchatting() == 1 || checkidle() >= .idle) {
		if( .@mes$ == "" ) {
			dispbottom set( .@mes$, "The hourly points event stopped because you were vending, chatting, or idle!" );
		}

 

yes but even already vending / idle in 5mins the timer still not stop

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  8
  • Topics Per Day:  0.00
  • Content Count:  1137
  • Reputation:   290
  • Joined:  04/29/13
  • Last Seen:  

4 hours ago, Bringer said:

yes but even already vending / idle in 5mins the timer still not stop

Try changing check vending line to

if(checkvending() >= 1 || checkchatting() == 1) {
dispbottom "The hourly points event stopped because you were vending / chatting. Please relog if you wish to start again.";

Ill test this and update, atm using mobile 

Edited by Cyro
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  746
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

On 4/27/2017 at 11:57 AM, Cyro said:

Try changing check vending line to


if(checkvending() >= 1 || checkchatting() == 1) {
dispbottom "The hourly points event stopped because you were vending / chatting. Please relog if you wish to start again.";

Ill test this and update, atm using mobile 

still same

 

can you help me about this script?

@Skorm @Capuche

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2350
  • Joined:  10/28/11
  • Last Seen:  

You want the timer to stop when detected the player in chatroom or vending mode?

change


	//Check for idle.
	while(checkvending() >= 1 || checkchatting() == 1 || checkidle() >= .idle) {
		if( .@mes$ == "" ) {
			dispbottom set( .@mes$, "The hourly points event stopped because you were vending, chatting, or idle!" );
		}
		sleep2 .delay;
	}

into

	//Check for idle.
	if (checkvending() >= 1 || checkchatting() == 1 || checkidle() >= .idle) {
		dispbottom "The hourly points event stopped because you were vending, chatting, or idle!";
		end;
	}

Please be specific about what you actually wanted next time.

Your topic title are totally not helpful at all consider what you mentioned in the following posts.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  162
  • Topics Per Day:  0.04
  • Content Count:  746
  • Reputation:   47
  • Joined:  03/12/14
  • Last Seen:  

16 hours ago, Emistry said:

You want the timer to stop when detected the player in chatroom or vending mode?

change



	//Check for idle.
	while(checkvending() >= 1 || checkchatting() == 1 || checkidle() >= .idle) {
		if( .@mes$ == "" ) {
			dispbottom set( .@mes$, "The hourly points event stopped because you were vending, chatting, or idle!" );
		}
		sleep2 .delay;
	}

into


	//Check for idle.
	if (checkvending() >= 1 || checkchatting() == 1 || checkidle() >= .idle) {
		dispbottom "The hourly points event stopped because you were vending, chatting, or idle!";
		end;
	}

Please be specific about what you actually wanted next time.

Your topic title are totally not helpful at all consider what you mentioned in the following posts.

already change it  and my char already vending but still the timer not stop

 

Spoiler

-	script	hourly_point_main	-1,{
    
    OnInit:
        .duration = 3600;
	.vip_multi = 2;
        .npc_name$ = strnpcinfo(3);
	.delay   = 1000;       //Delay for idle re-check check. ( Default: 1000 [ = 1 Second ] )
	.idle    = 60*1;       //Player is idle after not moving for this many seconds. ( Default: 60*5 [ = 5 Minutes ] )
	set .2cpoint_amt, 20; //Points gained for consecutive time online.
	set .3cpoint_amt, 30; //Points gained for consecutive time online.
	set .4cpoint_amt, 40; //Points gained for consecutive time online.
	set .5cpoint_amt, 50; //Points gained for consecutive time online.
	set .6cpoint_amt, 60; //Points gained for consecutive time online.
	set .7cpoint_amt, 70; //Points gained for consecutive time online.
	set .8cpoint_amt, 80; //Points gained for consecutive time online.    
	set .point_amt, 10; //Normal points gained.
        bindatcmd "reward",    .npc_name$ + "::OnCheck";
        end;

    OnUpdate:
	//Check for idle.
	if (checkvending() >= 1 || checkchatting() == 1 || checkidle() >= .idle) {
		dispbottom "The hourly points event stopped because you were vending, chatting, or idle!";
		end;
	}
	set #HourlyPoints, #HourlyPoints + .point_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
	dispbottom "You received "+.point_amt+" Reward Hourly Points by staying ingame for 1 hour";
	dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	set @consecutive_hour, @consecutive_hour + 1;

	//Check for 2 hours consecutive
	if(@consecutive_hour == 2) {
		set #HourlyPoints, #HourlyPoints + .2cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.2cpoint_amt+" Reward Hourly Points due to playing for 2 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 3 hours consecutive
	else if(@consecutive_hour == 3) {
		set #HourlyPoints, #HourlyPoints + .3cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.3cpoint_amt+" Reward Hourly Points due to playing for 3 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 4 hours consecutive
	else if(@consecutive_hour == 4) {
		set #HourlyPoints, #HourlyPoints + .4cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.4cpoint_amt+" Reward Hourly Points due to playing for 4 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 5 hours consecutive
	else if(@consecutive_hour == 5) {
		set #HourlyPoints, #HourlyPoints + .5cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.5cpoint_amt+" Reward Hourly Points due to playing for 5 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 6 hours consecutive
	else if(@consecutive_hour == 6) {
		set #HourlyPoints, #HourlyPoints + .6cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.6cpoint_amt+" Reward Hourly Points due to playing for 6 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 7 hours consecutive
	else if(@consecutive_hour == 7) {
		set #HourlyPoints, #HourlyPoints + .7cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.7cpoint_amt+" Reward Hourly Points due to playing for 7 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
    
	//Check for 8 hours consecutive
	else if(@consecutive_hour == 8) {
		set @consecutive_hour,0;
		set #HourlyPoints, #HourlyPoints + .8cpoint_amt * 1 * ( vip_status(1) ? .vip_multi : 1 );
		dispbottom "You received "+.8cpoint_amt+" Reward Hourly Points due to playing for 8 consecutive hours";
		dispbottom "Current Balance = "+#HourlyPoints+" Reward Hourly Points";
	}
	@timer = gettimetick(2) + .duration;
	addtimer ( .duration * 1000 ), .npc_name$+"::OnUpdate";
	end;
       
    OnPCLoginEvent:
        atcommand "@refresh "+strcharinfo(0);
	@timer = gettimetick(2) + .duration;
	addtimer ( .duration * 1000 ), .npc_name$+"::OnUpdate";
	dispbottom "Hourly Rewards have been started for this character.";
	end;

    OnCheck:
        .@min = (@timer - gettimetick(2))/60;
        .@sec = (@timer - gettimetick(2))%60;
        dispbottom "War Server",0x9ae2d7;
        dispbottom "Total Hours Online " +@consecutive_hour+ "",0x9ae2d7;
        dispbottom "Reward Hourly Points : ^FF0000[ "+#HourlyPoints+" ]^000000",0x9ae2d7;
        dispbottom "[ Hourly Rewards ] Your next reward will be achieved in " +
                    ((.@min)?            "[ " + .@min + " ] minute"         + ((.@min > 1)?"s":""):"") +
                    ((.@min && .@sec)?    " and ":"") +
                    ((.@sec)?            "[ " + .@sec + " ] second"    + ((.@sec > 1)?"s":""):"") +
                    "!",0x9ae2d7;
        end;            
}

 

 

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10015
  • Reputation:   2350
  • Joined:  10/28/11
  • Last Seen:  

In fact the script has already stopped giving out the hourly point when the script detected the char vending/afk/chatting.

the displaying information are kinda misleading since it doesn't cater the state of char when they are vending or afk.

https://pastebin.com/5g1XV4q0

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...