[ Req ] Npc Reward Player online

lol

if( ( checkvending() == 2 && !.autotrade ) // Autotrade && ( checkidle() && !.idle ) // Idle && ( checkchatting() && !.chat ) // Chat ) sleep2 1000; set lrs_passed, lrs_passed+1; set lrs_passed_total, lrs_passed_total+lrs_passed;where is the else statement ?this script means ... if the user is vending/idle/chatroom, the script will just delay execute by 1 sec ..

but still continue to count the variables below

the whole things below needs to be inside else { }

 
Last edited by a moderator:
lol

if( ( checkvending() == 2 && !.autotrade ) // Autotrade && ( checkidle() && !.idle ) // Idle && ( checkchatting() && !.chat ) // Chat ) sleep2 1000; set lrs_passed, lrs_passed+1; set lrs_passed_total, lrs_passed_total+lrs_passed;where is the else statement ?this script means ... if the user is vending/idle/chatroom, the script will just delay execute by 1 sec ..

but still continue to count the variables below

the whole things below needs to be inside else { }
Whoops, small mistake lolhttp://pastebin.com/QaGfva8H

 
Hello everyone,

Based on Annie's notice

AnnieRuru, on 02 Feb 2014 - 11:32, said:

try not to use attachnpctimer unnecessary
attachnpctimer I only use them in 1 scenario
which use in botkiller script to kick players which doesn't answer in a certain time period
means, only use in a npc dialog script

because if this script already uses attachnpctimer,
if there is other script use attachnpctimer again, the timer wouldn't run anymore

for this kind of script, I rather use sleep2
http://rathena.org/board/topic/90989-hourly-points-help/?p=238289
Consequently, I tried to re-write a script I'm using so it doesn't use the "attachtimer" function but the "sleep" function instead.
Unfortunately it seems It's not as simple as putting "B" instead of "A"
My original script

- script hourlypoints -1,{

OnPCLoginEvent:
announce "You are now listed on the Hourly Reward System.",bc_self;
announce "Remain active for a continuous hour to be rewarded",bc_self;
announce "Being idle for 5 minutes disables your timer.",bc_self;
attachnpctimer ""+strcharinfo(0)+"";
initnpctimer;
end;

OnTimer300000: // Check players status every 5 minutes
if( checkvending() || 4 < checkidle() || strcharinfo(3) == "sec_pri" )
{
announce "Your reward has been disabled because you were idle/Vending/Jailed.",bc_self;
announce "Re-log if you want to initiate your timer.",bc_self;
stopnpctimer;
end;
}
end;


OnTimer3600000:
set @minute, @minute + 1; //Check every 1 Minute
if(@minute == 60)
{
//Check if Vending (normal or @at)
if(checkvending() >= 1)
{
announce "Your reward has been disabled because you were vending. Please re-log if you wish to start again.",bc_self;
stopnpctimer;
end;
}
else
{
set @minute,0;
set .@point_amt, 1; //Points to get every hour (default: 1)
getitem 671,.@point_amt;
announce "You received "+.@point_amt+" for being active for a continuous hour.",bc_self;
set @consecutive_hour, @consecutive_hour + 1;
}
}

//Check for 12 hours consecutive
if(@consecutive_hour == 12)
{
//Check if Vending (normal or @at)
if(checkvending() >= 1 || checkchatting() == 1)
{
announce
"Your reward has been disabled because you were idle. Please re-log if you wish to start again.",bc_self;
stopnpctimer;
end;
}
else
{
set @consecutive_hour,0;
set .@cpoint_amt, 10; //Points to get for 12 Consecutive hours (default: 10)
getitem 671,.@cpoint_amt;
announce "You received extra "+.@cpoint_amt+" for being active for 12 consecutive hours. Keep it up !",bc_self;
}
}
stopnpctimer;
initnpctimer;
end;
}
Can anyone help with the edits, please ?

Thanks
default_smile.png


 
Last edited by a moderator:
... now I don't encourage this script ...

promotes players to play more than 5 hours continuously ...

promotes bad gaming habit ...

anyways

http://upaste.me/54511096937d17482

I hope you know what is math

 
Last edited by a moderator:
Thanks Annie.

Just a question tho, I can't see the jail check (anyone jailed shouldn't get rewarded); in your script. Should i use something like strcharinfo(3) == "sec_pri" as it was scripted in the original file ?

 
Hello again
default_smile.png


Testing your script Annie, I have come into this weird behaviour.

Testing settings:

.sleeploop = 5000; // every 5 seconds

   .tick = 6; // loop 6 times of 5 seconds == 30 seconds

   .afk = 60; // default value : 2 = loop 2 times of 5 seconds (10 seconds) // value 60 = 300 seconds/5 minutes

   end;
Testing procedure:

With a timer by my side, I'm being active for 30 seconds (moving around) and it works great; I m getting rewarded after 30 seconds.

The tick system is working good until after "being active" for 15 seconds I intentionally logged off and in again:

Moving around again, I'm then getting rewarded more than I should since I got rewarded 3 times within 30 seconds...

Am I wrong to think that the previous activity somehow stacked its rewards with the rewards of the new session (when I re-logged) ?

Not sure my question was understandable, sorry about that if it's not.

Anyways, can you confirm (or make sure) in case someone who has been tagged as idle/@at/Jailed, gets his timer back to zero.

For instance; if someone plays for  54 minutes but is AFK for 5 minutes; then  his timer goes back to zero and that person will have to play another full hour (60 minutes) in order to get his reward.

(using this example, I feel like your script does like this : I play 54 minutes and afk 5/10/15/XXX minutes...When I m active again I only have to play 6 minutes to get the reward.)

Thanks Annie and don't hesitate to let me know if my explanations were a bit too obscur, hehe.

 
Last edited by a moderator:
your explanation is much better than someone that I don't want to mention, so no worry

1.

Am I wrong to think that the previous activity somehow stacked its rewards with the rewards of the new session (when I re-logged) ?
if you relog, the counting will start from 0 instead of from the previous sessionso let say if the player has been walking around for 4 minutes, and then disconnected

actually just 1 more minute, he will gain the reward

but my script, if he is disconnected, he has to move around for 5 minutes again (instead of just 1 minute more) to gain the prize

so ...

if relog, the counter starts back to 0

2. 

Anyways, can you confirm (or make sure) in case someone who has been tagged as idle/@at/Jailed, gets his timer back to zero.
my script, the variable is set with .@scope variableif the player has been jailed, the script will hits the end; command

means, the counter will turn into 0 when jailed, and have to relog to start again

3.

For instance; if someone plays for  54 minutes but is AFK for 5 minutes; then  his timer goes back to zero and that person will have to play another full hour (60 minutes) in order to get his reward.
yeah ... I didn't know what is the behavior you want, so I do it that way
if you don't like it, just comment this line

Code:
			if ( .@afk >= .afk && ( .@afk % .afk == 0 ) ) {				dispbottom "you have afk for "+( .@afk * .sleeploop / 1000 )+" seconds";//				.@tick = 0; // <-- comment this line so the .@tick counter remains, not reset			}
 
Alright Annie, thanks for keeping in touch and updated with something you created, very appreciated.

 
Back
Top