SRL Archive - Help and Support

I SWEAR this error does not make sence.


R0b0t1

2007-09-30 19:44:13

Go ahead, try to compile it. And if you can, tell me whats wrong.


program New;
{.Include SRL/SRL.scar}
type
TRock = record
Name: String;
Color: Integer;
SubCo: TIntegerArray;
end;

Var
Rock: Array [0..8] of TRock;
TinCol, CopperCol, IronCol, SilverCol, CoalCol: Array [0..5] of Integer;
GoldCol, MithrilCol, AdamantCol, RuniteCol: Array [0..5] of Integer;
TheBox: TBox;

procedure SetRockArrayColors;
begin
TinCol[0]:= 5855584;
TinCol[1]:= 6842479;
TinCol[2]:= 5921634;
TinCol[3]:= 7960963;
TinCol[4]:= 3890794;
TinCol[5]:= 4671566;
CopperCol[0]:= 4945799;
CopperCol[1]:= 5143210;
CopperCol[2]:= 4945314;
CopperCol[3]:= 5011624;
CopperCol[4]:= 3890818;
CopperCol[5]:= 4879492;
IronCol[0]:= 10042;
IronCol[1]:= 1977158;
IronCol[2]:= 2569302;
IronCol[3]:= 1844541;
IronCol[4]:= 537162;
IronCol[5]:= 1646903;
SilverCol[0]:= 11316664;
SilverCol[1]:= 11908799;
SilverCol[2]:= 12632264;
SilverCol[3]:= 12632264;
SilverCol[4]:= 11513785;
SilverCol[5]:= 11316664;
CoalCol[0]:= 1714730;
CoalCol[1]:= 1715249;
CoalCol[2]:= 2768960;
CoalCol[3]:= 2636603;
CoalCol[4]:= 1516323;
CoalCol[5]:= 2043181;
GoldCol[0]:= 1883881;
GoldCol[1]:= 1345703;
GoldCol[2]:= 1547455;
GoldCol[3]:= 1884396;
GoldCol[4]:= 1147809;
GoldCol[5]:= 1750751;
MithrilCol[0]:= 8016721;
MithrilCol[1]:= 5585209;
MithrilCol[2]:= 5782331;
MithrilCol[3]:= 5979709;
MithrilCol[4]:= 7491148;
MithrilCol[5]:= 4402477;
AdamantCol[0]:= 5861465;
AdamantCol[1]:= 6190428;
AdamantCol[2]:= 5202767;
AdamantCol[3]:= 6388321;
AdamantCol[4]:= 4017213;
AdamantCol[5]:= 6519906;
RuniteCol[0]:= 11643512;
RuniteCol[1]:= 8485975;
RuniteCol[2]:= 12103804;
RuniteCol[3]:= 12235388;
RuniteCol[4]:= 11577462;
RuniteCol[5]:= 11182706;
end;

function BetterColor(Colors: TIntegerArray): Integer; //Wizzup?
var
I: Integer;
H, S, L: Array Of Extended;
bH, bS, bL: Extended;
begin;
SetLength(H, Length(Colors);
SetLength(S, Length(Colors);
SetLength(L, Length(Colors);
For I := 0 To Length(Colors) - 1 Do
begin;
ColorToHSL(Colors[i], H[i], S[i], L[i]);
bH := bH + H[i];
bS := bS + S[i];
bL := bL + L[i];
End;
If Length(Colors) < 0 Then
Begin
bH := bH Div Length(Colors);
bS := bS Div Length(Colors);
bL := bL Div Length(Colors);
End;
Result := HSLToColor(bH, bS, bL);
End;

procedure SetRockColors;
begin;
Rock[0].Name:= 'tin';
Rock[0].Color:= BetterColor(TinCol);
Rock[0].SubCo:= TinCol;
Rock[1].Name:= 'copper';
Rock[1].Color:= BetterColor(CopperCol);
Rock[1].SubCo:= CopperCol;
Rock[2].Name:= 'iron';
Rock[2].Color:= BetterColor(IronCol);
Rock[2].SubCo:= IronCol;
Rock[3].Name:= 'silver';
Rock[3].Color:= BetterColor(SilverCol);
Rock[3].SubCo:= SilverCol;
Rock[4].Name:= 'coal';
Rock[4].Color:= BetterColor(CoalCol);
Rock[4].SubCo:= CoalCol;
Rock[5].Name:= 'gold';
Rock[5].Color:= BetterColor(GoldCol);
Rock[5].SubCo:= GoldCol;
Rock[6].Name:= 'mithril';
Rock[6].Color:= BetterColor(MithrilCol);
Rock[6].SubCo:= MithrilCol;
Rock[7].Name:= 'adamant';
Rock[7].Color:= BetterColor(AdamantCol);
Rock[7].SubCo:= AdamantCol;
Rock[8].Name:= 'runite';
Rock[8].Color:= BetterColor(RuniteCol);
Rock[8].SubCo:= RuniteCol;
end;

function SetPlayerRockColor(var OreValue: Integer; TheRock: String): Boolean;
var ScCo: Integer; //TheRock:
begin //EX: Players[I].Strings[I]
For ScCo:= 0 to GetArrayLength(Rock) do //OreValue:
begin //Global rockcolor Var
If (TheRock = Rock[I].Name) Then
begin
OreValue:= Rock[I].Color;
Result:= True;
end else
Result:= False;
end;
end;


function ExtendedSearch(var xt, yt: Integer; ColorT, x1, y1, x2, y2, TolT, Extense: Integer): Boolean;
var
SBox: TBox;
I, Cnt: Integer;
DidFind: Boolean;
begin;
GetClientDimensions(InitXP, InitYP);
SBox.x1:= x1
SBox.y1:= y1
SBox.x2:= x2
SBox.y2:= y2
For I:= 0 to Extense do
begin
DidFind:= FindColorTolerance(xt, yt, ColorT, SBox.x1, SBox.y1, SBox.x2, SBox.y2, TolT);
If not (DidFind) then
begin;
If (Cnt <= 0) then
Result:= False
else
begin
WriteLn('Did not find color to fullest extent - ExtendedSearch');
Result:= True;
xt:= xt;
yt:= yt;
Exit;
end;
Inc(Cnt);
SBox.x1:= xt - Round(25/Cnt);
SBox.y1:= yt - Round(25/Cnt);
SBox.x2:= xt + Round(25/Cnt);
SBox.y2:= yt + Round(25/Cnt);
If (SBox.x1 < 0) then
SBox.x1:= 0;
If (SBox.y1 < 0) then
SBox.y1:= 0;
If (SBox.x2 > InitXP) then
SBox.x2:= InitXP;
If (SBox.y2 > InitYP) then
SBox.y2:= InitYP;
end;
Result:= True;
end;

function FindRock(var ClickBox: TBox; RockToFindL: String; T: Integer): Boolean;
var
I, B, Q, MPCol, xxx, yyy, Cnt, SPX, SPY, TRo: Integer;
Found: Boolean;
SkipA: Array [0..14] of TPoint;
SkipA2: Array [0..20] of TPoint;
begin
case LowerCase(RockToFind) of
'tin' : MPCol:= Rock[0].Color;
'copper' : MPCol:= Rock[1].Color;
'iron' : MPCol:= Rock[2].Color;
'silver' : MPCol:= Rock[3].Color;
'coal' : MPCol:= Rock[4].Color;
'gold' : MPCol:= Rock[5].Color;
'mithril': MPCol:= Rock[6].Color;
'adamant': MPCol:= Rock[7].Color;
'runite' : MPCol:= Rock[8].Color;
end;
For I:= 0 to 8 do
If (MPCol = Rock[I].Color) then TRo:= I;
For I:= 0 to 14 do
begin
Found:= FindColorSkipcoordsTolerance(xxx, yyy, MPCol, MSX1, MSY1, MSX2, MSY2, T, SkipA)
If Found then
begin
Inc(Cnt);
SkipA[I].x:= xxx;
SkipA[I].y:= yyy;
If (Cnt >= 5) then
Break;
end;
If not Found then
begin
For B:= 0 to 5 do
begin
Found:= FindColorSkipCoordsTolerance(xxx, yyy, Rock[TRo].SubCo[I], MSX1, MSY1, MSX2, MSY2, T-10, SkipA);
If Found then
begin
Inc(Cnt);
SkipA[I].x:= xxx;
SkipA[I].y:= yyy;
If (Cnt >= 5) then
Break;
end;
end;
end;
end;
If not (Found) then
begin
Result:= False;
Exit;
end;
Cnt:= 0;
Q:= 0;
Reps:= 0;
For I:= 0 to 5 do
begin
repeat
SPX:= SkipA[I].x;
SPX:= SkipA[I].y;
Found:= FindColorSkipCoordsTolerance(SPX, SPY, MPCol, SPX+13, SPY+13, SPX-13, SPY-25, T, SkipA2);
If not Found then
For B:= 0 to 5 do
begin
Found:= FindColorSkipCoordsTolerance(SPX, SPY, Rock[TRo].SubCo[B], SPX+13, SPY+13, SPX-13, SPY-13, T, SkipA2);
If Found then Break;
end;
If Found then
begin
Inc(Cnt);
SkipA2[Q].x:= SPX;
SkipA2[Q].y:= SPX;
end;
Inc(Q);
until(Cnt >= 5) or (Q = 20)
B:= I;
If (Cnt >= 5) and not (Q >= 20) then Break;
end;
If not (Cnt >= 5) then
begin
Result:= False;
Exit;
end;
ClickBox.x1:= SkipA[B].x + 13;
ClickBox.y1:= SkipA[B].y + 13;
ClickBox.x2:= SkipA[B].x - 13;
ClickBox.y2:= SkipA[B].y - 13;
Result:= True;
end;

function GetPickColor(var xx, yy, PickC; Picks: String): Boolean;
var
I: Integer;
Found: Boolean;
MPHDTMTol, PHDTMTol, MPHDTMColor, PHDTMColor, PHDTMSize: Integer;
PickHeadMP: TDTMPointDef;
PickHeadSP: Array [0..4] of TDTMPointDef;
PickHeadSkele: TDTM;
PickDTM: Integer;
begin
case LowerCase(Picks) of
'all' : MPHDTMColor:= 3680034;
'bronze' : MPHDTMColor:= 139054;
'iron' : MPHDTMColor:= 3814708;
'steel' : MPHDTMColor:= 5526357;
'mithril': MPHDTMColor:= 5060662;
'adamant': MPHDTMColor:= 3951421;
'rune' : MPHDTMColor:= 6181955;
end;
If (MPHDTMColor = 3680034) then
MPHDTMTol:= 255
else
MPHDTMTol:= 50;
//MPHDTMTol:= 255; //From original source, replaced by above if.
PHDTMTol:= 5;
//MPHDTMColor:= 3680034; //From original source, replaced by above case.
PHDTMColor:= 65536;
PHDTMSize:= 1;
//---------------------
PickHeadMP.x:= 29;
PickHeadMP.y:= 16;
PickHeadMP.AreaSize:= 1;
PickHeadMP.AreaShape:= 0;
PickHeadMP.Color:= MPHDTMColor;
PickHeadMP.Tolerance:= MPHDTMTol;
//---------------------
PickHeadSP[0].x:= 14;
PickHeadSP[0].y:= 19;
PickHeadSP[0].AreaSize:= PHDTMSize;
PickHeadSP[0].AreaShape:= 0;
PickHeadSP[0].Color: = PHDTMColor;
PickHeadSP[0].Tolerance:= PHDTMTol;
//---------------------
PickHeadSP[1].x:= 28;
PickHeadSP[1].y:= 14;
PickHeadSP[1].AreaSize:= PHDTMSize;
PickHeadSP[1].AreaShape:= 0;
PickHeadSP[1].Color:= PHDTMColor;
PickHeadSP[1].Tolerance:= PHDTMTol;
//---------------------
PickHeadSP[2].x:= 31;
PickHeadSP[2].y:= 14;
PickHeadSP[2].AreaSize:= PHDTMSize;
PickHeadSP[2].AreaShape:= 0;
PickHeadSP[2].Color:= PHDTMColor;
PickHeadSP[2].Tolerance:= PHDTMTol;
//---------------------
PickHeadSP[3].x:= 42;
PickHeadSP[3].y:= 25;
PickHeadSP[3].AreaSize:= PHDTMSize;
PickHeadSP[3].AreaShape:= 0;
PickHeadSP[3].Color:= PHDTMColor;
PickHeadSP[3].Tolerance:= PHDTMTol;
//---------------------
PickHeadSP[4].x:= 24;
PickHeadSP[4].y:= 20;
PickHeadSP[4].AreaSize:= PHDTMSize;
PickHeadSP[4].AreaShape:= 0;
PickHeadSP[4].Color:= PHDTMColor;
PickHeadSP[4].Tolerance:= PHDTMTol;
//---------------------
PickHeadSkele.MainPoint:= PickHeadMP;
PickHeadSkele.SubPoints:= PickHeadSP;
PickDTM:= AddDTM(PickHeadSkele);
//---------------------
If not (FindDTM(PickDTM, xx, yy, MIX1, MIY1, MIX2, MIY2)) then
begin
For I:= 0 to 5 do
begin
Inc(PHDTMSize);
If MPHDTMTol <> 255 then
IncEx(MPHDTMTol, 5);
Found:= FindDTM(PickDTM, xx, yy, MIX1, MIY1, MIX2, MIY2);
If Found then Break;
end;
MPHDTMTol:= 5;
PHDTMSize:= 1;
end else
begin
PickC:= GetColor(xx, yy);
Result:= True;
end;
If not Found then
begin
xx:= -1;
yy:= -1;
Result:= False;
end;
end;

begin
end.

RAM

2007-09-30 20:14:26

SetUpSRL ?

Bourdou!

2007-09-30 20:18:11

PapapapapapapapaPWNT!

R0b0t1

2007-09-30 21:00:03

No thats not it at all. It says its line 80, character 28, and that its supposed to be a comma.

But that line is a SetLength. :(

Santa_Clause

2007-09-30 21:03:14

You're missing parantheses at the end of each SetLength.

R0b0t1

2007-09-30 21:05:36

No shit?

Santa_Clause

2007-09-30 21:07:24

Yep…now you got owned.

  SetLength(H, Length(Colors);
SetLength(S, Length(Colors);
SetLength(L, Length(Colors);

Make it:

  SetLength(H, Length(Colors));
SetLength(S, Length(Colors));
SetLength(L, Length(Colors));

R0b0t1

2007-09-30 21:13:00

No shit!!!!one!!!exclamation!!@!@!!!eleven

The Claw

2007-09-30 22:15:07

Gj santa…dw robot, easy mistake :p

Ransom

2007-09-30 22:52:40

Ok try this error on for size.

program Toot;

{.include SRL/SRL.scar}

var ArrDtm : Integer;


Procedure Declare;
begin
ArrDtm := DTMFromString('78DA636465646058C58002FEFCF261F807A48' +
'1320CFF818011C45ACE800618914820FD8381B09AFF40621D0135' +
'2C40D626026A3880ACF504D40810E16690398B08A801B116E3570' +
'30069510F71');
end;

Procedure FirstArea;
var a,b : Integer;
begin
HighestAngle;
FindDTM(ArrDtm, a, b + 20, 0, 0, 800, 600);
Mouse(a, b, 1, 1, False);
ChooseOption('Talk-to');
end;

begin
SetupSRL;
FirstArea;
end.

i hope it's something stupid i've done and just overlooked because i've wasted too much time being pissed at it. I mean i was barely 5 minutes into scripting. Just wanted to test my DTM. BAM i got bonked in the head by a lead brick.

bullzeye95

2007-09-30 23:00:39

program Toot;

{.include SRL/SRL.scar}

var ArrDtm : Integer;


Procedure Declare;
begin
ArrDtm := DTMFromString('78DA636465646058C58002FEFCF261F807A48' +
'1320CFF818011C45ACE800618914820FD8381B09AFF40621D0135' +
'2C40D626026A3880ACF504D40810E16690398B08A801B116E3570' +
'30069510F71');
end;

Procedure FirstArea;
var a,b : Integer;
begin
HighestAngle;
FindDTM(ArrDtm, a, b, 0, 0, 800, 600);
Mouse(a, b + 20, 1, 1, False);
ChooseOption('Talk-to');
end;

begin
SetupSRL;
FirstArea;
end.
When you put things in as parameters that are going to be changed, such as x and y, or, in this case, a and b, you can't modify them in any way. So, that means you can't have b + 20. You'll have to modify it later.
:)

Santa_Clause

2007-09-30 23:13:43

From: The Claw
Gj santa…dw robot, easy mistake :p


Woot! Street rep to me..even though I suck!

The Claw

2007-09-30 23:30:17

From: Ransom
Ok try this error on for size.

program Toot;

{.include SRL/SRL.scar}

var ArrDtm : Integer;


Procedure Declare;
begin
ArrDtm := DTMFromString('78DA636465646058C58002FEFCF261F807A48' +
'1320CFF818011C45ACE800618914820FD8381B09AFF40621D0135' +
'2C40D626026A3880ACF504D40810E16690398B08A801B116E3570' +
'30069510F71');
end;

Procedure FirstArea;
var a,b : Integer;
begin
HighestAngle;
FindDTM(ArrDtm, a, b + 20, 0, 0, 800, 600);
Mouse(a, b, 1, 1, False);
ChooseOption('Talk-to');
end;

begin
SetupSRL;
FirstArea;
end.

i hope it's something stupid i've done and just overlooked because i've wasted too much time being pissed at it. I mean i was barely 5 minutes into scripting. Just wanted to test my DTM. BAM i got bonked in the head by a lead brick.


a, b are the variables that the position of the dtm is put into, if found. not sure what you were trying to do but if you want b to be + 20, then after you find it, just do b := b + 20 :)

Ransom

2007-10-01 16:57:49

HAHAHHAAHAH WOW i'm stupid. Thanks.

I meant to put b + 20 into the MOUSE function. In this way it would click lower than the DTM… wow… Thanks a ton. Excuse my awesome debugging skills.

shaunthasheep

2007-10-01 17:44:27

dont forget to call declare… *person above me*

Infantry001

2007-10-01 17:45:53

From: Ransom
Ok try this error on for size.

program Toot;

{.include SRL/SRL.scar}

var ArrDtm : Integer;


Procedure Declare;
begin
ArrDtm := DTMFromString('78DA636465646058C58002FEFCF261F807A48' +
'1320CFF818011C45ACE800618914820FD8381B09AFF40621D0135' +
'2C40D626026A3880ACF504D40810E16690398B08A801B116E3570' +
'30069510F71');
end;

Procedure FirstArea;
var a,b : Integer;
begin
HighestAngle;
FindDTM(ArrDtm, a, b + 20, 0, 0, 800, 600);
Mouse(a, b, 1, 1, False);
ChooseOption('Talk-to');
end;

begin
SetupSRL;
FirstArea;
end.

i hope it's something stupid i've done and just overlooked because i've wasted too much time being pissed at it. I mean i was barely 5 minutes into scripting. Just wanted to test my DTM. BAM i got bonked in the head by a lead brick.


Actually, you also forgot to put Declare; in your main loop :duh: