PDA

View Full Version : [Fighting function by me]] Should work..



gm112
10-05-2006, 10:20 PM
Alright, made a function for fighting. Instead of clicking, it right clicks the monster then attacks. I'll soon add a Run feature.


function FightMonster(MonsterName: String; MColor,MColor2,MColor3: Integer; Tolerance: Integer): Boolean;
var Number, Color: Integer;
begin

for Number := 1 to 3 do
begin
case Number of
1: Color:= MColor1;
2: Color:= MColor2;
3: Color:= MColor3;
end;
if not InFight then
begin
FindObjFast(x,y,MonsterName,Color,Tolerance);
Mouse(x, y, 0, 0, False);
if not ChooseOption(x, y, 'Attack') then
ChooseOption(x, y, 'Cancel')
Wait(1000 + Random(5000));
end;
end;
end;


This may not be the best code out there but it works.

bullzeye95
10-05-2006, 10:38 PM
I'd suggest checking IsUpTextMulti, not right-clicking. It's probably pretty detectable. Or maybe do something like case random(6) of
0: RightClick := True;
1: RightClick := True;
2: RightClick := True;
3: RightClick := True;
4: RightClick := True;
5: RightClick := False;
end;

Then do something like if (not(rightclick))then
Then the procedure you have right now. Then put:
else
<the new procedure without right click here>

Hope that helped.

gm112
10-05-2006, 10:54 PM
Thanks for the tip bullzeye! Next release I'll add that in.

Cheesehunk
10-06-2006, 02:37 AM
That long wait at the end will definetly have some conflic if you encounter a random..

Try this:
function FightMonster(MonsterName: String; WaitAfterClick, MColor,MColor2,MColor3: Integer; Tolerance: Integer): Boolean;
var Number, Color: Integer;
begin
for Number := 1 to 3 do
begin
case Number of
1: Color:= MColor1;
2: Color:= MColor2;
3: Color:= MColor3;
end;
if not InFight then
begin
FindObjFast(x,y,MonsterName,Color,Tolerance);
if Random(6) = 1 then
begin
Mouse(x, y, 0, 0, False);
wait( 100 + random ( 50 ));
if not ChooseOption(x, y, 'Attack') then
ChooseOption(x, y, 'Cancel')
end else
Mouse(x, y, 0, 0, True);
FTWait( WaitAfterClick / ( 200 + random(50)));
end;
end;
end;

I also added some other stuff like it will right click 5/6 times..

Hope you like it. :)

gm112
10-06-2006, 02:54 AM
Thanks for the modification! You beat me to adding on =D. Oh well, I'll try to make a function for other things =D.