SRL Archive - OSR Help

Help with a reflection check


Mr. Doctor

2011-01-30 17:04:57

I am currently working on a script. It is going to use color with reflection backup (or vice-versa).

This is the part of the script right herrr that is troubling me,


function CheckIron: TPoint;
var
i: integer;
IronTPA: TPointArray;
begin
Result := Point(-1, -1);
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(MSCX, MSCY, IronTPA, 969971, MSX1, MSY1, MSX2, MSY2, 20); // Dummy color
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(1);
for i := 0 to high(GoldTPA) do
begin
MMouse(IronTPA[I].x, IronTPA[I].y, 2, 2);
if(IsUpTextMultiCustom(['ine','ock','cks'])) then
begin
Result := IronTPA[I];
Writeln('Iron Found, or a different rock. Doing a reflection check.');
// this right herrr
end
end;
end;

I was wondering, what could I do for a reflection check if it finds the rock to make sure it is iron and it isn't mined?

Thanks in advanced.

kitchenrange

2011-01-30 17:30:17

You will have to collect the ids of the mined/unmined rocks of your area. Then, once you find the rock using color, convert the Point into a TTile, and check the ID of the object found on that tile. Compare it to your array of Rock IDs and there ya go.

Mr. Doctor

2011-01-31 21:00:07

Ahh, thank you.
I'm quiet new to reflection, and know some of it, but I do not know its limits.
If anyone would like to help me send me a PM.

Edit:
I finally got my IDs for the 4 rocks (Gold and Iron).

Set up my const

// Don't TOUCH THIS
TallIRockID = 9720;
ShortIRockID = 9722; // Reflection IDs
TallGRockID = 9717;
ShortGRockID = 9718;
//Looking South - Tall gold is left and short is right

Confusing if you don't know what I'm talking about, but this isn't the problem.



function CheckIron: TPoint;
var
i: integer;
IronTPA: TPointArray;
IRock: TTile;
begin
Result := Point(-1, -1);
ColorToleranceSpeed(2);
SetColorSpeed2Modifiers(0.10, 0.13);
FindColorsSpiralTolerance(MMCX, MMCY, IronTPA, 1713730, MMX1, MMY1, MMX2, MMY2, 5);
SetColorSpeed2Modifiers(0.2, 0.2);
ColorToleranceSpeed(1);
for i := 0 to high(IronTPA) do
begin
MMouse(IronTPA[I].x, IronTPA[I].y, 2, 2);
if(IsUpTextMultiCustom(['ine','ock','cks'])) then
begin
Result := IronTPA[I];
Writeln('Iron Found, or a different rock. Doing a reflection check.');
IRock := PointToTile(IronTPA[I]);



end
end;
end;

Those empty three lines are my problem. How would I grab the ID of the tile and see if it matches the ID from the const?

KingKong

2011-01-31 21:36:05

I think its something like this:

procedure GetIDAtTile(TTile);
var
rock: TRSObject;
begin
rock := GetObjectAt(TTile, 0);
writeln(rock.ID);
end;
Im not on a comp with simba on it, so im not sure about the exact command.

kitchenrange

2011-01-31 21:38:08

Something like:
First Add
Rock : TRSObject
Then
Rock := GetObjectAt(IRock);

After That Rock.ID will return the ID of the object on the tile you found.

:/ KingKong beat me to it.