Thief
2013-04-24 06:08:22
Hey so I'm having a little trouble with this end else..function in my script.
Basically, i'm trying to search for a DTM and if it fails, search for an alternative DTM. The problem is that even when it finds the first, it also finds the second (so it basically clicks twice, which may look a little bottish). I'm guessing that I must be doing something wrong..But I can't figure out what :(
Here's my code.
Basically, i'm trying to search for a DTM and if it fails, search for an alternative DTM. The problem is that even when it finds the first, it also finds the second (so it basically clicks twice, which may look a little bottish). I'm guessing that I must be doing something wrong..But I can't figure out what :(
Here's my code.
procedure ClickObstacle;
var
x, y, ObstacleDTM, ObstacleBackup :Integer;
begin
ObstacleDTM := DTMFromString('mOwIAAHicvc3NasJAFAXgk8eQqk/TjbgTUdDiwi4K/nVVcKVP4AMI7krXKljakoiIf7QSxRBJSCwEQUTEZ9DjOIIrdzrwMffeuZx5APCoACEKk8Z+TBaZpJNNBjnyTeVe77hLI/qjPnWoQXF6plcacL+PU65fOWW5MvONilKBspShJykpZ7mLWYnKVJEiFKUY5elFWlLzo4rtagyt8Y7N4hee2YWtqzAnX7ANFf9WB/Ppt6it2Y/oj7djamJujD4xG7ZE7c7bSKWDSKQCwm6to1WvwXO6In/P/858N6bc0ZVzAKmOX0s=');
SetAngle(SRL_ANGLE_LOW);
MakeCompass('E');
if FindDTMRotated(ObstacleDTM, x, y, MSX1, MSY1, MSX2, MSY2, -Pi, Pi, Pi/360, aFound) then
begin
Mouse(x, y, 2, 2, false);
WaitOption('Climb', 1000);
WriteLn('found shortcut');
end else;
begin
ObstacleBackup:=DTMfromString('mjwIAAHicxc3BSgJhFAXgMw/QA7TyKXqdCGxVokEiEQVGO5ctJJAWISUiySgOzRgF2Zg2TUwNOIwUypiQtZDwBfLMdPcu/eHjXu49lz8GYE0BNNYbMkilCl3KzCSLajKvUonyyr8CFelM+hUKuL+iMl3TiWTDzLnUEnncbVKGkrRDCYrThgj7dZGWXJb2aU/syu2UZnRAh5SjFG3RNh3TkRgP2vj5tDD223h9bmAy6qLn6Pj9dmA/qpHgvQXnqR75CjpwbQ2mUYZj1uF2NNzqRYy8B1hmFd6bAfXiFL7dRM/S4btNvHRrUSbsw/sP7w7D/j3++P/qkihLtODNAcnRcBU=');
if FindDTM(ObstacleBackup, x, y, MSX1, MSY1, MSX2, MSY2) then
begin
Mouse(x, y, 1, 1, true);
WriteLn('Found backupDTM');
end;
end;
FreeDtm(ObstacleDTM);
FreeDTM(ObstacleBackup);
end;