View Full Version : Help with my script
Supertrent1
02-12-2012, 09:42 PM
I am trying to make a very simple chicken killer but I am getting this line
[Hint] (82:10): Variable 'Result' never used at line 81
[Error] (119:1): 'BEGIN' expected at line 118
Compiling failed.
Here is the script itself.
program ChickenKiller;
{.include/SRL/SRL.simba}
{.include SRL/SRL/Misc/SMART.simba}
{.include SRL\SRL.simba}
{.Include SRL\SRL\Misc\Debug.simba}
const
SmartWorld = 15; // Which World/Server do you want to use?
SmartMembers = True; // Are you a Member?
SmartSigned = True; // Signed/UnSigned Client?
SmartSuperDetail = False; // Use Super Detail?
Version = '1.0';
NumbOfPlayers = 1;
StartPlayer = 0;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Username
Players[0].Pass := ''; //Password
Players[0].Active := True;
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;
Procedure Antiban; //Antiban, Credits to YoHo
Begin
Case Random(192) Of
0: HoverSkill('Woodcutting', False); //skill
1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
2: ExamineInv;
3: RandomAngle(1);
4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
5: HoverSkill('random', False);
End;
End;
Function ChickenColor: Integer; //Credits to ACA
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 1.07);
FindColorsSpiralTolerance(MMCX, MMCY, arP, 5480128, MMX1, MMY1, MMX2, MMY2, 25);
if (Length(arP) = 0) then
begin
Writeln('Failed to find chicken.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 8.79) and (X <= 69.31) and (Y >= 8.51) and (Y <= 74.97) and (Z >= 3.75) and (Z <= 44.55) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
Function KillChicken: Boolean;
var
x, y: Integer;
begin;
x:= MSCX;
y:= MSCY;
If FindObjTPA(x, y, ChickenColor, 3, 1, 12, 1, 1, ['attack']) Then
Begin
Case Random(2) Of
0: Mouse(x, y, 5, 5, True);
1: Begin
Mouse(x, y, 5, 5, False);
Wait(100+Random(100));
WaitOption('attack', 500);
End;
end;
Flag;
begin
DeclarePlayers;
Smart_Server := SmartWorld;
Smart_Members := SmartMembers;
Smart_Signed := SmartSigned;
Smart_SuperDetail := SmartSuperDetail;
SetupSRL;
If not (LoggedIn) then
LoginPlayer;
ChickenColor;
Repeat
KillChicken;
Until (False);
end;
end;
end;
Any help and or constructive criticism is appreciated.
Okay, I got it working. Now, what is a better way to find a chicken? I'm using aca and I couldn't find a great color so it's kinda clicking all over the place :)
shadowrecon
02-12-2012, 09:44 PM
looks like you are missing a few ends in some places heres what it should look like -->
program ChickenKiller;
{.include/SRL/SRL.simba}
{.include SRL/SRL/Misc/SMART.simba}
{.include SRL\SRL.simba}
{.Include SRL\SRL\Misc\Debug.simba}
const
SmartWorld = 15; // Which World/Server do you want to use?
SmartMembers = True; // Are you a Member?
SmartSigned = True; // Signed/UnSigned Client?
SmartSuperDetail = False; // Use Super Detail?
Version = '1.0';
NumbOfPlayers = 1;
StartPlayer = 0;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Username
Players[0].Pass := ''; //Password
Players[0].Active := True;
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;
Procedure Antiban; //Antiban, Credits to YoHo
Begin
Case Random(192) Of
0: HoverSkill('Woodcutting', False); //skill
1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
2: ExamineInv;
3: RandomAngle(1);
4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
5: HoverSkill('random', False);
End;
End;
Function ChickenColor: Integer; //Credits to ACA
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 1.07);
FindColorsSpiralTolerance(MMCX, MMCY, arP, 5480128, MMX1, MMY1, MMX2, MMY2, 25);
if (Length(arP) = 0) then
begin
Writeln('Failed to find chicken.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 8.79) and (X <= 69.31) and (Y >= 8.51) and (Y <= 74.97) and (Z >= 3.75) and (Z <= 44.55) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
Function KillChicken: Boolean;
var
x, y: Integer;
begin;
x:= MSCX;
y:= MSCY;
If FindObjTPA(x, y, ChickenColor, 3, 1, 12, 1, 1, ['attack']) Then
Begin
Case Random(2) Of
0: Mouse(x, y, 5, 5, True);
1: Begin
Mouse(x, y, 5, 5, False);
Wait(100+Random(100));
WaitOption('attack', 500);
End;
end;
end;
end;
// this needs to be placed in a wrapper some where ... Flag;
procedure MainLoop;
begin
KillChicken;
end;
begin
DeclarePlayers;
Smart_Server := SmartWorld;
Smart_Members := SmartMembers;
Smart_Signed := SmartSigned;
Smart_SuperDetail := SmartSuperDetail;
SetupSRL;
If not (LoggedIn) then
LoginPlayer;
ChickenColor;
repeat
MainLoop;
until False;
end.
x[Warrior]x3500
02-12-2012, 09:45 PM
program ChickenKiller;
{.include/SRL/SRL.simba}
{.include SRL/SRL/Misc/SMART.simba}
{.include SRL\SRL.simba}
{.Include SRL\SRL\Misc\Debug.simba}
const
SmartWorld = 15; // Which World/Server do you want to use?
SmartMembers = True; // Are you a Member?
SmartSigned = True; // Signed/UnSigned Client?
SmartSuperDetail = False; // Use Super Detail?
Version = '1.0';
NumbOfPlayers = 1;
StartPlayer = 0;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Username
Players[0].Pass := ''; //Password
Players[0].Active := True;
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;
Procedure Antiban; //Antiban, Credits to YoHo
Begin
Case Random(192) Of
0: HoverSkill('Woodcutting', False); //skill
1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
2: ExamineInv;
3: RandomAngle(1);
4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
5: HoverSkill('random', False);
End;
End;
Function ChickenColor: Integer; //Credits to ACA
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 1.07);
FindColorsSpiralTolerance(MMCX, MMCY, arP, 5480128, MMX1, MMY1, MMX2, MMY2, 25);
if (Length(arP) = 0) then
begin
Writeln('Failed to find chicken.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 8.79) and (X <= 69.31) and (Y >= 8.51) and (Y <= 74.97) and (Z >= 3.75) and (Z <= 44.55) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
Function KillChicken: Boolean;
var
x, y: Integer;
begin;
x:= MSCX;
y:= MSCY;
If FindObjTPA(x, y, ChickenColor, 3, 1, 12, 1, 1, ['attack']) Then
Begin
Case Random(2) Of
0: Mouse(x, y, 5, 5, True);
1: Begin
Mouse(x, y, 5, 5, False);
Wait(100+Random(100));
WaitOption('attack', 500);
End;
end;
end
end;
begin
DeclarePlayers;
Smart_Server := SmartWorld;
Smart_Members := SmartMembers;
Smart_Signed := SmartSigned;
Smart_SuperDetail := SmartSuperDetail;
SetupSRL;
If not (LoggedIn) then
LoginPlayer;
ChickenColor;
Repeat
KillChicken;
Until (False);
end.
it was more than just one end. u put ends in wierd places and such. fixed it though.
program ChickenKiller;
{.include/SRL/SRL.simba}
{.include SRL/SRL/Misc/SMART.simba}
{.include SRL\SRL.simba}
{.Include SRL\SRL\Misc\Debug.simba}
const
SmartWorld = 15; // Which World/Server do you want to use?
SmartMembers = True; // Are you a Member?
SmartSigned = True; // Signed/UnSigned Client?
SmartSuperDetail = False; // Use Super Detail?
Version = '1.0';
NumbOfPlayers = 1;
StartPlayer = 0;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Username
Players[0].Pass := ''; //Password
Players[0].Active := True;
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;
Procedure Antiban; //Antiban, Credits to YoHo
Begin
Case Random(192) Of
0: HoverSkill('Woodcutting', False); //skill
1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
2: ExamineInv;
3: RandomAngle(1);
4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
5: HoverSkill('random', False);
End;
End;
Function ChickenColor: Integer; //Credits to ACA
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 1.07);
FindColorsSpiralTolerance(MMCX, MMCY, arP, 5480128, MMX1, MMY1, MMX2, MMY2, 25);
if (Length(arP) = 0) then
begin
Writeln('Failed to find chicken.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 8.79) and (X <= 69.31) and (Y >= 8.51) and (Y <= 74.97) and (Z >= 3.75) and (Z <= 44.55) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
Function KillChicken: Boolean;
var
x, y: Integer;
begin;
x:= MSCX;
y:= MSCY;
If FindObjTPA(x, y, ChickenColor, 3, 1, 12, 1, 1, ['attack']) Then
Begin
Case Random(2) Of
0: Mouse(x, y, 5, 5, True);
1: Begin
Mouse(x, y, 5, 5, False);
Wait(100+Random(100));
WaitOption('attack', 500);
End;
end;
Flag;
end;
end;
begin
DeclarePlayers;
Smart_Server := SmartWorld;
Smart_Members := SmartMembers;
Smart_Signed := SmartSigned;
Smart_SuperDetail := SmartSuperDetail;
SetupSRL;
If not (LoggedIn) then
LoginPlayer;
ChickenColor;
Repeat
KillChicken;
Until (False);
end.
It was a kinda mess :P Keep mainloop simple. Keep functions Seperated from each others, (and procedures ofc)
Compare that and your old version to see differences. I'm little bit tired currently...
~Home
Supertrent1
02-12-2012, 09:47 PM
x3500;926873']
program ChickenKiller;
{.include/SRL/SRL.simba}
{.include SRL/SRL/Misc/SMART.simba}
{.include SRL\SRL.simba}
{.Include SRL\SRL\Misc\Debug.simba}
const
SmartWorld = 15; // Which World/Server do you want to use?
SmartMembers = True; // Are you a Member?
SmartSigned = True; // Signed/UnSigned Client?
SmartSuperDetail = False; // Use Super Detail?
Version = '1.0';
NumbOfPlayers = 1;
StartPlayer = 0;
procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Username
Players[0].Pass := ''; //Password
Players[0].Active := True;
Players[0].BoxRewards := ['Xp', 'mote', 'ostume', 'oins', 'aphire', 'ssence'];
end;
Procedure Antiban; //Antiban, Credits to YoHo
Begin
Case Random(192) Of
0: HoverSkill('Woodcutting', False); //skill
1: Begin PickUpMouse; SleepAndMoveMouse(3000 + Random(500)); End;
2: ExamineInv;
3: RandomAngle(1);
4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(Tab_Inv); End;
5: HoverSkill('random', False);
End;
End;
Function ChickenColor: Integer; //Credits to ACA
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
X, Y, Z: Extended;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 1.07);
FindColorsSpiralTolerance(MMCX, MMCY, arP, 5480128, MMX1, MMY1, MMX2, MMY2, 25);
if (Length(arP) = 0) then
begin
Writeln('Failed to find chicken.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;
arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);
for i := 0 to arL do
begin
ColorToXYZ(arC[i], X, Y, Z);
if (X >= 8.79) and (X <= 69.31) and (Y >= 8.51) and (Y <= 74.97) and (Z >= 3.75) and (Z <= 44.55) then
begin
Result := arC[i];
Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;
end;
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;
Function KillChicken: Boolean;
var
x, y: Integer;
begin;
x:= MSCX;
y:= MSCY;
If FindObjTPA(x, y, ChickenColor, 3, 1, 12, 1, 1, ['attack']) Then
Begin
Case Random(2) Of
0: Mouse(x, y, 5, 5, True);
1: Begin
Mouse(x, y, 5, 5, False);
Wait(100+Random(100));
WaitOption('attack', 500);
End;
end;
end
end;
begin
DeclarePlayers;
Smart_Server := SmartWorld;
Smart_Members := SmartMembers;
Smart_Signed := SmartSigned;
Smart_SuperDetail := SmartSuperDetail;
SetupSRL;
If not (LoggedIn) then
LoginPlayer;
ChickenColor;
Repeat
KillChicken;
Until (False);
end.
it was more than just one end. u put ends in wierd places and such. fixed it though.
Thanks for the help and quick reply's. You too shadow. Both +rep'd.
Supertrent1
02-13-2012, 10:02 PM
Bump! Need help with finding the chicken instead of everything.
x[Warrior]x3500
02-13-2012, 10:38 PM
well that could be a few things:
1. why do u use a tolerance if you are autocoloring the chicken ( If FindObjTPA(x, y, ChickenColor, 3, 1, 12, 1, 1, ['attack']) Then ) why a tolerance of 3? the color is already found.
2. check to see if your autocolor is too broad. maybe u should select fewer colors that are more unique to chickens.
3. learn to create your own ATPAs instead of using FindObjTPA.
Powered by vBulletin® Version 4.2.1 Copyright © 2024 vBulletin Solutions, Inc. All rights reserved.