SRL Archive - Non-RuneScape Scripts

Need help with autopicker


Amsterdamn

2012-08-17 06:43:06

Okay so this is my first script ever and i have used an auto yakk killer but took out the pickupdrop funtion only. All it does it sit there and does anothing..i get this:

SRL Compiled in 0 msec

this is the script:

program Looter;
{$i SRL/SRL.simba}
var
x,y:Integer;

const
GoldCharm = 4746368;

Procedure Pickupdrop;
begin
if srl_infight = false then
if(FindColorSpiralTolerance(x, y, GoldCharm, MSX1, MSY1, MSX2, MSY2, 5))then
begin Mouse(x, y, 5, 5, true); //If found will Left-Click on the x, y coordinates with a randomness between 5 pixelend
end;
end;

procedure main;
begin
repeat
Pickupdrop;
until(false)
end;
begin
ClearDebug;
SetUpSrl;
ActivateClient;
main;
end.

stuartroad

2012-08-17 06:59:06

is the colour right? you might need to update it, this is for a private server right?

I dont really understand, are you wanting an auto fighter, or auto looter?

The Killer

2012-08-17 07:00:17

put simba tags around it to start, makes it much easier to read. also shouldn't
ClearDebug;
SetUpSrl;
ActivateClient;
be at the top of the mainloop?

Amsterdamn

2012-08-17 07:44:19

yeah the colour is right and its for a private server. i just want an autolooter, just to pick up charms off the floor

riwu

2012-08-17 08:44:17

is 'srl_infight' working properly for your PS? maybe you can add some debugs like:
if not srl_infight then
begin
writeln('not fighting..finding color...');
if (FindColorSpiralTolerance(x, y, GoldCharm, MSX1, MSY1, MSX2, MSY2, 5)) then
begin
writeln('found color!');
Mouse(x, y, 5, 5, true);
end;

Amsterdamn

2012-08-17 09:10:50

the mouse still doesnt move, and the private server is soulsplit

riwu

2012-08-17 09:21:34

What the debug says? Also private servers may have different client dimensions etc so global constants like MSX1 may not be accurate. You should get the coordinates manually urself. And also you should call SRL_EnableNavBar after SetupSRL to nullify the 50 y-coordinate change due to nav bar on the official client.

Footy

2012-08-17 09:21:36

Does it say color found? Also, setupSRL goes at the top before your procedures.

Amsterdamn

2012-08-17 09:45:56

Doesnt say anything about colour found. Now when i click play it waits a few seconds then just stops. And i've edited the script with all your feedback. This is what it looks like now:

program Looter;
{$i SRL/SRL.simba}
var
x,y:Integer;

const
GoldCharm = 4746368;

begin
ClearDebug;
SetUpSrl;
SRL_EnableNavBar;
ActivateClient;
end.
Procedure Pickupdrop;
begin
if srl_infight = false then
if(FindColorSpiralTolerance(x, y, GoldCharm, 5, 5, 514, 333, 5))then
begin Mouse(x, y, 5, 5, true); //If found will Left-Click on the x, y coordinates with a randomness between 5 pixelend
end;
end;

procedure main;
begin
repeat
Pickupdrop;
until(false)
end;


VastlySuperior

2012-08-17 09:46:14

This Should Work if your coordinates are correct. I deduct that you use this in the browser. you should give the focus to the browser by clickdraging the green cross hairs onto the browser where the client window is open so that srl can know where to send the commands. Otherwise it will do nothing

program Looter;
{$i SRL/SRL.simba}
const
GoldCharm = 4746368;

var
x,y:Integer;

Procedure Pickupdrop;
begin
if srl_infight = false then
if(FindColorSpiralTolerance(x, y, GoldCharm, MSX1, MSY1, MSX2, MSY2, 5))then
begin
Mouse(x, y, 5, 5, true); //If found will Left-Click on the x, y coordinates with a randomness between 5 pixelend
end;
end;

procedure main;
begin
repeat
Pickupdrop;
until(false)
end;
begin
ClearDebug;
SetUpSrl;
SRL_EnableNavBar; // Added for offset for new navbar at the top, otherwise it will get the wrong coordinates
ActivateClient;
main;
end.

Footy

2012-08-17 09:50:09

From: Amsterdamn
Doesnt say anything about colour found. Now when i click play it waits a few seconds then just stops. And i've edited the script with all your feedback. This is what it looks like now:

program Looter;
{$i SRL/SRL.simba}
var
x,y:Integer;

const
GoldCharm = 4746368;

begin
ClearDebug;
SetUpSrl;
SRL_EnableNavBar;
ActivateClient;
end.
Procedure Pickupdrop;
begin
if srl_infight = false then
if(FindColorSpiralTolerance(x, y, GoldCharm, 5, 5, 514, 333, 5))then
begin Mouse(x, y, 5, 5, true); //If found will Left-Click on the x, y coordinates with a randomness between 5 pixelend
end;
end;

procedure main;
begin
repeat
Pickupdrop;
until(false)
end;



Alright, ill teach you a few things about pascalscript.
1. The main loop is the only thing that actually runs. None of the other stuff matters if its not in the main loop. Your main loop is the begin..end.(notice the fullstop(period) after the end rather then a semicolon.)
2. The main loop ALWAYS goes at the end of the script. Never at the beginning.
3. Make all your procedures/functions before the main loop, then call them in the main loop, by calling their name, followed by a semicolon in the main loop.
Any more questions, feel free to ask.
E: looking at your script, it looks like you are coming from java. In pascalscript, there are no main methods, but in stead, a main loop. The main loop is pretty much the same as a main mehod, except they go at the end of the script.

Amsterdamn

2012-08-17 10:04:40

It has now completely worked, but due to the monster being a similar colour to the item, it kept clicking the monster and i tried it at another place but the surroundings had similar colour so it kept clicking on them. so i have to try and find a different source of colour. But to everyone who commented on this post, thank you so much, all your feedback helped me alot!!

Footy

2012-08-17 10:08:30

try using TPA's, and moving your mouse to various points in the TPA until the uptext matches the charms uptext.

Amsterdamn

2012-08-17 10:27:47

I haven't learnt how to use TPA's yet but i just want to ask, is there a way i can make it to attack the monster, then pick up the charm then repeat because the monster respawns fast and eachtime it keeps trying to click both the loot and the monster.

Footy

2012-08-17 10:33:42

repeat
killmonsterprocedure
pickupcharmsprocedure
until(false);
Like that? Try ACA to find the monster, its really easy to use, just watch Yohojo's vid tut.

Amsterdamn

2012-08-17 10:44:53

Ive already got it to repeat and its already found the monster well, but i want it to finish one procedure first instead of going to the next, because what it does is that it kills the yak, goes for the loot but at the same time clicks the other yak, so its trying to get the loot and kill the yak at the same time.

Footy

2012-08-17 11:08:06

add something like

While (SRL_infight) do
wait(randomrange(200, 500));
To your fighting procedure.

Peanuts

2012-08-17 12:30:41

You need to put some waits in.

program CharmCollector;

procedure killmonster;
begin
clickcolor(50, 340, true);
repeat
wait(300);
until(not SRL_Infight)
end;

procedure LootCharm;
//
//
//

begin
repeat
KillMonster;
LootCharm;
Wait(1000); //1000 = 1 second.
until(false)
end.

Amsterdamn

2012-08-17 23:14:04

And another question, when it kills the yak, another item drops with it which means i have to right click it and click gold charm. Is there any way for it to do it automatically?

Peanuts

2012-08-18 02:04:05

Once you have right clicked
Something like WaitOption('harm', 250);
will find the word harm and click it OR wait 250ms thn continue script.

Don't use first letter of the word because it sometimes screws up.