SRL Archive - First Scripts

First Reaction script, need help with DTM SearchBox


selgius7

2014-12-22 17:21:22

EDIT: Final script attached.




So I'm trying to make script for this reaction page: LINK

i think its kinda done, but i have question, which command i should use for searchBox measurements ?
im using constant values at the moment and its not so good i guess..
i know that for runescape its MainScreen.GetBounds()
but how about other windows, like browser ? How to get bounds from like select a client tool ? thanks

program reaction;


{$I SRL-6/SRL.simba} // To load the SRL include files
{$I SPS/lib/SPS-RS3.Simba} // To load the SPS include files
var
x, y, Count: Integer;


[COLOR="#FF0000"]const
xs := 0;
ys := 0;
xe := 600;
ye := 500;[/COLOR]


procedure start();
var
start: Integer;
begin
Count := 0;
start := DTMFromString('m6wAAAHic42ZgYEhjZGCIBeIYIC6G4kwgTgHiJCQ2SF0+EOcCcQEU50DVJAJxJxQXAfEkIP7//z8Yn3jwhWHtxfdgnLL8AcOXn38Z7rz5wVC+6QlYvnvvCwZSACMJGAkAAINgJdQ=');
if FindDTM(start, x, y, [COLOR="#FF0000"]xs, ys, xe, ye[/COLOR]) then
Begin
movemouse(x, y);
fastclick(Mouse_left);
freedtm(start);
end
end
procedure KeepGoing();
var
Clock: Integer;
begin
Clock := DTMFromString('mwQAAAHic42RgYHjDyMDwEIi/AzETEwPDESB9GYj/APFvIH4ExAZArATEJkCsAsSngNgKiIOA2BYq////fwa9zqtgDGMj0yBMDGAkAsMBAGckHuo=');
if FindDTM(Clock, x, y, [COLOR="#FF0000"]xs, ys, xe, ye[/COLOR]) then
Begin
fastclick(Mouse_left);
freedtm(Clock);
end
end;

procedure Reaction();
var
zalia: Integer;
begin
zalia := DTMFromString('mAAEAAHic42FgYKhhZGAoBeIUIO4FYhsgPgPEoUCcDcR9QLwYiK2BeDcQHwRicyAWgeLJQJwDxElAXA7EuUCcBsQJQNwPxN63s8D4////YPz93w84GxsmFTCSiJEBAJK+K64=');
If FindDtm(zalia,x, y, [COLOR="#FF0000"]xs, ys, xe, ye[/COLOR]) Then
Begin
fastclick(Mouse_left);
FreeDtm(zalia);
Count := Count + 1;
WriteLn(+ inttostr(Count));
end
end;



// main loop
begin
ClearDebug();
start();
Reaction();
Repeat
KeepGoing();
Reaction();
Until(Count > 4);
end.

akarigar

2014-12-22 17:55:27

From: selgius7
…


Make sure to select your client!


var w, h: integer;
begin
GetClientDimensions(w, h);
WriteLn(w, 'x', h);
end.

Camel

2014-12-22 18:02:12


I managed 4th place after a few tries.

I would just use FindColor() instead of dtms though.

selgius7

2014-12-22 18:09:41

@akarigar;
Thanks…
btw, how do u remember all these commands and includes…. ?
is there any repository or something ?
@Camel;
but i think it would fail at start, because colours of header ant wholescreen are the same

Turpinator

2014-12-22 18:12:21

Just a quick thing…
program Reaction;
begin
repeat
if getcolor(72, 72) = 7002955 then
begin
MoveMouse(72, 72);
ClickMouse(72, 72, MOUSE_LEFT);
wait(250);
ClickMouse(72, 72, MOUSE_LEFT);
end;
until false;
end.

the game wont accept times less than 100 ms it seems as it knows youre cheating.

akarigar

2014-12-22 18:14:13

From: selgius7
Thanks…
btw, how do u remember all these commands and includes…. ?
is there any repository or something ?


I have used the function before, so I remembered it by memory. However, it's a good idea to search in Simba's function list (View -> Function List) if you're looking for new functions.

If you still can't find what you're looking for, feel free to ask here :)

selgius7

2014-12-22 18:30:25

@akarigar;
wait a second
GetClientDimensions(w, h);

only returns with and height but find dtm need something like tbox like from where it start and where it ends ? any ideas ?

getting
Error: Don't know which overloaded method to call with params (Int32, Int32, Int32, *unknown*) at line 19
at this line:
   if FindDTm(start, x, y, GetClientDimensions(w, h)) then

Turpinator

2014-12-22 18:43:32

From: selgius7
@akarigar;
wait a second
GetClientDimensions(w, h);

only returns with and height but find dtm need something like tbox like from where it start and where it ends ? any ideas ?

getting
Error: Don't know which overloaded method to call with params (Int32, Int32, Int32, *unknown*) at line 19
at this line:
   if FindDTm(start, x, y, GetClientDimensions(w, h)) then


GetClientDimensions(w, h); stores the dimensions in variables w and h.
so you will need to do GetClientDimensions(w, h); prior, and then
if FindDTm(start, x, y, 0, 0, w-1, h-1) then

(you subtract the 1 because coords start at 0)

akarigar

2014-12-22 18:45:18

From: selgius7
@akarigar;
wait a second
GetClientDimensions(w, h);

only returns with and height but find dtm need something like tbox like from where it start and where it ends ? any ideas ?

getting
Error: Don't know which overloaded method to call with params (Int32, Int32, Int32, *unknown*) at line 19
at this line:
   if FindDTm(start, x, y, GetClientDimensions(w, h)) then


Since you're using srl-6, you can do this:


if findDTM(start, x, y, getClientBounds()) then

Also you can use SIMBA tags instead of CODE to get the proper highlighting.

selgius7

2014-12-22 18:53:14

thanks for helping me out. :duh:

Turpinator

2014-12-22 23:29:07

Just thought i would update this after an evening out at the bar…

lanadekat

2014-12-25 14:04:07

From: Turpinator
Just thought i would update this after an evening out at the bar…


Nice, but pretty useless xD
Lowest average I could get by hand was 219 ms after 5 tries xD scripts are to fast for me :(