SRL Archive - Non-RuneScape Scripts

SoulSplit Powerminer


jcunit

2012-08-27 22:22:52

I am very new to simba and this is my first script. I thought I would make something for a RSPS for starters.

If you are going to use it, then you will have to click on the green target button and drag it onto the client; like this.


Also, try and position your character and camera angle like this.


I would like to make it more complex like making it mine an entire inventory and when the last inventory slot is filled, it drops all of them. Or making it click on the rock from any spot. If someone knows how I could do this then please show me and/or provide me a link to a tutorial or something like that. Thanks.

There is an updated version that you can download if you want to use it… It find's color so you don't need to position your character anymore. Just make sure the adamant rock is in sight and you have a empty inventory. You still need to do the little client thing above. ^^

Source:

program SoulSplitPowerminer;

procedure ClickRock;
begin
MoveMouse(297, 219);
Wait(420);
ClickMouse(297, 219, mouse_Left);
Wait(5750);
end;

procedure DropRock1;
begin
MoveMouse(582, 227);
Wait(300);
ClickMouse(582, 227, mouse_Right);
Wait(400);
end;

procedure DropRock2;
begin
MoveMouse(576, 266);
Wait(400);
ClickMouse(576, 266,mouse_Left);
wait(400);
end;

begin
repeat
ClickRock;
DropRock1;
DropRock2;
until false
end.

P1ng

2012-08-27 22:27:22

Not bad, even though you are writing it for an RSPS I'd still recommend using the SRL include

It could cut this down -
MoveMouse(576, 266);
Wait(400);
ClickMouse(576, 266,mouse_Left);
wait(400);

into Mouse(576, 266, 0, 0, mouse_Left);

Much nicer :)

jcunit

2012-08-27 22:33:30

From: P1ng
Not bad, even though you are writing it for an RSPS I'd still recommend using the SRL include

It could cut this down -
MoveMouse(576, 266);
Wait(400);
ClickMouse(576, 266,mouse_Left);
wait(400);

into Mouse(576, 266, 0, 0, mouse_Left);

Much nicer :)


Thanks for the help! When I add that code for the DropRock2 procedure, it gives me this error:

[Error] C:\Users\jcunit\Desktop\powerminer.simba(22:3): Unknown identifier 'Mouse' at line 21
Compiling failed.

Is this because of my SRL?

P1ng

2012-08-27 22:34:53

Not bad, even though you are writing it for an RSPS I'd still recommend using the SRL include

It could cut this down -
MoveMouse(576, 266);
Wait(400);
ClickMouse(576, 266,mouse_Left);
wait(400);

into Mouse(576. 266, 0, 0, mouse_Left);

Much nicer :)

jcunit

2012-08-27 22:37:20

You just posted the same thing?

Footy

2012-08-27 22:37:22

Did you add {$i SRL/SRL.simba} to the beginning of your script, just after program name? Also add setupSRL to the beginning of your main loop.

jcunit

2012-08-27 22:51:42

Could someone tell me how I could make simba left/right click on 5927257 (the color of adamant ore). Or how I could make simba check if the last inventory spot has some ore in it, then it start's to drop it. Sorry for asking this but the tutorial's on this forum are too slow for me, I get off-task very easily and I can never follow them.

P1ng

2012-08-28 04:35:36

Check out the FindColor function and the mouse function which I put in my earlier post.

Something like -
if FindColor(..) then
Mouse(x, y, 0, 0, mouse_Left);

jcunit

2012-08-28 07:48:55

So it would be:

FindColor(5927257);
Mouse(x, y, 0, 0, mouse_Left);

EDIT: I need a variable, what would that be?

P1ng

2012-08-28 19:32:47

I'll give you a quick rundown on each of those functions and how would would use them to find a colour and click on it :)

FindColor - In my opinion, best used in conjunction with an if..then statement because that way you can designate that it only clicks if it indeed finds the colour it was looking for.

function FindColor(var x, y, color, xs, ys, xe, ye: Integer): Boolean

Now what this tells us is that the function "FindColor" has a series of variables you need to enter to use it. These variables are all integers and thus if you need to declare them, you will declare them so.

This function returns a boolean(true/false). Therefor it is capable to be used with an if then statement simply by writing "if FindColor(..) then"

variables -
x - co-ordinate with relation to the x-axis where the function will store the position it finds the colour.
y - co-ordinate with relation to the y-axis where the function will store the position it finds the colour.
color - Here is where you will place the number code for the colour you are searching for.
xs - x co-ordinate indicating the start of the search
ys - y co-ordinate indicating the start of the search
xe - x co-ordinate indicating the end of the search
ye - y co-ordinate indicating the end of the search

So let's say I want to find the colour 131072 in side a 100x100px box starting at the point 250, 50. My FindColor function would look like this -
"FindColor(x, y, 131072, 250, 50, 350, 150);"

Now as I said earlier if then statements are good to use with this function. Also, you will need to declare the x and y co-ordinates as integers for your procedure.

Now we want to click on it, right? That's where the Mouse function comes in.
It will move the mouse to set co-ordinates with input randomness and either leftclick or rightclick.

Note: MMouse has the ability to do the same only without the clicking ability.

function Mouse(var x, y, rx, ry: Integer; button: Variant);

x - x co-ordinate to move the mouse to
y - y co-ordinate to move the mouse to
rx - randomness to add to the x-axis
ry - randomness to add to the y-axis
button - left/right click

So in the previous function (FindColor) we found the colour and stored the co-ordinates of where it was in the variables x and y.

This means that we want to move our mouse to those co-ordinates so that we can click on whatever is at that colour.

The first part of our function will look like this "Mouse(x, y…"

rx and ry allow you to add some randomness to your mouse movements so you are not always clicking in the same spot over and over again. In runescape this lets off big alarm bells to jagex will lead to the banhammer for your account. On some RSPS this works the same, I'm not sure about the one you are using.

Let's pretend it doesn't matter and that you want to click on the exact spot you find that colour.

Our function now looks like this "Mouse(x, y, 0, 0,.."

Now button is a variant, this is a little bit of a tricky one as there are many different ways you can declare what sort of click it will do.
Boolean -False for rightclick. True for leftclick
Integer - 0 for rightclick. 1 for leftclick
Constants - mouse_Left or mouse_Right

Now which version of button you use is completely up to you and your preferences, mine are the constants but, whatever works and makes sense for you is best.

Finally that line will look like this "Mouse(x, y, 0, 0, mouse_Left);"

And our completed procedure to find the colour and if we find it click on it looks like:

procedure ClickMyColour;
var
x, y: Integer;
begin
if FindColor(x, y, 131072, 250, 50, 350, 150) then
Mouse(x, y, 0, 0, mouse_Left);
end;[SIMBA]

There are also many other variations such as FindColors, FindColorTolerance, FindColorsToleranceSpiral, WaitFindColor and so on, I won't go into these but now that you have the jist of what's going on with the FindColor function, working out these others shouldn't be too hard :)

Happy scripting.

jcunit

2012-08-28 20:21:16

Wow! You just put a guide in this thread. Thanks a lot this will be VERY useful. You can learn a lot by observing other people's script's.

Divus

2012-08-28 21:43:04

jcunit if u feel up to the challenge, wouldn't u make more money by having it alch the ores then instead of dropping them? That might be a useful feature to consider adding

jcunit

2012-08-28 22:39:16

From: Divus
jcunit if u feel up to the challenge, wouldn't u make more money by having it alch the ores then instead of dropping them? That might be a useful feature to consider adding


EDIT: I fixed it, my error was quite stupid… I made a script with alching support.

Have you inventory setup like this:


And press the green target button and drag it onto the middle of the DESKTOP CLIENT:


Then press play and it should work. If it doesn't find the rock at first, you might have to refresh it and find another addy rock color. Here are a few:

5729367
5532244
5927514

P1ng

2012-08-28 23:29:37

You should look into using FindColorTolerance if it is failing to find the addy rock for that reason. Best bet would be looking into CTS2 and the use of ACA to get the colour, tolerance and modifiers. But if you feel that's a bit advanced for you just try FindColorTolerance with a reasonable tolerance ~10 or so and then the user won't need to pick their own :)

jcunit

2012-08-29 05:27:42

From: P1ng
You should look into using FindColorTolerance if it is failing to find the addy rock for that reason. Best bet would be looking into CTS2 and the use of ACA to get the colour, tolerance and modifiers. But if you feel that's a bit advanced for you just try FindColorTolerance with a reasonable tolerance ~10 or so and then the user won't need to pick their own :)


I will update it with this.

Toby1

2012-08-29 12:03:50


procedure ClickRock;
begin
MoveMouse(297, 219);
Wait(420);
ClickMouse(297, 219, mouse_Left);
Wait(5750);
end;

So the script clicks on the rock by X,Y coordinates? I dont think this is the best way to click on the rock as peoples camera angles may be different. I'd recommend using the FindColor function, so it searches for the rock color. Then clicks! :D

http://docs.villavu.com/simba/scriptref/colourfinding.html?highlight=findcolor

Example:

var
X,Y: Integer;

procedure ClickRock;
begin
if (FindColorSpiral(X, Y, ROCK COLOR!, X1, X2, Y1, Y2)) then
begin
MoveMouse(X, Y);
GetMousePos(X, Y);
ClickMouse(X, Y, mouse_left);
end;
end;

jcunit

2012-08-29 21:28:11

From: Toby1

procedure ClickRock;
begin
MoveMouse(297, 219);
Wait(420);
ClickMouse(297, 219, mouse_Left);
Wait(5750);
end;

So the script clicks on the rock by X,Y coordinates? I dont think this is the best way to click on the rock as peoples camera angles may be different. I'd recommend using the FindColor function, so it searches for the rock color. Then clicks! :D

http://docs.villavu.com/simba/scriptref/colourfinding.html?highlight=findcolor

Example:

var
X,Y: Integer;

procedure ClickRock;
begin
if (FindColorSpiral(X, Y, ROCK COLOR!, X1, X2, Y1, Y2)) then
begin
MoveMouse(X, Y);
GetMousePos(X, Y);
ClickMouse(X, Y, mouse_left);
end;
end;


Thanks!

If you are willing to help me with one more thing… :redface:

Since X and Y are local variables, do I have to type -
var x,y:integer
- every time I want to use FindColor in a procedure? Or do I only have to declare it once?

Toby1

2012-08-30 06:35:23

If you always have

var x,y: Integer

At the top of your script (global variable), then you can make other findcolor procedures searching x and y. :)

global variable - at top of the script.

local variable - INSIDE the procedure. And can only be used in the procedure!

jcunit

2012-08-30 17:11:36

From: Toby1
If you always have

var x,y: Integer

At the top of your script (global variable), then you can make other findcolor procedures searching x and y. :)

global variable - at top of the script.

local variable - INSIDE the procedure. And can only be used in the procedure!


ACTUALLY when I do this, the x, y variables keep the first value… so both procedure's click in the same spot. So I tried declaring the variables twice in both procedure's but the second procedure clicks the edge of the selected client. If your confused I can just make a video to show you.

Toby1

2012-08-30 21:52:18

From: jcunit
ACTUALLY when I do this, the x, y variables keep the first value… so both procedure's click in the same spot. So I tried declaring the variables twice in both procedure's but the second procedure clicks the edge of the selected client. If your confused I can just make a video to show you.


OH as in they keep the same value integer(x,y) after one click? hmm il have to check this out for you.

firevenge007

2012-08-31 02:07:53

it's kind of irritating me that it only click the top of your inventory and not on the rock, but it looks like it has lots of potential!

jcunit

2012-08-31 17:47:47

From: firevenge007
it's kind of irritating me that it only click the top of your inventory and not on the rock, but it looks like it has lots of potential!

Try and get a different color code for the script… or just replace the FindColor with:

FindColorTolerance(x, y, COLOR, msx1, msy1, msx2, msy2, 5)

Replace COLOR with the code from the rock…