SRL Archive - RuneScape Private-Server Scripts

Scripting Help


jstemper

2015-03-11 22:47:24

So I made an extremely simple script that clicks different food in my inventory, but I was wondering if there is a way to get the script to click the food at, or lower, than a certain hp level. This is for soulsplit. Thanks!

Lipcot

2015-03-11 23:10:29

yes there is way. no problem!

jstemper

2015-03-12 20:27:03

From: Lipcot
yes there is way. no problem!
do you know how i would go about doing this?

Camel

2015-03-12 20:49:55

From: jstemper
do you know how i would go about doing this?


Take a picture of your UI on this server.

That way people can see exactly what you're trying to do.

jstemper

2015-03-13 20:06:31

From: Camel
Take a picture of your UI on this server.

That way people can see exactly what you're trying to do.


, I just need to figure out how to sip a brew, once I reach a certain hp level

KeepBotting

2015-03-13 20:16:19

From: jstemper
, I just need to figure out how to sip a brew, once I reach a certain hp level


You'd use a DTM, and click it. For detecting HP, SRL-5's GetMMLevels might still work: https://github.com/SRL/SRL-5/blob/master/SRL/core/gametab.simba#L2052

jstemper

2015-03-13 21:05:14

From: KeepBotting
You'd use a DTM, and click it. For detecting HP, SRL-5's GetMMLevels might still work: https://github.com/SRL/SRL-5/blob/master/SRL/core/gametab.simba#L2052


woah thanks for this! if only I knew how to use it… time to do some reading

KeepBotting

2015-03-13 21:06:21

From: jstemper
woah thanks for this! if only I knew how to use it… time to do some reading


For DTM's, I'd recommend YoHoJo's tutorial here: https://villavu.com/forum/showthread.php?t=68018

For the GetMMLevels function, you can probably just copy it over, read the documentation to ensure you know what's needed to use it

rj

2015-03-14 16:15:38

@jstemper;

I use this for basic text functions when I script for RSPSs:

function getSimpleText(Colors:TIntegerArray;x1, y1, x2, y2:integer;font:string):String;
var
textTPA:TPointArray;
textATPA, textATPAS:T2DPointArray;
i:integer;
textStr:string;
begin
setLength(textATPAS, length(colors));
for i := 0 to high(colors) do
findColors(textATPAS[i], Colors[i], x1, y1, x2, y2);
textTPA := mergeATPA(textATPAS);
textATPA := SplitTPAEx(textTPA, 1, 10);
filtertpasbetween(textatpa, 0, 1);
SortATPAFromFirstPointX(textATPA, Point(0, 0));
result := getTextATPA(textATPA, 3, font);
end;


Example

getSimpleText([colors], x1, y1, x2, y2, 'upchars07');

jstemper

2015-03-29 11:51:21

From: rj
@jstemper;

I use this for basic text functions when I script for RSPSs:

function getSimpleText(Colors:TIntegerArray;x1, y1, x2, y2:integer;font:string):String;
var
textTPA:TPointArray;
textATPA, textATPAS:T2DPointArray;
i:integer;
textStr:string;
begin
setLength(textATPAS, length(colors));
for i := 0 to high(colors) do
findColors(textATPAS[i], Colors[i], x1, y1, x2, y2);
textTPA := mergeATPA(textATPAS);
textATPA := SplitTPAEx(textTPA, 1, 10);
filtertpasbetween(textatpa, 0, 1);
SortATPAFromFirstPointX(textATPA, Point(0, 0));
result := getTextATPA(textATPA, 3, font);
end;


Example

getSimpleText([colors], x1, y1, x2, y2, 'upchars07');


honestly i'm new to this and have no idea how i could apply that to detecting what hp my character is at

KeepBotting

2015-03-29 13:15:04

From: jstemper
honestly i'm new to this and have no idea how i could apply that to detecting what hp my character is at


You'd call it like
getSimpleText({colors of the HP text}, {bounds where you'd find the text}, {which charset to use});

Pretty sure the minimap orbs use StatChars but don't quote me on that

That function would output a string so you could do something like..

function getHp():integer;
begin
result := strToInt(getSimpleText({blah}));
end;

rj

2015-03-29 13:18:00

From: KeepBotting
You'd call it like
getSimpleText({colors of the HP text}, {bounds where you'd find the text}, {which charset to use});

Pretty sure the minimap orbs use StatChars but don't quote me on that

That function would output a string so you could do something like..

function getHp():integer;
begin
result := strToInt(getSimpleText({blah}));
end;


yes exactly like this

except I surround mine with a try catch just incase it returns a string that can't be converted into a int (like l0 or something IDK)

jstemper

2015-03-29 13:29:53

From: KeepBotting
You'd call it like
getSimpleText({colors of the HP text}, {bounds where you'd find the text}, {which charset to use});

Pretty sure the minimap orbs use StatChars but don't quote me on that

That function would output a string so you could do something like..

function getHp():integer;
begin
result := strToInt(getSimpleText({blah}));
end;


what do you mean by which "charset to use"

KeepBotting

2015-03-29 13:31:45

From: jstemper
what do you mean by which "charset to use"


There are several character sets built into Simba, all of which correspond to character sets used in Runescape. You can see them all in C:/Simba/Fonts/.

They're what Simba (or Tesseract, if you're using it) uses for its OCR (Optical Character Recognition).

I'm pretty sure the minimap orbs use the charset called StatChars, but I'm not positive.

jstemper

2015-03-29 22:40:38

From: rj
@jstemper;

I use this for basic text functions when I script for RSPSs:

function getSimpleText(Colors:TIntegerArray;x1, y1, x2, y2:integer;font:string):String;
var
textTPA:TPointArray;
textATPA, textATPAS:T2DPointArray;
i:integer;
textStr:string;
begin
setLength(textATPAS, length(colors));
for i := 0 to high(colors) do
findColors(textATPAS[i], Colors[i], x1, y1, x2, y2);
textTPA := mergeATPA(textATPAS);
textATPA := SplitTPAEx(textTPA, 1, 10);
filtertpasbetween(textatpa, 0, 1);
SortATPAFromFirstPointX(textATPA, Point(0, 0));
result := getTextATPA(textATPA, 3, font);
end;


Example

getSimpleText([colors], x1, y1, x2, y2, 'upchars07');

function getSimpleText(Colors:yellow; 676, 63, 743, 102, StatChars):String;



you are saying this would return something if yellow hp was found on the minimap? or am i missing something

rj

2015-03-29 22:45:18

From: jstemper
function getSimpleText(Colors:yellow; 676, 63, 743, 102, StatChars):String;



you are saying this would return something if yellow hp was found on the minimap? or am i missing something


yes, as long as you put the yellow color in the array

The_Prince

2015-03-30 05:21:33

There is an extremely simple way to do this and how I do it on rsps's. When you start losing hp the color behind the red color that fills the hp area (circle with the heart in it), the color behind that is a dark brown or something like that. So if you want to eat at 50% hp all you need is a function that looks for that dark color at half hp or where ever you want then it eats. If this doesn't make sense I can show a picture.

jstemper

2015-04-02 00:51:46

From: The_Prince
There is an extremely simple way to do this and how I do it on rsps's. When you start losing hp the color behind the red color that fills the hp area (circle with the heart in it), the color behind that is a dark brown or something like that. So if you want to eat at 50% hp all you need is a function that looks for that dark color at half hp or where ever you want then it eats. If this doesn't make sense I can show a picture.


I tried that, and it just spam clicks the brews whether or not it sees that certain hp color

jstemper

2015-04-02 00:54:23

Program DTM;
{$i srl/srl.simba}
var
sarabrew1dose:Integer;

Procedure sip_brews;
var
X,Y:Integer;
begin
if findcolortolerance(x, y, 1649201, 689, 75, 713, 97, 5) then
begin
if FindDTM(sarabrew1dose, x, y, 554, 230, 732, 482) then
begin
mmouse(x, y, 1, 1);
wait(randomrange(100, 200));
clickmouse2(mouse_Left);
wait(randomrange(150, 250));
end;
end;
end;

Begin
repeat
MouseSpeed := 100;
SetUpSRL;
sarabrew1dose := DTMFromString('mWAAAAHicY2FgYHBmYmBwAmIrILYHYmVGBgZpRggtBcTHj3kyZGfnguna2joGdMCIhkEAAJL5B/U=')
sip_brews;
FreeDtm(sarabrew1dose);
until(false)
end.
this code will click a 1-dose brew if it sees it in inv, even though it should only begin if it sees that dark color under the hp minimap right? Can someone tell me if I did this wrong. Also, this is mostly based off of RJ's guide pls i'm new, but I actually want to learn this program well

The_Prince

2015-04-02 01:44:53

From: jstemper
Program DTM;
{$i srl/srl.simba}
var
sarabrew1dose:Integer;

Procedure sip_brews;
var
X,Y:Integer;
begin
if findcolortolerance(x, y, 1649201, 689, 75, 713, 97, 5) then
begin
if FindDTM(sarabrew1dose, x, y, 554, 230, 732, 482) then
begin
mmouse(x, y, 1, 1);
wait(randomrange(100, 200));
clickmouse2(mouse_Left);
wait(randomrange(150, 250));
end;
end;
end;

Begin
repeat
MouseSpeed := 100;
SetUpSRL;
sarabrew1dose := DTMFromString('mWAAAAHicY2FgYHBmYmBwAmIrILYHYmVGBgZpRggtBcTHj3kyZGfnguna2joGdMCIhkEAAJL5B/U=')
sip_brews;
FreeDtm(sarabrew1dose);
until(false)
end.
this code will click a 1-dose brew if it sees it in inv, even though it should only begin if it sees that dark color under the hp minimap right? Can someone tell me if I did this wrong. Also, this is mostly based off of RJ's guide pls i'm new, but I actually want to learn this program well




if findcolortolerance(x, y, 1649201, 689, 75, 713, 97, 5) then

it looks like you're searching the entire hp by minimap you only want to look for 1 pixel or so. A 1x1 pixel box is all you need

jstemper

2015-04-02 01:57:42

From: The_Prince
if findcolortolerance(x, y, 1649201, 689, 75, 713, 97, 5) then

it looks like you're searching the entire hp by minimap you only want to look for 1 pixel or so. A 1x1 pixel box is all you need
no it just searches the hp minimap bar im pretty sure

The_Prince

2015-04-02 02:02:46

From: jstemper
no it just searches the hp minimap bar im pretty sure


689, 75, 713, 97, this is a huge area is 24x22 pixels you want something like


even a smaller box and thats just an example if you wanna eat around 50% hp

jstemper

2015-04-02 02:06:04

From: The_Prince
689, 75, 713, 97, this is a huge area is 24x22 pixels you want something like


even a smaller box and thats just an example if you wanna eat around 50% hp


yeah but that doesn't mean it won't eat under that hp? Maybe i am wrong but won't it only eat that hp exactly?

The_Prince

2015-04-02 02:14:19

From: jstemper
yeah but that doesn't mean it won't eat under that hp? Maybe i am wrong but won't it only eat that hp exactly?


it will eat under that level as well, as long as it sees that color in the box it will eat

jstemper

2015-04-02 02:24:57

From: The_Prince
it will eat under that level as well, as long as it sees that color in the box it will eat


meh, still doesnt work, i tried one with a tiny pixel box, and a medium pixel box

The_Prince

2015-04-02 02:28:21

youre doing something wrong then. I already offered to help do it for you on pm

The Legendary

2015-04-13 13:01:17

You can also use DTM editor to make this function. You know when your hp is low, it changes color from green to yellow to brownish then red? Use the DTM Tool and zoom into the picture then color pick on either the yellow or brownish hp or red hp. Then make it from there. If DTM yellow or brownish or red found then eat. This is the method I did on my fighter script.