Group: Members
Posts: 82
Joined: 29-February 08
Member No.: 576,597
hey guys, im sick of scar scripting to be honest. I decided to post an advanced fighting bot here. Do with it what you can! It still needs alot of work.
CODE
program auto_fighter;
var x, y, monster_x, monster_y, player_x, player_y, r, i, count: integer;
const waypoint = 772351;
function player : boolean; begin if(FindColor(player_x, player_y, 255, 50, 46, 972, 582))then result:= true end;
function target_in_range : boolean; begin if(player)then begin if(FindColorCircle(monster_x, monster_y, 4609124, x, y, r) or FindColorCircle(monster_x, monster_y, 12905468, x, y, r))then begin if(player_y < 580)then result:= true end; end; end;
function monster : boolean; begin if(FindColor(monster_x, monster_y, 4609124, 50, 46, 972, 582) or FindColor(monster_x, monster_y, 12905468, 50, 46, 972, 582))then result:= true end;
function in_combat : boolean; begin if(FindColor(x, y, 255, 50, 46, 972, 582))then result:= true end;
function movement_allowed : boolean; begin if(FindColorTolerance(x, y, 26108, x-10, y-10, x+10, y+10, 15))then result:= true end;
function target_north : boolean; begin if(monster_x = player_x) and (monster_y < player_y)then result:= true; end;
function target_northeast : boolean; begin if(monster_x > player_x) and (monster_y < player_y)then result:= true; end;
function target_east : boolean; begin if(monster_x > player_x) and (monster_y = player_y)then result:= true; end;
function target_southeast : boolean; begin if(monster_x > player_x) and (monster_y > player_y)then result:= true; end;
function target_south : boolean; begin if(monster_x = player_x) and (monster_y > player_y)then result:= true; end;
function target_southwest : boolean; begin if(monster_x < player_x) and (monster_y > player_y)then result:= true; end;
function target_west : boolean; begin if(monster_x < player_x) and (monster_y = player_y)then result:= true; end;
function target_northwest : boolean; begin if(monster_x < player_x) and (monster_y < player_y)then result:= true; end;
function top_wp : boolean; begin if(FindColor(x, y, waypoint, 0, 0, 1024, 66))then result:= true end;
function right_wp : boolean; begin if(FindColor(x, y, waypoint, 940, 0, 1024, 768))then result:= true end;
function left_wp : boolean; begin if(FindColor(x, y, waypoint, 0, 0, 92, 768))then result:= true end;
function bottom_wp : boolean; begin if(FindColor(x, y, waypoint, 0, 564, 1024, 768 ))then result:= true end;
function switching_map : boolean; begin if(FindColor(x, y, 0, 419, 165, 420, 166)and FindColor(x, y, 0, 635, 470, 636, 471))then result:= true end;
function error : boolean; begin if(count > 3000)then result:= true end;
procedure click; begin count:= 0; MoveMouseSmooth(x, y); Wait(100+random(200)); HoldMouse(x, y, true); Wait(20+random(50)); ReleaseMouse(x, y, true); repeat wait(1); count:= count + 1; until(switching_map) or (error) repeat wait(1); until(not(switching_map)) end;
procedure move_top; begin if(top_wp)then begin click; i:= 1; if(error)then begin i:= 0; end; end; end;
procedure move_right; begin if(right_wp)then begin click; i:= 2; if(error)then begin i:= 0; end; end; end;
procedure move_left; begin if(left_wp)then begin click; i:= 3; if(error)then begin i:= 0; end; end; end;
procedure move_bottom; begin if(bottom_wp)then begin click; i:= 4; if(error)then begin i:= 0; end; end; end;
procedure search; begin case(Random(4))of 0: begin if(not(right_wp or left_wp or bottom_wp))then begin Move_top; end else begin if(i = 4)then begin end else begin Move_top; end; end; end; 1: begin if(not(top_wp or left_wp or bottom_wp))then begin move_right; end else begin if(i = 3)then begin end else begin move_right; end; end; end; 2: begin if(not(top_wp or right_wp or bottom_wp))then begin move_left; end else begin if(i = 2)then begin end else begin move_left; end; end; end; 3: begin if(not(top_wp or right_wp or left_wp))then begin move_bottom; end else begin if(i = 1)then begin end else begin move_bottom; end; end; end; end; end;
procedure move_northwest; begin if(player)then begin MoveMouseSmooth(player_x - 90, player_y - 40); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x - 23, player_y - 40); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x - 90, player_y); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x + 43, player_y - 40); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x - 90, player_y + 31); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end; end; end; end; end; end; end;
procedure move_west; begin if(player)then begin MoveMouseSmooth(player_x - 90, player_y); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x - 90, player_y + 31); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x - 90, player_y - 40); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x - 90, player_y + 65); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin move_northwest; end; end; end; end; end; end;
procedure move_southwest; begin if(player)then begin MoveMouseSmooth(player_x - 90, player_y + 65); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x - 90, player_y + 31); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x - 25, player_y + 65); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x - 90, player_y); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x + 39, player_y + 65); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin move_west; end; end; end; end; end; end; end;
procedure move_south; begin if(player)then begin MoveMouseSmooth(player_x - 25, player_y + 65); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x + 39, player_y + 65); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x - 90, player_y + 65); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x + 108, player_y + 65); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin move_southwest; end; end; end; end; end; end;
procedure move_southeast; begin if(player)then begin MoveMouseSmooth(player_x + 108, player_y + 65); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x + 39, player_y + 65); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x + 108, player_y + 31); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x + 108, player_y); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x - 25, player_y + 65); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin move_south; end; end; end; end; end; end; end;
procedure move_east; begin if(player)then begin MoveMouseSmooth(player_x + 108, player_y + 31); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x + 108, player_y); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x + 108, player_y - 40); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x + 108, player_y + 65); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin move_southeast; end; end; end; end; end; end;
procedure move_northeast; begin if(player)then begin MoveMouseSmooth(player_x + 108, player_y - 40); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x - 108, player_y); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x + 43, player_y - 40); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x - 23, player_y - 40); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x + 108, player_y + 31); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin move_east; end; end; end; end; end; end; end;
procedure move_north; begin if(player)then begin MoveMouseSmooth(player_x + 43, player_y - 40); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x - 23, player_y - 40); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x - 90, player_y - 40); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin MoveMouseSmooth(player_x + 108, player_y - 40); Wait(200); GetMousePos(x, y); if(movement_allowed)then begin ClickMouse(x, y, true); end else begin move_northeast; end; end; end; end; end; end;
procedure position_player; begin if(monster and player)then begin if(target_north)then begin move_north; end else begin if(target_northeast)then begin move_northeast; end else begin if(target_east)then begin move_east; end else begin if(target_southeast)then begin move_southeast; end else begin if(target_south)then begin move_south; end else begin if(target_southwest)then begin move_southwest; end else begin if(target_west)then begin move_west; end else begin if(target_northwest)then begin move_northwest; end; end; end; end; end; end; end; end; end; end;
function players_turn : boolean; begin if(FindColor(x, y, 26367, 589, 614, 591, 616))then result:= true end;
function fight_started : boolean; begin if(FindCOlor(x, y, 11063255, 359, 102, 361, 104))then result:= true end;
function out_of_range : boolean; begin if(r > 225)then result:= true end;
procedure close_summary; begin Wait(1000); if(FindColorTolerance(x, y, 25087, 752, 439, 800, 522, 15))then begin MoveMouseSmooth(x, y+12); Wait(100+random(200)); HoldMouse(x, y+12, true); Wait(20+random(50)); ReleaseMouse(x, y+12, true); end; end;
procedure fight; begin repeat Wait(1); until(players_turn) or (not(in_combat)) or (error) r:= 0; repeat r:= r + 35; until(target_in_range) or (out_of_range) or (not(in_combat)) or (error) if(target_in_range)then begin cast_sequence; end else begin r:= 0; position_player; repeat r:= r + 15; until(target_in_range) or (out_of_range) or (not(in_combat)) or (error) if(target_in_range)then begin cast_sequence; end else begin pass_turn; end; end; end;
begin repeat count:= 0; if(monster)then begin start_fight; fight_preperation; repeat fight; repeat wait(1); until(players_turn) or (not(in_combat)) or (error) until(not(in_combat)) or (error) close_summary; end else begin search; Wait(1000); end; until(false); end.
Group: Elite Members
Posts: 318
Joined: 22-June 09
From: Deep in my Coding Cave. But don't feel bad! After all, it's on the darkside, and we have cookies!
Member No.: 934,937
Wow, you write great scripts, it just seems unorganized to me, hard to read through and figure out... either way. I think I could effectively duplicate a copy of your iron mining bot, but I gave up on my agi cra i made for the bot... It wouldn't take to long to make a "universal" copy but it'd take a hella bit of time. If you really read much, I'm not one for making the finished product but rather, making the components.
--------------------
SCAR Coder
DofusBaseV1 [||||||||||]
Want to make progress bars like me?
CODE
use this base one as an example! [[color="#00FF00"]|[/color][color="#FF0000"]|||||||||[/color]]
Group: Elite Members
Posts: 318
Joined: 22-June 09
From: Deep in my Coding Cave. But don't feel bad! After all, it's on the darkside, and we have cookies!
Member No.: 934,937
QUOTE(ltjustas1 @ Sep 25 2009, 02:25 AM)
nice. can i ask you something? how long did it took you to writte it?
I'd range in on 2 weeks to a month since he didn't use functions/procedures to simplify some of the long texty areas. i'd say that with 1 week added for planning.
--------------------
SCAR Coder
DofusBaseV1 [||||||||||]
Want to make progress bars like me?
CODE
use this base one as an example! [[color="#00FF00"]|[/color][color="#FF0000"]|||||||||[/color]]
Group: Elite Members
Posts: 318
Joined: 22-June 09
From: Deep in my Coding Cave. But don't feel bad! After all, it's on the darkside, and we have cookies!
Member No.: 934,937
lol, many many scripts bigger, better, and more top notch than his are released and in the elite section. sure, he codes really good codes designed to work well, but only for him, all the codes after him are community-based and aimed at wide-range-use and can pull off alot of his features!
--------------------
SCAR Coder
DofusBaseV1 [||||||||||]
Want to make progress bars like me?
CODE
use this base one as an example! [[color="#00FF00"]|[/color][color="#FF0000"]|||||||||[/color]]
Group: Members
Posts: 2
Joined: 19-November 09
Member No.: 1,047,799
QUOTE(lilwitte @ Nov 19 2009, 08:07 PM)
lol, many many scripts bigger, better, and more top notch than his are released and in the elite section. sure, he codes really good codes designed to work well, but only for him, all the codes after him are community-based and aimed at wide-range-use and can pull off alot of his features!
Well well i just think about to Pay for a premium, but i have a question have any Dupe Itens on Members?
And one more question whit the dofus 2.0 what happining on for the Hacks, Scripts, etc?
Group: Elite Members
Posts: 318
Joined: 22-June 09
From: Deep in my Coding Cave. But don't feel bad! After all, it's on the darkside, and we have cookies!
Member No.: 934,937
In Dofus 2.0 we are updating most if not all of the scripts we have in elite to work with the new release... I plan on moving the next release of my DofusBase Include to a week after Dofus 2.0 comes out and then maybe... I will be releasing the Dofus 2.0 version in Elite
--------------------
SCAR Coder
DofusBaseV1 [||||||||||]
Want to make progress bars like me?
CODE
use this base one as an example! [[color="#00FF00"]|[/color][color="#FF0000"]|||||||||[/color]]