Page 1 of 2 12 LastLast
Results 1 to 25 of 27

Thread: Scripting Help

  1. #1
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default 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. #2
    Join Date
    Mar 2013
    Location
    Argentina
    Posts
    758
    Mentioned
    27 Post(s)
    Quoted
    365 Post(s)

    Default

    yes there is way. no problem!
    Formerly known as Undorak7

  3. #3
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

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

  4. #4
    Join Date
    Jun 2014
    Location
    Oklahoma
    Posts
    336
    Mentioned
    22 Post(s)
    Quoted
    231 Post(s)

    Default

    Quote Originally Posted by jstemper View Post
    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. #5
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    Quote Originally Posted by Camel View Post
    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. #6
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Quote Originally Posted by jstemper View Post
    , 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
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  7. #7
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    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. #8
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Quote Originally Posted by jstemper View Post
    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
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  9. #9
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    @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. #10
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    Quote Originally Posted by rj View Post
    @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. #11
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Quote Originally Posted by jstemper View Post
    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;
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  12. #12
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    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. #13
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    Quote Originally Posted by KeepBotting View Post
    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. #14
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Quote Originally Posted by jstemper View Post
    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.
    GitLab projects | Simba 1.4 | Find me on IRC or Discord | ScapeRune scripts | Come play bot ScapeRune!

    <BenLand100> we're just in the transitional phase where society reclassifies guns as Badâ„¢ before everyone gets laser pistols

  15. #15
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    Quote Originally Posted by rj View Post
    @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. #16
    Join Date
    Sep 2010
    Posts
    5,762
    Mentioned
    136 Post(s)
    Quoted
    2739 Post(s)

    Default

    Quote Originally Posted by jstemper View Post
    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. #17
    Join Date
    Mar 2011
    Posts
    22
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    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. #18
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    Quote Originally Posted by The_Prince View Post
    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. #19
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    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) 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

  20. #20
    Join Date
    Mar 2011
    Posts
    22
    Mentioned
    0 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by jstemper View Post
    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) 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

  21. #21
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

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

    Default

    Quote Originally Posted by jstemper View Post
    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. #23
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

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

    Default

    Quote Originally Posted by jstemper View Post
    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. #25
    Join Date
    Jun 2013
    Location
    Scranton
    Posts
    496
    Mentioned
    5 Post(s)
    Quoted
    220 Post(s)

    Default

    Quote Originally Posted by The_Prince View Post
    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

Page 1 of 2 12 LastLast

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •