Results 1 to 13 of 13

Thread: New functions I made

  1. #1
    Join Date
    Feb 2006
    Location
    Australia
    Posts
    628
    Mentioned
    15 Post(s)
    Quoted
    105 Post(s)

    Default New functions I made

    I love SRL, but some of the functions just won't cut it.
    This first one looks for the colour of the hits in combat (the red and blue symbols) within 100 pixels of the mscx and mscy.
    Code:
    Function Findhits : Boolean;
    var
      a, x, y : Integer;
    begin
      a:= getsystemtime;
      repeat
        wait(20 + random(20));
        if(FindColorTolerance(x, y, 192, 3, 3, 515, 336, 1) or FindColorTolerance(x, y, 167728128, 3, 3, 515, 336, 1))then
        if(x < 305) and (x > 205) and (y < 216) and (y > 116)then
          result:= True;
      until(result = True) or ((getsystemtime - a) > (1000 + random(500)))
    end;
    It has to wait 1-1.5 seconds though, so you best use it in conjuction with eating:
    Code:
    Function Findhitsandeat : Boolean;
    var
      a, x, y : Integer;
    begin
      a:= getsystemtime;
      repeat
        wait(20 + random(20));
        if(HpPercent < 50)then
        begin
          if(InvCount > 0)then
          begin
            repeat
              Eat;
            until(HpPercent > 85)
          end else
            Escape;
        end;
        if(FindColorTolerance(x, y, 192, 3, 3, 515, 336, 1) or FindColorTolerance(x, y, 167728128, 3, 3, 515, 336, 1))then
        if(x < 305) and (x > 205) and (y < 216) and (y > 116)then
          result:= True;
      until(result = True) or ((getsystemtime - a) > (1000 + random(500)))
    end;
    Burying bones
    Yeah I know there is a new random, this is just good.
    Code:
    procedure DoBones;
    begin
      bonebmp := BitmapFromString(27, 20, 'z78DACD55D18EE3200CFC254' +
           '2626C3FDA06FEFF93CEC559295136DDF4D2DE6D90AC1642187B66' +
           '0C94A52E196EC4F478A68870FB6BEF8D81AA529D6B962659F211E' +
           '7FF45BE22EC55ABAA48971E3373CA29167D359998FC4B9C5B4E23' +
           '366AD0C0B2B2D276BE629DEAA4A659BFD9F53954552A54B06EE40' +
           '3FC7C8BEA05CB3E99E9ABB65C7DB3BF952C297A21551626266AB4' +
           'D0F22ACE638EDB6866E0C3CFF101E28FFFC878BA6BC772759D121' +
           '752526C58B014840E3B3D5CC1164CADF519785C5A8B2E9219B960' +
           '2A5428E211C9316E6B18199D657105E116672F9E1CD4D9315A645' +
           'AE0017CC772F39339EA79E65CCF3359DF623BCBE5EFF4A6E49AAA' +
           '67AC757E8CE06E54BA1EEB13393E57CEF3F843F7D8F48723773B8' +
           'F8C5CBCA49973E821566346270181F04838DA6675BB8477E24D77' +
           '52B316EA8A5DC83861BA82F3C8C58A707495389D1BCF3CBB07264' +
           'A2BFB6A8BCDAC9C38C9C4C0208585F991B2A415F3603F3A80762D' +
           'FE7F64F7AA4ACF564FFD3E2A23E2A8DB7536A3B611792121BEEEF' +
           '1E771E7D9B853467D9EFBE2CCF5CCD4A9BDDA85AE77CE50DAB657' +
           'BFFAFD3B5DE81B1F8DBBCCF58D56C2CBD139EF7FFFCEDE1DC2E1B' +
           'EF52ECB825208D050DFA59FF7DED1E1534A4848BF07E11667F410' +
           '62ECD87E1BC2F72AFCD3F1D3D8FE0087C3AEDF');
        repeat
          FindItemBmpTol(bonebmp, 20)
          MMouse((x + 6), (y + 6), 2, 2);
          wait(50 + random(50));
          GetMousePos(x, y);
          Mouse(x, y, 0, 0, True);
          wait(50 + random(50));
        until(not(FindItemBmpTol(bonebmp, 20)))
      FreeBitMap(bonebmp);
    end;
    Any criticism is welcomed

  2. #2
    Join Date
    Feb 2006
    Location
    Amsterdam
    Posts
    6,136
    Mentioned
    28 Post(s)
    Quoted
    17 Post(s)

    Default

    well....

    FindHits is ok, me thinks. Check for the Green too.... 100*100, isnt that a bit too much?

    BonesBurier:

    Your bitmap is waaay to big. I use 3*3 BM from the centre of the bone. Dont use any background (Haven't looked though, I will look at it tonight....)

    And if you want to bury all, you just do a call to ClickAllItemsBMPTolWait(BoneBMP,'bury',.......) (or something like that....)


    works.

    Good thinking KM!

    P.S.
    I will post my CowKiller/Hide- and MeatCollecto/Banker/ BoneBurier/Meat Cooker one of these days here....(Still need to stableize the cooking...)
    SRL is a Library of routines made by the SRL community written for the Program Simba.
    We produce Scripts for the game Runescape.

  3. #3
    Join Date
    Feb 2006
    Location
    Australia, NSW.
    Posts
    1,461
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Agreed with Fakawi, that bitmap needs some dimension altering.

    And with your FindHits, i'm sure i made one that does the same thing in the Fighter.scar file.
    Or they could be different, Mine results as true if in a fight. Not if another player is.

    Thanks for submitting.

  4. #4
    Join Date
    Feb 2006
    Posts
    1,022
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes, don't include any background.

    Have a look at the attachment to see the picture.

  5. #5
    Join Date
    Feb 2006
    Location
    New Zealand
    Posts
    1,330
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Btw while making my autogighter i cam up with a few hitches while making it find hits. Your player is never in the perfect center 100% of time infact i think it changes everytime you log in. With 100 - 100 it will find people fighting next to you but if your off center it will work. Its one of those things. Too little search it wont find it when your off center. too much and youll wait for the person next to you to end there fight

  6. #6
    Join Date
    Feb 2006
    Location
    Australia, NSW.
    Posts
    1,461
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default



    <3 'Cause i'm nice.

  7. #7
    Join Date
    Feb 2006
    Posts
    582
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Code:
    bones1xy := BitmapFromString(24, 1, 'z78DA3330201B18BA58B81' + 
           '8BB1839BA3A1A391A414430D5906A2800D5401B99');
    <3 'Cause I'm nicer.

  8. #8
    Join Date
    Feb 2006
    Location
    Australia, NSW.
    Posts
    1,461
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Code:
    procedure DoBones;
    begin
    bonebmp := BitmapFromString(24, 1, 'z78DA3330201B18BA58B81' +
           '8BB1839BA3A1A391A414430D5906A2800D5401B99');
        repeat
          FindItemBmpTol(bonebmp, 20)
          MMouse((x + 6), (y + 6), 2, 2);
          wait(50 + random(50));
          GetMousePos(x, y);
          Mouse(x, y, 0, 0, True);
          wait(50 + random(50));
        until(not(FindItemBmpTol(bonebmp, 20)))
      FreeBitMap(bonebmp);
    end;
    <3 'Cause i'm the nicest.

    Edit: Pwnd, that's the wrong Bitmap.. This is what i, suprisingly, got. :s
    Code:
      bones1xy := BitmapFromString(24, 17, 'z78DAC555ED8E02210C7C' + 
           '256081B63FFB01EFFF4857E99A68F6347B7A77424214C14EA7332' + 
           '5A5974736B4CD0A0F2E5C62E77826FDDFC8364D4C8479F23C44CF' + 
           '969495FF1855BE5D078E369A1621C1DB7D03CB9645A54839DEFA2' + 
           'D0CC6D6ACE954F4D93C9A0633512FDF2CB84737B26AD54F254D02' + 
           '4E92702524C48115EB0954F9D1AAAACDA7FFABCFC63EFC4381F2F' + 
           '4D6B55EE6FA42EA282830A043EFD0669BCFF104E77BEE2BBA4BA2' + 
           '4AE542401D52C78EB19EE67CE727F0BF54AF3CBB036FB639228D2' + 
           'C7ABBC0BCABD7F038145C3D72936795741E90BCA81341D7823DE2' + 
           '7FD2654615168BC79339327AAE8113EB1987E63B252FE44E57A11' + 
           '2958D5F634732376EA1E470996EE2A20E85C749D7FBD0113A895B' + 
           '4090219DEE60397C1DB168D0469B2B3563DAEB285A7523A144893' + 
           '3356ADC89892E0972DA11AE3A862B654AF7EF2B9737BAC1771E5C' + 
           '59333BC671BE2EC15BAC549191DED7DBDE9F57EEAF65478413C79' + 
           '93E70869F50C86D277CBBE7FF848DF50AB80A417BF82B3AD5BFBF' + 
           '9B573CCB11FB2B5018B8630305F9109E3B6EC33B9800013F8A674' + 
           '7152E468209E377F17C015745EB41');
    It's still huge. Argh! Krazy, ever concidered colours? =o

  9. #9
    Join Date
    Feb 2006
    Location
    Pennsylvania
    Posts
    1,524
    Mentioned
    2 Post(s)
    Quoted
    1 Post(s)

    Default

    Ever considered a DTM?

  10. #10
    Join Date
    Feb 2006
    Location
    Australia, NSW.
    Posts
    1,461
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Bebemycat2
    Ever considered a DTM?
    Oh yes Krazy, You gotta' use a DTM. 'Cause if you don't i'll get Sdcit to raporz you. ^^;;

  11. #11
    Join Date
    Feb 2006
    Location
    Australia
    Posts
    628
    Mentioned
    15 Post(s)
    Quoted
    105 Post(s)

    Default

    I should learn how to use DTM's I guess, the DTM editor just seems so scary
    I had no idea how to get rid of the background on a bmp.. I was going to ask someone but nobody was on msn I just used a common background colour and it still sort of works, I'll give that tiny bmp a go 1st, I suspect it's 3*3 pixels or something XD Ah well... Thanks for the advice and help guys. Pyro is right about the 100*100 search, I noticed the place goes about that far from the centre. I wasn't quite sure that people would be fighting that close to each other, the thought never occured. Perhaps something in SRL to track our player's position or something..

  12. #12
    Join Date
    Feb 2006
    Location
    Las Vegas, NV
    Posts
    939
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    krazy, ill get on msn if you want and ill explain how to get rid of the backround

    bebe... you need to teach me and krazy how to use dtms.. lol.. im still clueless on em
    Busy with real life. I'll still be around occasionally.
    Current Mood:


  13. #13
    Join Date
    Feb 2006
    Location
    Australia, NSW.
    Posts
    1,461
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    You just select the client, open the dtm editor and click on the colors of the bones. Don't worry about the lines that much, they hardly change anything. Then go to File > DTM To Text > Close the window, And there's your dtm in the debug box.

    Then declare it like you would a bitmap, and instead of FindBitmap use FindDTM

    That's a pretty crap tutorial, lol. If you need more help, ask on msn. (I'll help when i'm not busy )

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Two Math Functions I made.
    By Sandstorm in forum Research & Development Lounge
    Replies: 30
    Last Post: 01-21-2009, 03:52 PM
  2. Couple Functions I've made [IsMultiple, ReverseString, FormatNumber]
    By deathbyvirus in forum Research & Development Lounge
    Replies: 4
    Last Post: 08-06-2008, 10:56 PM
  3. While SRL down I made 2 functions just to post em :)
    By n3ss3s in forum Research & Development Lounge
    Replies: 11
    Last Post: 10-14-2007, 09:57 AM

Posting Permissions

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