SRL Archive - Help

Making script auto stop?


girboy

2013-01-12 10:06:08

So I read through all of coh3ns tut on the basics of coding in pascal and was able to make a bot using bitmaps and findcolor (for fletching). However I'm not sure of how I would go about making the bot stop when no logs are found. I attempted to do so with

procedure FindLogs;

begin

log := BitmapFromString(11, 13, 'meJxjZGBQC8xP6FwZ27rEuWCiU1' +
'6fQ063fVaHbVqrTUozEDEyMABl49qXwxXA1UAQsgKd6BrnoilAZUA' +
'FQARRjFUBMkJWAER6cQ2uJdNAyiCoYKJpRDFcAaYsEFnGVlkm1Bok' +
't+olNgMRVAHMfIPArKiGeVZJDUAEkQUaCEEmYQVABGQATYYoUHJL0' +
'AorhbDhCGg40AFwBUCLgB6BhwAEQUwAykLcGdOyCGgXxBmQcIhumg' +
'9RgOwXZAVAR4bVzFTxTMFUAFEDAHbHrAw=');

If (FindBitmapToleranceIn(log, x, y, 540, 116, 734, 462, 30)) then
writeln('Found logs! Fletching logs.')
else
writeln('No logs, terminating script.');
Terminatescript;


end;


However regardless of if it finds logs or not the script stops at that point if the "Terminatescript;" line is there. I'm not sure if I'm using the wrong command for this task or not, if anyone could help me out with this that would be great. I'd be willing to recode this part into a different type if needed to fix the problem.

Justin

2013-01-12 10:13:02

Try this


procedure FindLogs;
begin

log := BitmapFromString(11, 13, 'meJxjZGBQC8xP6FwZ27rEuWCiU1' +
'6fQ063fVaHbVqrTUozEDEyMABl49qXwxXA1UAQsgKd6BrnoilAZUA' +
'FQARRjFUBMkJWAER6cQ2uJdNAyiCoYKJpRDFcAaYsEFnGVlkm1Bok' +
't+olNgMRVAHMfIPArKiGeVZJDUAEkQUaCEEmYQVABGQATYYoUHJL0' +
'AorhbDhCGg40AFwBUCLgB6BhwAEQUwAykLcGdOyCGgXxBmQcIhumg' +
'9RgOwXZAVAR4bVzFTxTMFUAFEDAHbHrAw=');

If (FindBitmapToleranceIn(log, x, y, 540, 116, 734, 462, 30)) then
writeln('Found logs! Fletching logs.')
else
begin
writeln('No logs, terminating script.');
Terminatescript;
end;

end;

girboy

2013-01-12 10:20:51

Thank you so much, I wasn't aware I needed begin/end for that. Thinking about it now it seems obvious that with 2 commands I'd need it.

Justin

2013-01-12 10:34:34

From: girboy
Thank you so much, I wasn't aware I needed begin/end for that. Thinking about it now it seems obvious that with 2 commands I'd need it.


No worries, If you just want to do 1 line of code then you wont need a begin end; but as you said, you wanted to do 2 lines of code so begin end; was needed :)