Angela 0 Posted July 3, 2016 Hello guys, i cant make this script work. it suppost that if you are afk with the homun for 2 minutes it uses vaporize to avoid farm - script vaporize -1,{ OnPCLoginEvent: addtimer 60000,strnpcinfo(0)+"::On1min"; end; On1min: dispbottom "Been a minute "+strcharinfo(0); atcommand "@useskill 244 1 "+strcharinfo(0); getmapxy(.@m,.@x,.@y,0); if(.@x == x && .@y == y){ set afk, afk + 1; if(gethominfo(2) != "null"){ if(afk >= $antiafk) { atcommand "@useskill 244 1 "+strcharinfo(0); dispbottom "You are not allowed to farm with Homun while AFK."; addtimer 60000,strnpcinfo(0)+"::On1min"; end; } else { set afk, 0; addtimer 60000,strnpcinfo(0)+"::On1min"; end; } addtimer 60000,strnpcinfo(0)+"::On1min"; end; } } set x, .@x; set y, .@y; addtimer 60000,strnpcinfo(0)+"::On1min"; end; OnInit: set $antiafk, 2;// how many minutes to use vaporize end; } Quote Share this post Link to post Share on other sites
0 Mumbles 193 Posted October 7, 2016 Here's an updated version without global variables and a simplified flow: - script vaporize -1,{ OnPCLoginEvent: // Set AFK check on login addtimer 60000, strnpcinfo(0) + "::On1min"; end; On1min: // Check if player has Homunculus and if AFK longer than allowed if(gethominfo(2) != "null" && checkidle() >= .vaporize) { atcommand "@useskill 244 1 " + strcharinfo(0); dispbottom "You are not allowed to farm with Homunculus while AFK."; } // Reset AFK check addtimer 60000, strnpcinfo(0) + "::On1min"; end; OnInit: // Time (in seconds) before vaporizing .vaporize = 120; end; } Quote Share this post Link to post Share on other sites
0 evilpuncker 504 Posted July 3, 2016 by the way here in hercules we have the "checkidle" script command that would be as useful as checking with getmapxy Quote Share this post Link to post Share on other sites
0 Angela 0 Posted July 4, 2016 by the way here in hercules we have the "checkidle" script command that would be as useful as checking with getmapxy oh i didnt know sir, how can i use it on this script? Quote Share this post Link to post Share on other sites
0 Alayne 99 Posted July 12, 2016 Can't test it right now, but this should do the job - script vaporize -1,{ OnPCLoginEvent: addtimer 60000,strnpcinfo(0)+"::On1min"; end; On1min: if(gethominfo(2) != "null"){ if(getidle() >= $antiafk) { atcommand "@useskill 244 1 "+strcharinfo(0); dispbottom "You are not allowed to farm with Homun while AFK."; addtimer 60000,strnpcinfo(0)+"::On1min"; } } addtimer 60000,strnpcinfo(0)+"::On1min"; end; OnInit: set $antiafk, 120;// how many seconds to use vaporize end; } Quote Share this post Link to post Share on other sites
0 timo0o 0 Posted September 10, 2016 Can't test it right now, but this should do the job - script vaporize -1,{ OnPCLoginEvent: addtimer 60000,strnpcinfo(0)+"::On1min"; end; On1min: if(gethominfo(2) != "null"){ if(getidle() >= $antiafk) { atcommand "@useskill 244 1 "+strcharinfo(0); dispbottom "You are not allowed to farm with Homun while AFK."; addtimer 60000,strnpcinfo(0)+"::On1min"; } } addtimer 60000,strnpcinfo(0)+"::On1min"; end; OnInit: set $antiafk, 120;// how many seconds to use vaporize end; } Need this script,too. But your script give this error: [ERROR]: npc_parsesrcfile: Unknown syntax in file 'antiafk.txt', line '1'. Stopping... * w1=- script vaporize -1,{ * w2= * w3= * w4= Quote Share this post Link to post Share on other sites
0 Alayne 99 Posted September 12, 2016 Generally, this error is due to space used instead of tabs. Type "-<tab>script<tab>vaporize<tab>-1,{" Quote Share this post Link to post Share on other sites
0 timo0o 0 Posted September 14, 2016 Generally, this error is due to space used instead of tabs. Type "-<tab>script<tab>vaporize<tab>-1,{" OK. Now it says scirpt error in file 'afk.txt' line 9 column 13 parse_simpleexpr: unmatched ')' ... ... 9: if(getidle() >=$antiakf) { ... ... ... Quote Share this post Link to post Share on other sites
0 Alayne 99 Posted September 16, 2016 Change getidle() by checkidle("playername"). Quote Share this post Link to post Share on other sites
Share this post
Link to post
Share on other sites