nice second script dude, keep it up!
Let's help you a bit :)
procedure AttackChicken;
SCAR Code:
procedure attackchicken;
Begin
If FindObjCustom(x, y, ['Chicken', 'cken', 'hick'], [Chickencolor1,Chickencolor2,Chickencolor3], 4) then
begin
Mouse(x, y, 0, 0, False);
Wait(100 + random(100));
if ChooseOption('ttack') then
begin
attacktimes := attacktimes + 1;
WriteLn('attacking a chicken time ' + inttostr(attacktimes));
Wait(3000 + random(1000));
exit;
end else
repeat
If not FindObjCustom(x, y, ['Chicken', 'cken', 'hick'], [Chickencolor1,Chickencolor2,Chickencolor3], 4) then
NotFound := NotFound + 1;
if FindObjCustom(x, y, ['Chicken', 'cken', 'hick'], [Chickencolor1,Chickencolor2,Chickencolor3], 4) then NotFound := 0
until (NotFound > 15)
writeln('Cannot find any chicken, switching player');
Logout;
NextPlayer(True);
Exit;
end;
end;
Let's look closer to this:
SCAR Code:
end else
repeat
If not FindObjCustom(x, y, ['Chicken', 'cken', 'hick'], [Chickencolor1,Chickencolor2,Chickencolor3], 4) then
NotFound := NotFound + 1;
if FindObjCustom(x, y, ['Chicken', 'cken', 'hick'], [Chickencolor1,Chickencolor2,Chickencolor3], 4) then NotFound := 0
until (NotFound > 15)
So what you actually want to do is:
When it doesn't finds the chicken it will try again and repeat trying for 15 tims. Right?
Why not adding a boolean to it and result it as true when you the chicken is found?
Something like this:
You add the boolean var:
SCAR Code:
procedure attackchicken;
var
ChickenFound: boolean;
Begin
..
Than you check: (posted explanation above)
SCAR Code:
end else
repeat
If FindObjCustom(x, y, ['Chicken', 'cken', 'hick'], [Chickencolor1,Chickencolor2,Chickencolor3], 4) then
begin
Writeln('Found the chicken.');
ChickenFound:= true;
Mouse(x, y, 0, 0, True);
end else
begin
NotFound := NotFound + 1;
Writeln(inttostr(NotFound)+'/'15 tries.');
end;
until (ChickenFound) or (NotFound > 15)
You can also make it a function instead of a procedure, than you'll have something like this:
SCAR Code:
function attackchicken: boolean;
var
ChickenFound: boolean;
Begin
If FindObjCustom(x, y, ['Chicken', 'cken', 'hick'], [Chickencolor1,Chickencolor2,Chickencolor3], 4) then
begin
Mouse(x, y, 0, 0, False);
Wait(100 + random(100));
ChooseOption('ttack');
Flag;//if the chicken isn't near you, you will have to walk, so Flag is needed.
result:= true;
attacktimes := attacktimes + 1;
WriteLn('attacking a chicken time ' + inttostr(attacktimes));
Wait(3000 + random(1000));
exit;
end else
repeat
If FindObjCustom(x, y, ['Chicken', 'cken', 'hick'], [Chickencolor1,Chickencolor2,Chickencolor3], 4) then
begin
Writeln('Found the chicken.');
ChickenFound:= true;
Mouse(x, y, 0, 0, False);
Wait(100 + random(100));
ChooseOption('ttack')
Flag;//if the chicken isn't near you, you will have to walk, so Flag is needed.
result:= true;
attacktimes := attacktimes + 1;
WriteLn('attacking a chicken time ' + inttostr(attacktimes));
Wait(3000 + random(1000));
exit;
end else
begin
NotFound := NotFound + 1;
Writeln(inttostr(NotFound)+'/15 tries.');
end;
until (ChickenFound) or (NotFound > 15)
if NotFound > 15 then
begin
writeln('Cannot find any chicken, switching player');
NextPlayer(True);
result:= false;
Exit;
end;
end;
if you understand what's up here then you're on the good way bro, then you can look through it and make those things by yourself by logicly thinking ;)
procedure RespondChat;
SCAR Code:
procedure Respondchat;
begin
if (InChat('att lvl?') or
InChat('att level?') or
InChat('attack level?') or
InChat('attack lvl?')) then
begin
TypeSend(IntToStr(GetSkillLevel('Attack')))
RespondAmount := RespondAmount + 1;
if (InChat('str lvl?') or
InChat('strenght level?') or
InChat('str level?') or
InChat('strenght lvl?')) then
begin
TypeSend(IntToStr(GetSkillLevel('strenght')))
RespondAmount := RespondAmount + 1;
if (InChat('def lvl?') or
InChat('defence level?') or
InChat('def level?') or
InChat('defence lvl?')) then
begin
TypeSend(IntToStr(GetSkillLevel('strenght')))
RespondAmount := RespondAmount + 1;
if (InChat('hp lvl?') or
InChat('hitpoints level?') or
InChat('hp level?') or
InChat('hitpoints lvl?')) then
begin
TypeSend(IntToStr(GetSkillLevel('strenght')))
RespondAmount := RespondAmount + 1;
if (InChat('Ranged lvl?') or
InChat('ranged level?') or
InChat('range level?') or
InChat('ranged lvl?')) then
begin
TypeSend(IntToStr(GetSkillLevel('strenght')))
RespondAmount := RespondAmount + 1;
if (InChat('pray lvl?') or
InChat('prayer level?') or
InChat('pray level?') or
InChat('prayer lvl?')) then
begin
TypeSend(IntToStr(GetSkillLevel('strenght')))
RespondAmount := RespondAmount + 1;
if (InChat('mage lvl?') or
InChat('magic level?') or
InChat('mage level?') or
InChat('magic lvl?')) then
begin
TypeSend(IntToStr(GetSkillLevel('strenght')))
RespondAmount := RespondAmount + 1;
end;
end;
end;
A golden rule: every "begin" has got an "end; : "
SCAR Code:
procedure Respondchat;
begin
if (InChat('att lvl?') or
InChat('att level?') or
InChat('attack level?') or
InChat('attack lvl?')) then
begin
TypeSend(IntToStr(GetSkillLevel('Attack')))
RespondAmount := RespondAmount + 1;
end;
if (InChat('str lvl?') or
InChat('strenght level?') or
InChat('str level?') or
InChat('strenght lvl?')) then
begin
TypeSend(IntToStr(GetSkillLevel('strenght')))
RespondAmount := RespondAmount + 1;
end;
if (InChat('def lvl?') or
InChat('defence level?') or
InChat('def level?') or
InChat('defence lvl?')) then
begin
TypeSend(IntToStr(GetSkillLevel('strenght')))
RespondAmount := RespondAmount + 1;
end;
if (InChat('hp lvl?') or
InChat('hitpoints level?') or
InChat('hp level?') or
InChat('hitpoints lvl?')) then
begin
TypeSend(IntToStr(GetSkillLevel('strenght')))
RespondAmount := RespondAmount + 1;
end;
if (InChat('Ranged lvl?') or
InChat('ranged level?') or
InChat('range level?') or
InChat('ranged lvl?')) then
begin
TypeSend(IntToStr(GetSkillLevel('strenght')))
RespondAmount := RespondAmount + 1;
end;
if (InChat('pray lvl?') or
InChat('prayer level?') or
InChat('pray level?') or
InChat('prayer lvl?')) then
begin
TypeSend(IntToStr(GetSkillLevel('strenght')))
RespondAmount := RespondAmount + 1;
end;
if (InChat('mage lvl?') or
InChat('magic level?') or
InChat('mage level?') or
InChat('magic lvl?')) then
begin
TypeSend(IntToStr(GetSkillLevel('strenght')))
RespondAmount := RespondAmount + 1;
end;
end;
There are still other things that I can tell, but I 'fixed' your script and i put info over there too ;)
P.S. It's an attachment in this post:)