1. ## Scripting Help

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!

2. yes there is way. no problem!

3. Originally Posted by Lipcot
yes there is way. no problem!
do you know how i would go about doing this?

4. Originally Posted by 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.

5. Originally Posted by 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

6. Originally Posted by 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/ma...ab.simba#L2052

7. Originally Posted by 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/ma...ab.simba#L2052
woah thanks for this! if only I knew how to use it... time to do some reading

8. Originally Posted by 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

9. @jstemper;

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

Simba Code:
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

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

10. Originally Posted by rj
@jstemper;

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

Simba Code:
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

Simba Code:
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

11. Originally Posted by 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
Simba Code:
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..

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

12. Originally Posted by KeepBotting
You'd call it like
Simba Code:
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..

Simba Code:
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)

13. Originally Posted by KeepBotting
You'd call it like
Simba Code:
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..

Simba Code:
function getHp():integer;begin  result := strToInt(getSimpleText({blah}));end;
what do you mean by which "charset to use"

14. Originally Posted by 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.
Last edited by KeepBotting; 03-29-2015 at 05:34 PM.

15. Originally Posted by rj
@jstemper;

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

Simba Code:
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

Simba Code:
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

16. Originally Posted by 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

17. Registered User
Join Date
Mar 2011
Posts
22
Mentioned
0 Post(s)
Quoted
9 Post(s)
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.

18. Originally Posted by 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

19. Simba Code:
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) thenbegin 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;BeginrepeatMouseSpeed := 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 20. Registered User Join Date Mar 2011 Posts 22 Mentioned 0 Post(s) Quoted 9 Post(s) Originally Posted by jstemper Simba Code: 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) thenbegin  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;BeginrepeatMouseSpeed := 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

21. Originally Posted by 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

22. Registered User
Join Date
Mar 2011
Posts
22
Mentioned
0 Post(s)
Quoted
9 Post(s)
Originally Posted by 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

23. Originally Posted by 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?

24. Registered User
Join Date
Mar 2011
Posts
22
Mentioned
0 Post(s)
Quoted
9 Post(s)
Originally Posted by 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

25. Originally Posted by 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