Jump to content
  • 0

Need Help on selfmade Autoattack script "player's event queue is full"


Question

Posted

Hello everyone, i have made a BOT Script for my server to assist players for farming. but im having "[Warning] npc_event: player's event queue is full" warning on my console when it runs after a few minutes
i already tried increasing MAX_EVENTQUEUE to 100 and recompile but same problem is showing. 

can i get a help to optimize my script, i will release it to the community once it is done. this script uses an item that calls this function.

function	script	F_botex	{
set .@i,0;
while (@i < 1) {
OnUna:
	set @b,0;
    dispbottom ""+@i+"";
	@rid = getcharid(3);
	getmapxy(.@m$,.@x,.@y,0);
	sleep2 100;
	@x1 = rand(-13,13);
	@y1 = rand(-13,13);
	@x = @x1+.@x;
	@y = @y1+.@y;
	sleep2 100;
	if(!checkcell( .@m$,@x,@y,cell_chkpass )){
		dispbottom "Coordinate not exists!";
		goto OnUna;
	} else if(checkcell( .@m$,@x,@y,cell_chkpass )){
		dispbottom "Coordinate exists!";
	}
	sleep2 100;
OnTwo:
	set @b,@b+1;
	viewpoint 1,@x,@y,1,0xFF0000;
		dispbottom "auto walking to x = "+@x+" y = "+@y;
		unitwalk getcharid(3),@x,@y,strnpcinfo(3)+"::OnReach";
		sleep2 2000;
		if(@b > 5) goto OnUna;
		getmapxy(.@m$,.@x,.@y,0);
		if(@x != .@x && @y != .@y) goto OnTwo;
		sleep2 100;
OnThree:
	unitskilluseid @rid,"WL_JACKFROST",5,@rid,-4;
	percentheal 100,100;
	sleep2 100;
	dispbottom "JackJack";
	}
}

4 answers to this question

Recommended Posts

  • 0
Posted

I don't know, since I don't really see events here (maybe the gotos can be considered? I doubt).

Anyways, I did a bit of optimization:

function	script	F_botex	{
	set .@i,0;
	while (.@i < 1) {
		set .@b,0;
		dispbottom .@i+"";
		.@rid = getcharid(3);
		getmapxy(.@m$,.@x0,.@y0,0);
		sleep2 100;
		.@x = rand(-13,13)+.@x0;
		.@y = rand(-13,13)+.@y0;
		sleep2 100;
		if(!checkcell( .@m$,.@x,.@y,cell_chkpass )){
			dispbottom "Coordinate not exists!";
			continue;
		} else if(checkcell( .@m$,.@x,.@y,cell_chkpass )){
			dispbottom "Coordinate exists!";
		}
		sleep2 100;
		while(.@x0 != .@x && .@y0 != .@y) {
			set .@b,.@b+1;
			viewpoint 1,.@x,.@y,1,0xFF0000;
			dispbottom "auto walking to x = "+.@x+" y = "+.@y;
			unitwalk getcharid(3),.@x,.@y,strnpcinfo(3)+"::OnReach";
			sleep2 2000;
			if(.@b > 5) break;
			getmapxy(.@m$,.@x0,.@y0,0);
			sleep2 100;
		}
		unitskilluseid .@rid,"WL_JACKFROST",5,.@rid,-4;
		percentheal 100,100;
		sleep2 100;
		dispbottom "JackJack";
	}
	end;
}

 

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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...