SRL Archive - Help

script for a rsps won't click


doxin

2012-12-20 01:12:56

hi so im trying to write a mining script for a 2006 rsps but the bot doesn't seem to click the iron rock. it hovers over every rock but doesn't click. i've tried FindColor and Mouse(x, y, 2, 2, true) and it still won't click. here's the script as of now. I know FindObj probably won't work with the updated SRL but i seriously need help here.. i also wouldnt mind to have a tutor :D pm me for my msn

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

procedure MineIron;
var x, y: integer;

begin
if FindObj(x, y, 'ine', 2371664, 15) then
begin
Mouse(x, y, 2, 2, true);
end;
end;


begin
SetUpSrl;
SetDesktopAsClient
MineIron;

end.

YoHoJo

2012-12-20 01:21:25

That's because the uptext for RSPSs is probably different than the uptext for the real game.
So it's finding the color, but not detecting the text that says 'ine'.

If you show us a screenshot of the uptext of the RSPS maybe someone can identify it for you and you can then use some of SRLs older/archived uptexts to work for it.

doxin

2012-12-20 01:29:48


YoHoJo

2012-12-20 01:33:34

Perfect thanks, I won't be able to ID it though :p, just wait for someone else or you can go to the C:\Simba\Fonts folder and figure it out yourself.

Then you'd want to use something like FindObjEx or FindObjCustom so you can specify the font yourself. After that it should work.

Or if you want to be lazy, you can just make a boolean that looks for the blue color on the top left of the screen make it return true when found, and then just assume that the presence of a blue color is enough to determine a rock is there.

Justin

2012-12-20 01:35:09

Run this and post results:


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

procedure MineIron;
var x, y: integer;

begin
if FindObj(x, y, ' ', 2371664, 15) then
begin
Mouse(x, y, 2, 2, true);
writeln(GetUpText);
TerminateScript;
end;
end;


begin
SetUpSrl;
SetDesktopAsClient
MineIron;

end.

Fascinate

2012-12-20 01:35:25

From: YoHoJo
Perfect thanks, I won't be able to ID it though :p, just wait for someone else or you can go to the C:\Simba\Fonts folder and figure it out yourself.

Then you'd want to use something like FindObjEx or FindObjCustom so you can specify the font yourself. After that it should work.

Or if you want to be lazy, you can just make a boolean that looks for the blue color on the top left of the screen make it return true when found, and then just assume that the presence of a blue color is enough to determine a rock is there.


Always gotta be a lazy man… Booleans ftw! Lol

YoHoJo

2012-12-20 01:37:12

Justin's idea is even lazier and works, I'd assume it'd be good enough for a private server, lolz good one Justin.

Justin

2012-12-20 01:37:53

From: YoHoJo
Justin's idea is even lazier and works, I'd assume it'd be good enough for a private server, lolz good one Justin.


What I was going to do was get the uptext that Simba is returning and put that as the UpText to search for :P

doxin

2012-12-20 01:47:46

these were the results

Compiled successfully in 5488 ms.
SRL Compiled in 31 msec
. . . . . . . . - . . . -
Successfully executed.

btw what was i supposed to wrap it in lol. thanks for all the help btw

EDIT:oh forgot to mention, it didn't click the rock if it matters.
EDIT2: i put in the UpText i got from the debug box into the findobj uptext and it still didn't click the rock ):

Justin

2012-12-20 01:55:25

From: doxin
these were the results

Compiled successfully in 5488 ms.
SRL Compiled in 31 msec
. . . . . . . . - . . . -
Successfully executed.

btw what was i supposed to wrap it in lol. thanks for all the help btw

EDIT:oh forgot to mention, it didn't click the rock if it matters.
EDIT2: i put in the UpText i got from the debug box into the findobj uptext and it still didn't click the rock ):


Okay.. Try to lower the tolerance until it just clicks on the rock

YoHoJo

2012-12-20 01:59:58

Wait what the heck is going on now.
Did http://villavu.com/forum/showpost.php?p=1145695&postcount=5 click the rock?
And why is there is WriteLn Get Up Text? That gets uptext uses RS's current UpText, and we already made it clear the the uptext on the RSPS is not the same as RS's up text, so of course it will return jibberish.

http://villavu.com/forum/showpost.php?p=1145695&postcount=5 Should work, and if not, do what I said about the blue text boolean.

doxin

2012-12-20 02:00:59

so i wanted to know if it can actually find the rock, which it does now with this
program IronMiner;
{$i srl/srl.simba}

procedure MineIron;
var x, y: integer;

begin
if FindObj(x, y, '. . . . . . . . - . . . -', 2371664, 3) then
begin
Writeln('found rock');
Mouse(x, y, 2, 2, true);
end;
end;


begin
SetUpSrl;
SetDesktopAsClient
MineIron;

end.

and i got this
Compiled successfully in 5006 ms.
SRL Compiled in 30 msec
found rock
Successfully executed.

but i am still iron oreless…

EDIT:okay complete backtrack lol. ill be tryin your way yoho. ill try and see if i can just get it to click if it sees the blue color

YoHoJo

2012-12-20 02:02:43

Don't do that (the dot stuffs) I'm sure that might be random/vary each time.

Either forget uptext and just use FindColor (or a TPA/ATPA) or use FindObj and leave the uptext blank (like '') or find what font the uptext is in and use that.

Did it move to the rock, did it click the rock?

Justin

2012-12-20 02:02:46

From: YoHoJo
Wait what the heck is going on now.
Did http://villavu.com/forum/showpost.php?p=1145695&postcount=5 click the rock?
And why is there is WriteLn Get Up Text? That gets uptext uses RS's current UpText, and we already made it clear the the uptext on the RSPS is not the same as RS's up text, so of course it will return jibberish.

http://villavu.com/forum/showpost.php?p=1145695&postcount=5 Should work, and if not, do what I said about the blue text boolean.


Some characters still pick up and work (06scape uptext). Yes it does add random characters but you can put that in the 'search uptext' and it will still work.

doxin

2012-12-20 02:06:57

and just so we don't waste time here.. is this a known bug if i'm on linux running simba through WINE?

Justin

2012-12-20 02:15:31

From: doxin
and just so we don't waste time here.. is this a known bug if i'm on linux running simba through WINE?


Are you able to send me a PM of the RSPS you are playing, I will quickly jump on and help you solve this issue.

I also might later on tonight work on a mini-include for the RSPS.

doxin

2012-12-20 02:26:47

I just created a script that was only supposed to right click and all it did was freeze my mouse. it never even right clicked. whats going on lol

YoHoJo

2012-12-20 02:29:52

Post code.

Justin

2012-12-20 02:29:54

From: doxin
I just created a script that was only supposed to right click and all it did was freeze my mouse. it never even right clicked. whats going on lol


Keep trying, read some tutorials. I will release some scripts on request for the RSPS

doxin

2012-12-20 02:34:19

From: YoHoJo
Post code.


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

procedure RightClick;
var x, y: integer;

begin
ClickMouse2(false)
end;

begin
SetUpSrl;
RightClick;
end.

idk why you wanted to see it lol. it just right clicks. but when i put it into my mining script, it wont right click the rock

YoHoJo

2012-12-20 02:56:44

Add a MMouse(10,10,2,2) before the RightClick and see

Wardancer

2012-12-20 03:01:17

You mean it doesn't click at all wherever you put it if it doesn't click it after the if then statement? As you surely know, if the condition of the if…then statement isn't met then the one following action won't be done. If you're having the issue wherever, it might be because the mouse is in a "non right clickable area". Simply try to move the mouse before right clicking and that should do the trick.

As for the actual issue, I'm somewhat reluctant of giving more ideas as you have a lot to work with already, but I feel like you might be wasting your time with FindObj.

doxin

2012-12-20 03:07:48

From: YoHoJo
Add a MMouse(10,10,2,2) before the RightClick and see


Instead I tried running the rightclicking script again. When i ran it and kept the pointer in simba, it would right click and show me options like select all and copy. however, when i ran the script and hovered it over the rsps webclient on a rock, the script ended without it right clicking. why does it right click everywhere but the rsps screen?

EDIT: sorry for wasting all of your guys' time. i just had an epiphany. because I'm running simba over WINE, i guess it is actually being emulated. that means the script would only work if i could somehow run simba on linux without it going through WINE…

Justin

2012-12-20 03:15:09

From: doxin
Instead I tried running the rightclicking script again. When i ran it and kept the pointer in simba, it would right click and show me options like select all and copy. however, when i ran the script and hovered it over the rsps webclient on a rock, the script ended without it right clicking. why does it right click everywhere but the rsps screen?

EDIT: sorry for wasting all of your guys' time. i just had an epiphany. because I'm running simba over WINE, i guess it is actually being emulated. that means the script would only work if i could somehow run simba on linux without it going through WINE…


Running simba via wine is fine. no problems doing that

doxin

2012-12-20 03:18:49

From: [J]ustin
Running simba via wine is fine. no problems doing that


yeah it runs. but when i ran the right click script via simba on wine and place my pointer on the desktop, it didnt right click. but it right clicks perfectly fine on the simba window. maybe if i run the webclient through WINE?

Justin

2012-12-20 03:22:03

From: doxin
yeah it runs. but when i ran the right click script via simba on wine and place my pointer on the desktop, it didnt right click. but it right clicks perfectly fine on the simba window. maybe if i run the webclient through WINE?


I guess you could install chome\firefox w\e in wine and try the webclient, might improve. Can't really test a solution for you as I am only running W7 currently.

Pukka

2012-12-20 09:36:12

would this work for gem rocks? I'm playing nr oss and to lazy, so looking for scripts or help how to make one just for basic mine and craft.

rj

2012-12-20 12:39:52

I would show you my powerminer for this server but you would not learn so I will guide you through.

1) Use ACA to get good colors and create a TPA. You HAVE to do this or else I will come drop iron ore and troll your bot.(JK but someone else will..)
2) make sure it searches for the rocks on the main screen

Here what my click rock procedure looks like(parts censored so it's not copied)