Yugosh 0 Posted January 21, 2014 master can i req script / npc player online? ex. player online 1 or 2 hours get this item. but player online more than 6 hour get this item. a different reward thanks sory my bad english Quote Share this post Link to post Share on other sites
0 pan 87 Posted January 21, 2014 (edited) Has been awhile since I wrote my last script but here it is: http://pastebin.com/DimazGWd Haven't tested it though, if any error pops up, just post here and I'll fix it. Edited January 21, 2014 by pan 2 Yugosh and Hadeszeus reacted to this Quote Share this post Link to post Share on other sites
0 Hadeszeus 15 Posted January 22, 2014 Has been awhile since I wrote my last script but here it is: http://pastebin.com/DimazGWd Haven't tested it though, if any error pops up, just post here and I'll fix it. Hi Pan, just want to ask if the reward will go directly to players inventory? or I still need to create NPC to call the script you made. Quote Share this post Link to post Share on other sites
0 pan 87 Posted January 22, 2014 It will go directly. getitem .item_reward[lrs_prize], .item_reward_qt[lrs_prize];Any errors just post c: Quote Share this post Link to post Share on other sites
0 Hadeszeus 15 Posted January 22, 2014 (edited) Thanks. Can you explain this set .time_lapse,60*60*2; how it works. Sorry I can't test right now, will test later. +1 Edited January 22, 2014 by Hadeszeus Quote Share this post Link to post Share on other sites
0 pan 87 Posted January 22, 2014 It's fairly simple, this variable is measured in seconds, so 60 would be a minute. 60 -> A minute60*60 -> A minute*60 -> A hour60*60*2 -> 2 hours Quote Share this post Link to post Share on other sites
0 Hadeszeus 15 Posted January 22, 2014 If I want the time to something like every 1hour, 3hours, 5hours, 10hours and more. How am I going to write it? Quote Share this post Link to post Share on other sites
0 pan 87 Posted January 22, 2014 (edited) Here it is: http://pastebin.com/3RmAGytY Just change .time_lapse[0], it works exactly the same as before. setarray .time_lapse[0],FIRST ID TIME LAPSE,SECOND ID TIME LAPSE,0;If you have four prizes but only one time_lapse set there's no problem, the time lapse for all prizes will be the same. As usual I haven't tested, any errors just post c: EDIT: Don't forget that every time a time_lapse is met the time is set to zero. setarray .time_lapse[0],60*60*2,60*60*3,0;A player will only win the second prize (.item_reward[1]) if he stays logged for 5 hours. EDIT2: New version with new config options: // Account idle players? 1 - true; 0 - falseset .idle,1;// Account players using autotrade? 1 - true; 0 - falseset .autotrade,1;// Account players that are in chats? 1 - true; 0 - falseset .chat, 1;Set to false if you want that those players don't receive any prize.http://pastebin.com/QaGfva8H Edited February 2, 2014 by pan Quote Share this post Link to post Share on other sites
0 Hadeszeus 15 Posted January 22, 2014 Here it is: http://pastebin.com/3RmAGytY Just change .time_lapse[0], it works exactly the same as before. setarray .time_lapse[0],FIRST ID TIME LAPSE,SECOND ID TIME LAPSE,0;If you have four prizes but only one time_lapse set there's no problem, the time lapse for all prizes will be the same. As usual I haven't tested, any errors just post c: EDIT: Don't forget that every time a time_lapse is met the time is set to zero. setarray .time_lapse[0],60*60*2,60*60*3,0;A player will only win the second prize (.item_reward[1]) if he stays logged for 5 hours. Thank you again! I'll test it later and give you feedback.. Quote Share this post Link to post Share on other sites
0 Hadeszeus 15 Posted January 22, 2014 (edited) Sir thank you its working now.. I'll let you know if I find anything unusual. Sir One more thing. Can you please create one timelapse for 1 minute and 3 minutes (for testing purposes only i dont want to w8 an hour or 2 just for testing it)? Im so confused on how to set the time lapse for 1 and 3 minutes. setarray .time_lapse[0],60*60*2,60*60*3,0; Edited January 22, 2014 by Hadeszeus Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted January 22, 2014 If I'm not mistaken: 1 minute = 1, and so on for the rest of minutes. 1 Hadeszeus reacted to this Quote Share this post Link to post Share on other sites
0 pan 87 Posted January 22, 2014 If I'm not mistaken: 1 minute = 1, and so on for the rest of minutes. You are absolutely right c: Sir thank you its working now.. I'll let you know if I find anything unusual. Sir One more thing. Can you please create one timelapse for 1 minute and 3 minutes (for testing purposes only i dont want to w8 an hour or 2 just for testing it)? Im so confused on how to set the time lapse for 1 and 3 minutes. setarray .time_lapse[0],60*60*2,60*60*3,0; For 1 minute for first prize and 3 for the second:setarray .time_lapse, 1, 2, 0;Remember that after the first time_lapse condition is met the timer resets. So even if the second lapse (.time_lapse[1]) looks like just 2 minutes it's actually 3..time_lapse[0]+.time_lapse[1] = REAL time lapse [1] 1 Hadeszeus reacted to this Quote Share this post Link to post Share on other sites
0 Hadeszeus 15 Posted January 23, 2014 If I'm not mistaken: 1 minute = 1, and so on for the rest of minutes. You are absolutely right c: >Sir thank you its working now.. I'll let you know if I find anything unusual. Sir One more thing. Can you please create one timelapse for 1 minute and 3 minutes (for testing purposes only i dont want to w8 an hour or 2 just for testing it)? Im so confused on how to set the time lapse for 1 and 3 minutes. setarray .time_lapse[0],60*60*2,60*60*3,0; For 1 minute for first prize and 3 for the second:setarray .time_lapse, 1, 2, 0;Remember that after the first time_lapse condition is met the timer resets. So even if the second lapse (.time_lapse[1]) looks like just 2 minutes it's actually 3..time_lapse[0]+.time_lapse[1] = REAL time lapse [1] got it! Thank you so much! Quote Share this post Link to post Share on other sites
0 PcNy 1 Posted February 1, 2014 Do players with @at get rewards too? Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted February 1, 2014 It seems yes. Why? Quote Share this post Link to post Share on other sites
0 PcNy 1 Posted February 2, 2014 (edited) Well how can I make the reward goes to online players only, excluding @at. Since they may spam merchants and @at to get rewards. And can I make reward totally unable to change the owner including dropping, trading and vending. Edited February 2, 2014 by PcNy Quote Share this post Link to post Share on other sites
0 jaBote 438 Posted February 2, 2014 You can modify the behavior of the script by using checkvending() or checkidle() if you want not to reward idle players. See how they work here: doc/script_commands.txt#L3797 *checkvending({"<Player Name>"}) *checkchatting({"<Player Name>"}) Checks if the player is vending or in a chatroom. Name is optional, and defaults to the attached player if omitted. Return values for 'checkvending' are 0 = not vending 1 = normal vending 2 = vending using @autotrade 'checkchatting' returns 1 if they are in a chat room, 0 if they are not. Examples: //This will check if Aaron is vending, and if so, put a message in //front of the attached player saying Aaron is vending. if (checkvending("Aaron")) mes "Aaron is currently vending!"; //This will check if the attached player in a chat room or not. if (checkchatting()) mes "You are currently in a chat room!"; --------------------------------------- *checkidle({"<Player Name>"}) Returns the time, in seconds, that the specified player has been idle. Name is optional, and defaults to the attached player if omitted. 1 pan reacted to this Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted February 2, 2014 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 1 pan reacted to this Quote Share this post Link to post Share on other sites
0 pan 87 Posted February 2, 2014 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 Thank you, I wasn't aware of that. Well how can I make the reward goes to online players only, excluding @at. Since they may spam merchants and @at to get rewards. And can I make reward totally unable to change the owner including dropping, trading and vending. I added new configurations:// Account idle players? 1 - true; 0 - falseset .idle,1;// Account players using autotrade? 1 - true; 0 - falseset .autotrade,1;// Account players that are in chats? 1 - true; 0 - falseset .chat, 1;Set to false if you want that those players don't receive any prize.http://pastebin.com/aJV6beP8 Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted February 2, 2014 (edited) 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 { } Edited February 2, 2014 by AnnieRuru Quote Share this post Link to post Share on other sites
0 pan 87 Posted February 2, 2014 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 2 PcNy and Hadeszeus reacted to this Quote Share this post Link to post Share on other sites
0 Adam 3 Posted March 4, 2014 (edited) Hello everyone,Based on Annie's notice AnnieRuru, on 02 Feb 2014 - 11:32, said: try not to use attachnpctimer unnecessaryattachnpctimer I only use them in 1 scenariowhich use in botkiller script to kick players which doesn't answer in a certain time periodmeans, only use in a npc dialog scriptbecause if this script already uses attachnpctimer,if there is other script use attachnpctimer again, the timer wouldn't run anymorefor this kind of script, I rather use sleep2http://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 minutesif( 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 Minuteif(@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 consecutiveif(@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 Edited March 4, 2014 by Adam Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted March 5, 2014 ... 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 Quote Share this post Link to post Share on other sites
0 Adam 3 Posted March 5, 2014 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 ? Quote Share this post Link to post Share on other sites
0 AnnieRuru 957 Posted March 5, 2014 oh edited http://upaste.me/54511096937d17482 players being jailed has SC_JAILED status, so no need to use sec_pri 1 Adam reacted to this Quote Share this post Link to post Share on other sites
master can i req script / npc player online?
ex. player online 1 or 2 hours get this item.
but player online more than 6 hour get this item.
a different reward thanks
sory my bad english
Share this post
Link to post
Share on other sites