Okay, I looked at your code, and its pretty good for a start. I changed the look for gas procedure to look in the main screen, also made it so it wasn't an infinite loop. Added another variable to make it so your search isn't quite an infinite loop(for later expansion). Look through the code I just posted, i commented where I edited.
SCAR Code:
program New;
{.include SRL/SRL.scar}
var
PoisonDmg, x, y : integer;
const
ChestColour = 549475; //Colour of the Chest
WaitTime = 17150; //Time to wait in between thieving attempts (ms)
procedure DeclarePlayers;
begin
SetupPlayers;
Players[0].Name := '';
Players[0].Pass := '';
Players[0].Nick := '';
Players[0].Active := True;
LoadPlayerArray;
end;
procedure LoadBitmap;
begin
PoisonDmg := BitmapFromString2(False, 'aF599A78DAA58E490E80' +
'200C45AFD43215978CF73F92FC6A8889E242593C7E1E1D202266A' +
'6714A1F080631302E9F1BB24BD30472F012C11EC0046FA27A5FA6' +
'3FE68828BD4EEE1B72B2D388D3F909BD622B72D5860A63DAD8E2B' +
'2FE0C38F3CA5CFDAAFEFEFA5EFF67FE8ADFF63E7307048');
end;
procedure FindPoisonDmg; //repeat until would make it an infinite loop and i
begin //made it search the whole main screen
if FindBitmapToleranceIn(PoisonDmg, x, y, MSX1, MSY1, MSX2, MSY2, 20) then
begin
Writeln('Found Poison Damage')
Mouse(680, 91, 0, 0, true);
Wait(10000+random(2000))
end;
end;
procedure ThieveChest;
var
t : boolean;
begin
if not Loggedin then Exit; //added a boolean that will be false until it
repeat //finds the chest, changing to true so its not
t := false; //an infinite loop
if FindObj(x, y, 'hest', ChestColour, 10) then
begin
Mouse(x, y, 0, 0, False);
ChooseOption('rch');
Wait(500+random(500));
FindPoisonDmg; //Search for poison damage after searching chest
Mouse(x, y, 0, 0, False);
ChooseOption('rch');
Wait(WaitTime + random(400));
FindPoisonDmg;
t := true;
FindNormalRandoms;
end;
until t;
end;
begin
SetupSRL;
DeclarePlayers;
if not(Loggedin) then LoginPlayer;
SetScreenName(Players[CurrentPlayer].Nick);
repeat
ThieveChest;
until false
end.