Jump to content
  • 0
Angela

AFK Homunculus

Question

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;

}

 

Share this post


Link to post
Share on other sites

8 answers to this question

Recommended Posts

  • 0

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;
}

Share this post


Link to post
Share on other sites
  • 0

by the way here in hercules we have the "checkidle" script command that would be as useful as checking with getmapxy

Share this post


Link to post
Share on other sites
  • 0

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?

Share this post


Link to post
Share on other sites
  • 0

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;
}

 

 

 

Share this post


Link to post
Share on other sites
  • 0

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=

Share this post


Link to post
Share on other sites
  • 0

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

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.