Jump to content
  • 0

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


Lord Turtle

Question


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   7
  • Joined:  04/13/12
  • Last Seen:  

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";
	}
}
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  303
  • Reputation:   117
  • Joined:  12/10/16
  • Last Seen:  

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

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

@tribal0306 how to stop this function?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  51
  • Reputation:   7
  • Joined:  04/13/12
  • Last Seen:  

On 11/22/2018 at 4:10 PM, melv0 said:

@tribal0306 how to stop this function?

@set .@i 1

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  107
  • Topics Per Day:  0.02
  • Content Count:  770
  • Reputation:   69
  • Joined:  02/10/12
  • Last Seen:  

7 hours ago, tribal0306 said:

@set .@i 1

it's great script and ideas ?
its possible to change autoskill to autoattack random mob?

Link to comment
Share on other sites

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.

×
×
  • Create New...