SRL Archive - OSR Help

Type mismatch


randy marsh

2013-04-27 20:08:04

Need help with my willow powerchopper


I been spending ages trying to see what problem is but i cant..




[Hint] C:\Simba\Scripts\OAKBANKSAT.simba(96:10): Variable 'Result' never used at line 95
[Error] C:\Simba\Scripts\OAKBANKSAT.simba(148:35): Type mismatch at line 147
Compiling failed.

program Oakbank;





{$I SRL-OSR/SRL.Simba}








//------------------------------------------------------------------\\
Procedure DeclarePlayers;
begin
HowManyPlayers := 1;
NumberOfPlayers(HowManyPlayers);
CurrentPlayer := 0;
Players[0].Name := ''; //Username goes here
Players[0].Pass := ''; //Password goes here
Players[0].Nick := ''; //Character name (excluding first letter)
Players[0].Active := True;
end;
//--------------------------------------------------------------------\\





procedure AntiBan;
begin
if(not(LoggedIn))then
Exit;
FindNormalRandoms;
case Random(60) of //antiban change (20) to higher number for less antiban
0:
begin
HoverSkill('Woodcutting', false);
wait(2453+Random(432));
end;
1: PickUpMouse;
2:
begin
MakeCompass('N');
wait(100+random(133));
MakeCompass('S');
wait(50+random(133));
MakeCompass('N');
FindNormalRandoms;
end;
end;
end;


function OakColor: Integer;
var
arP: TPointArray;
arC: TIntegerArray;
tmpCTS, i, arL: Integer;
begin
tmpCTS := GetColorToleranceSpeed;
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.25, 0.29);

if not (FindColorsTolerance(arP, 1847347, MSX1, MSY1, MSX2, MSY2, 9)) then
begin
Writeln('Failed to find the color, no result.');
ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);
Exit;
end;

arC := GetColors(arP);
ClearSameIntegers(arC);
arL := High(arC);

for i := 0 to arL do
begin
Result := arC[i];
//Writeln('AutoColor = ' + IntToStr(arC[i]));
Break;
end;

ColorToleranceSpeed(tmpCTS);
SetColorSpeed2Modifiers(0.2, 0.2);

if (i = arL + 1) then
Writeln('AutoColor failed in finding the color.');
end;




Function ChopTree:boolean;
var
X, Y, PlusOne, TreeCounter: Integer;
Begin
PlusOne:= InvCount +1;
x:=MSCX;
y:=MSCY
If FindobjTPA( X, Y, OakColor, 15, 1, 15, 20, 400, ['Chop','Will']) Then
Begin
Writeln('sweet we spotted a tree');
GetMousePos(X, Y);

Case Random(2) Of
0: Mouse(X, Y, 5, 5, True);
1:Begin
Mouse(X, Y, 5, 5, False);
WaitOption('Chop', 600);
End;
End;

Flag;
Marktime(Treecounter);

Repeat

Antiban;
Wait(1000);
If InvCount=Plusone Then
Writeln('chopped a log');
Until (InvCount=Plusone) Or (TimeFromMark(TreeCounter) > 5000)

End;
End;

Procedure Dropdemlogs;
var
X, Y, LogDTM, I:Integer;
SlotBox:TBox;
LogPattern:TIntegerArray;


Begin

LogDTM := DTMFromString('mggAAAHicY2NgYMhlYmAoAeIsII4F4hwgrgLip0C5m0B8B4ifAfF7IH4NxK624kCSEQvGBP9xqESoBgBujAme');
LogPattern:=[1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,24,28];
Writeln('Dropping logs:' +IntToStr(I));
For I:=0 To 27 Do

Begin
SlotBox:=Invbox(LogPattern[I]);
If findDTm(LogDTM,X,Y,SlotBox.X1,SlotBox.Y1, SlotBox.X2, SlotBox.Y2) Then
Begin
MouseItem(LogPattern[I],False);
ChooseOption('Dro');
End;
End;


End;




[MouseItem(LogPattern[I],False);    


Is supposed to be the problem line…. (IN THE DROPDEMLOGS PROCEDURE)

Sjoe

2013-04-27 20:12:40

for I:= 1 to 28 do // inv starts at 1


try MouseItem(LogPattern, 2); or MouseItem(LogPattern, mouse_right);


also, you forgot SetupSRL;

Chris!

2013-04-27 20:25:16

Why don't you use DropAll and DropAllExcept;? :D

procedure DropLog;
var
TooLong: Integer;
begin
case (Skiller) of
true:
begin
if not (LoggedIn) then
RelogSetup;
begin
DropAllExcept([1]); //Drops all inventory slots except first slot (where axe is)
Wait(RandomRange(400, 750));
end;
end;

false:
begin
if not (LoggedIn) then
RelogSetup;
begin
DropAll; //Drops all.
Wait(RandomRange(400, 750));
end;
end;
end;
end;

randy marsh

2013-04-27 20:26:50

try MouseItem(LogPattern, 2)
dint work ( just clicked on logs dint drop)

MouseItem(LogPattern, mouse_right);
This one worked :P



dropped all logs then just logged out?
Error: Out Of Range at line 144
  SlotBox:=Invbox(LogPattern[I]);   
The following DTMs were not freed: [SRL - Lamp bitmap, SRL - Book of Knowledge, 2]
The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Minimap Mask bitmap]

randy marsh

2013-04-27 20:29:00

From: Chris!
Why don't you use DropAll and DropAllExcept;? :D

procedure DropLog;
var
TooLong: Integer;
begin
case (Skiller) of
true:
begin
if not (LoggedIn) then
RelogSetup;
begin
DropAllExcept([1]); //Drops all inventory slots except first slot (where axe is)
Wait(RandomRange(400, 750));
end;
end;

false:
begin
if not (LoggedIn) then
RelogSetup;
begin
DropAll; //Drops all.
Wait(RandomRange(400, 750));
end;
end;
end;
end;





Pff thats the easy way trying learn hard ways :)

Chris!

2013-04-27 20:29:56

From: randy marsh
Pff thats the easy way trying learn hard ways :)


The important part is that it WORKS!

randy marsh

2013-04-27 20:33:38

erm

procedure DropLog;
var
TooLong: Integer;
begin
case (Skiller) of
true:
begin
if not (LoggedIn) then
RelogSetup;
begin
DropAllExcept([1]); //Drops all inventory slots except first slot (where axe is)
Wait(RandomRange(400, 750));
end;
end;


whats the case (Skiller) mean?

Chris!

2013-04-27 20:45:42

From: randy marsh
erm

procedure DropLog;
var
TooLong: Integer;
begin
case (Skiller) of
true:
begin
if not (LoggedIn) then
RelogSetup;
begin
DropAllExcept([1]); //Drops all inventory slots except first slot (where axe is)
Wait(RandomRange(400, 750));
end;
end;


whats the case (Skiller) mean?


I have a skiller option in my script. If 'true' then it won't get rid of axe.

randy marsh

2013-04-28 10:07:51

bump

Olly

2013-04-28 10:14:59

for I := 1 to 28 do
begin
SlotBox := Invbox(LogPattern[I]);
If findDTM(LogDTM,X,Y,SlotBox.X1,SlotBox.Y1, SlotBox.X2, SlotBox.Y2) Then
begin
MouseItem(LogPattern[I],False);
ChooseOption('Dro');
end;
end;

randy marsh

2013-04-28 10:18:40

Thanks bro will try that

randy marsh

2013-04-28 10:23:30

Ok placed that code in now i get a type mismatch on this line



MouseItem(LogPattern[I],False);     





Here is the drop procedure


Procedure Dropdemlogs;
var
X, Y, LogDTM, I:Integer;
SlotBox:TBox;
LogPattern:TIntegerArray;


Begin

LogDTM := DTMFromString('mggAAAHicY2NgYMhlYmAoAeIsII4F4hwgrgLip0C5m0B8B4ifAfF7IH4NxK624kCSEQvGBP9xqESoBgBujAme');
LogPattern:=[1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,24,28];
Writeln('Dropping logs:' +IntToStr(I));
for I := 1 to 28 do

begin
SlotBox := Invbox(LogPattern[I]);
If findDTM(LogDTM,X,Y,SlotBox.X1,SlotBox.Y1, SlotBox.X2, SlotBox.Y2) Then
begin
MouseItem(LogPattern[I],False);
ChooseOption('Dro');
end;
end;


End;

Olly

2013-04-28 10:48:35

Procedure Dropdemlogs;
var
X, Y, LogDTM, I, h: Integer;
SlotBox: TBox;
LogPattern: TIntegerArray;
begin
LogDTM := DTMFromString('mggAAAHicY2NgYMhlYmAoAeIsII4F4hwgrgLip0C5m0B8B4ifAfF7IH4NxK624kCSEQvGBP9xqESoBgBujAme');
LogPattern := [1,5,9,13,17,21,25,2,6,10,14,18,22,26,3,7,11,15,19,23,27,4,8,12,16,20,24,28];

h := high(logPattern);

for i := 0 to h do
begin
SlotBox := Invbox(LogPattern[I]);
if findDTM(LogDTM,X,Y,SlotBox.X1,SlotBox.Y1, SlotBox.X2, SlotBox.Y2) Then
begin
mouseBox(slotBox, MOUSE_RIGHT);
chooseOption('rop');
end;
end;

freeDTM(logDTM);
end;

try that

randy marsh

2013-04-28 10:51:08

[Error] (149:37): Invalid number of parameters at line 148

  mouseBox(slotBox, MOUSE_RIGHT);

randy marsh

2013-04-28 10:53:47

MouseItem(LogPattern[I], mouse_right);


never mind i used this and it works thanks!!!

Sjoe

2013-04-28 10:57:38

From: randy marsh
MouseItem(LogPattern[I], mouse_right);


never mind i used this and it works thanks!!!



From: Sjoe
for I:= 1 to 28 do // inv starts at 1


try MouseItem(LogPattern, 2); or MouseItem(LogPattern, mouse_right);


also, you forgot SetupSRL;


-.-

randy marsh

2013-04-28 10:59:08

begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
repeat
ChopTree;
If InvFull Then
Dropdemlogs;
until(false);

End.


Dint forget it its at bottom of script :)

Sjoe

2013-04-28 11:05:53

From: randy marsh
begin
SetUpSRL;
ActivateClient;
DeclarePlayers;
LoginPlayer;
repeat
ChopTree;
If InvFull Then
Dropdemlogs;
until(false);

End.


Dint forget it its at bottom of script :)


meant this

try MouseItem(LogPattern, 2); or MouseItem(LogPattern, mouse_right);

randy marsh

2013-04-28 11:17:55

try MouseItem(LogPattern[I], 2);

Just hovers over logs and dosnt drop them :()




MouseItem(LogPattern[I], mouse_right); 

This works :)

randy marsh

2013-04-28 11:25:39

Next problem having trouble finding willow trees i got a fairly good colour match using auto colour,

I think my variables and tolearnce might be to high or low grr…

If FindobjTPA( X,  Y, WillowColor, 10, 1, 15, 30, 500, ['chop']) Then