SRL Archive - OSR Help

Right-click Attack Script Help


Jenga

2013-04-03 00:02:27

Hi Guys,

I'm a little lost on my script and need a bit of assistance, what I'm trying to create is a tool that waits until I right-click on the screen, and then selects the option 'attack' if it finds the DTM, seeing as this is for an RSPS and the text-finding tool thing doesn't work.

This is what I've got so far, it finds the DTM without issue.

Any and all help is appreciated!


program rightclickattack;

{$i srl/srl.simba}

var
Attack, X, Y: Integer;

begin

SetupSRL;

attack := DTMFromString('m6wAAAHic42ZgYHjMyMBwF4ivA/FZKAbxnwPxByD+BsRfgfgTEG8Fqt8IxJuAeDMQ74TiXUgYpubYjqkM2uoyYBodo4uTAhhJwEgAAHfrJTw=');
FindDTM (attack, x, y, MSX1, MSY1, MSX2, MSY2) then

begin
MMouse (x, y, 0, 0);
Mouse (X, Y, 0, 0, True);
end;
FreeDTM(Attack);
end.

Flight

2013-04-03 00:27:23

Try this buddy:

program rightclickattack;
{$i srl/srl.simba}

var
DTM_Attack: Integer;

Procedure DefineGlobals;
begin
DTM_Attack := DTMFromString('m6wAAAHic42ZgYHjMyMBwF4ivA/FZKAbxnwPxByD+BsRfgfgTEG8Fqt8IxJuAeDMQ74TiXUgYpubYjqkM2uoyYBodo4uTAhhJwEgAAHfrJTw=');
end;

Procedure FreeGlobals;
begin
FreeDTM(DTM_Attack);
end;

Function ChooseAttack: Boolean;
var
X,Y: Integer;
begin
if not FindDTM(DTM_Attack, X, Y, MSX1, MSY1, MSX2, MSY2) then
Exit;

MMouse(X, Y, 0, 0);
ClickMouse2(mouse_left);
Result := True;
end;


begin
SetupSRL;
DefineGlobals;
AddOnTerminate('FreeGlobals');

if ChooseAttack then
Writeln('Choose the "Attack" option!')
else
Writeln('Failed to find "Attack" option...');
end.