SRL Archive - Help

Getting an error when using TPA's


rj

2012-12-14 18:47:40

I am currently working on a powerminer for a RSPS, when it starts up it attempts to detect smoke(random event smoke that comes from rocks) and if it does not find any it moves on to click the iron rock, So far I got:

program Powermine;
{$i srl/srl.simba}
Procedure AntiSmoke;
Begin
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.18,0.45);
Wait(5000);
end;
Procedure FindRock;
var
tmpCTS, l, r,X,Y:Integer;
IronTPA:TPointArray;
SmokeTPA:TPointArray;
begin
SmokeTPA := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.17, 0.17);
If FindColorsTolerance(SmokeTPA, 7110803, 11, 27, 522, 360, 4) then
begin
AntiSmoke;
end;
begin
tmpCTS := GetToleranceSpeed;
SetColorToleranceSpeed(2);
SetToleranceSpeed2Modifiers(0.18,0.45);
if FindColorsTolerance(IronTPA, 2569557, 11, 27, 522, 360, 3) then
begin
SetColorToleranceSpeed(tmpCTS);
SetToleranceSpeed2Modifiers(0.02, 0.02);
L := High(IronTPA)
wait(randomrange(60, 200));
mmouse(IronTPA[r].x, IronTPA[r].y, 2, 2);
clickmouse2(mouse_left);
end;
end;

begin
SetupSRL
FindRock;
end

But I get this error:
[Error] C:\Simba\Scripts\KMiner.simba(16:32): Type mismatch at line 15
Compiling failed.

I don't understand what's wrong.

Dynamite

2012-12-14 18:53:59

Delete that line, i don't even…

-Boom

rj

2012-12-14 18:55:31

Delete what line..?

P1ng

2012-12-14 18:57:51

The error says there's something wrong with line 15.

SmokeTPA := GetToleranceSpeed;

You are trying to assign an integer to a TPA?? Just delete the line

Slashed

2012-12-14 18:57:55

SmokeTPA := GetToleranceSpeed;


This is wrong. You assign the GetToleranceSpeed to your temporary CTS variable( in your case, tmpCTS)

EDIT: LOL p1ng you were faster :tongue:

rj

2012-12-14 19:02:39

[Error] C:\Simba\Scripts\KMiner.simba(41:4): Identifier expected at line 40
Compiling failed.
lol wtf got this error last line, i never get errors on the last line must be something dumb

Slashed

2012-12-14 19:15:42

SetupSRL
doesn't have a semicolon after it…

end


And you don't have a .(dot) on the last end.

rj

2012-12-14 19:23:12

Those are the first to things I tried to fix, and btw i fixed the end. before you mentioned it:


Slashed

2012-12-14 19:28:18

Inside the FindRock procedure, you have 4 begins and only 2 ends. Close those begins up! :tongue:

EDIT: Was looking to your code snippet but even so, just by your picture, is something along those lines, see if every begin or case has an end.

rj

2012-12-14 19:35:04

From: Slashed
Inside the FindRock procedure, you have 4 begins and only 2 ends. Close those begins up! :tongue:

EDIT: Was looking to your code snippet but even so, just by your picture, is something along those lines, see if every begin or case has an end.


ahh got it, usualy when i forget a end; it goes to the line before it not the end :D thanks anywayz

Slashed

2012-12-14 19:37:45

From: rjj95
ahh got it, usualy when i forget a end; it goes to the line before it not the end :D thanks anywayz


Your welcome.:biggrin:

As a tip to avoid similar errors in the future, everytime you do a begin, type the end as well. That way you don't forget.

rj

2012-12-14 20:16:24

From: Slashed
Your welcome.:biggrin:

As a tip to avoid similar errors in the future, everytime you do a begin, type the end as well. That way you don't forget.


I usually do that but this is my first TPA script so I was a little confused