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

Thread: Help with proggy and finding a color

  1. #1
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default Help with proggy and finding a color

    I need help with:

    1)Make a progress report say how long the scripts been running for
    2)PADR's in progress report (make progress report even and neat)
    3)Searching mini map top to bottom/ searching top half


    --------------------------------------------------------------------------------------------------------------------------------------------


    Progress Report

    How do you make the script tell you how long it's been running, I saw like 2 or 3 things so far, and they didn't work, I tried

    writeln('|This Script Ran For' + TimeRunning + ' |');

    and something else, I think skilld u had in a tut, neither worked. I think there's a string I need after TimeRunning, that says either seconds, minutes, or hours, but I tried doing minutes, it didn't work. Does TimeRunning still work? and I saw in skilld u's tut,

    writeln(PADR('did' inttostr(loads), 49 ' |');

    something like that, I can't get PADR to work, does it still work? if so how would you do PADR's?


    --------------------------------------------------------------------------------------------------------------------------------------------


    Seaching Top Part Of Mini Map

    Also What function would you use to search the mini map from top to bottom for a color? if you cant, then how would you search the top half of the mini map, would you do

    FindColorTolerance(x, y, Color1, MMC1, MMC1, MMX2, MMY2, 15);

    or

    FindColorTolerance(x, y, Color1, MMX1, MMY1, MMC2, MMC2, 15);

    or are they both wrong or does a different code that do it better?



    Any help appreciated.

  2. #2
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    TimeRunning is the correct function to use for your first question. I just waited 60 seconds and had SCAR WriteLn(TimeRunning) and got back "1 Minutes and 0 seconds" (which is the correct output.

    For your third question, you could use FindColorTolerance(x, y, Color, MMX1, MMY1, MMCX, MMCY, 15) I believe.

    I'm not really sure on your second question as I'm not experienced with PadR, so someone else will have to answer that one for you.
    :-)

  3. #3
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    ok, thanks Method, rep+

    I was close with the findcolor, I kinda took an educated guess there, almost had it. so X1 and Y1 is the top coordinates of the mini map? or wow, actually writing the word coordinates made me realize, I could just enter coordinates for it to search in can't I?

    Don't know why TimeRunning isn't working for me, I'll look over what I put down.

  4. #4
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    Yes, you were pretty close. And yes, you can also just input the coordinates of where you want to search also.
    :-)

  5. #5
    Join Date
    Jan 2007
    Location
    Tennessee
    Posts
    642
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Yup TimeRunning should work.
    And for your map searching use RadialWalk.
    You can find tuts on it in the tuts section.
    It is good for searching in a certain section of the map.

  6. #6
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    why would I use radialwalk to search the map? you mean like walk to the spot on the map, then instead of doing

    findcolortolerance(x,y, color, MMX1, MMY1, MMCX, MMCY, 15)

    use

    findcolortolerance(x,y, color, MSX1, MSY1, MSX2, MMY2, 15)

    because I'll already be there?

    and I tried learning radial walk, I didn't really like it, since I don't really have to use it I prefer not to. It's to hard with the angles thing I don't wanna mess up, and it's not a far distance that the character moves around in this script, I'm just using a findcolortolerance for the top half of MM because your character sometimes starts to drift with this script, which isn't really preventable, so I just have it click on a color in the minimap, to move them back.

  7. #7
    Join Date
    Jan 2007
    Location
    Tennessee
    Posts
    642
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Oh if you aren't moving to the spot then just use FindColorTolerance on the whole minimap because it searches from top to bottom already.

  8. #8
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    No, I don't move much, but you slowly drift off from where I would like the characters to be, so I use findcolortolerance to move them back, it only takes one click on the MM. and I wasn't sure if it searched from top to bottom, but I'd still rather only have it search the top half in case for some reason it misses the color on the top half, but spots it on the bottom half.



    Also, I have the proggy working good now, only thing left that I need for it is to figure out how to use PADR, if anyone knows how I would still like to know please.

    EDIT: nevermind, I figured out how to use PADR on my own by comparing N3ss3s tut's example to mine, then changed it a little bit because I had words after the PADR's space. (I'm guessing that's what PADR does, puts in a space)

  9. #9
    Join Date
    Jan 2007
    Location
    Tennessee
    Posts
    642
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    PadL is sort of hard to explain.
    It makes a string a certain length but won't make the string any smaller, it can only add on to it.

    PadL('abcd', 4) will just return 'abcd'
    and anything less then 4 will just return the original string.

    PadL('abcd', 5) will return ' abcd' (one space)
    PadL('abcd', 6) will return ' abcd' (two spaces)

    So to use it for adding spaces to the front of a string do something like
    PadL(TheString, Length(TheString) + SpacesYouWant);

  10. #10
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    I think I get it, but I finally got my script even with PADR, I don't wanna mess it up and change it to PADL and wind up forgetting and losing what I did. but pretty much ABCD is 4 letters, so if I have PADL equal four it doesn't add anything because ABCD already takes up the four. If PADL equals 5 then it adds a space because ABCD is four letters, and it's set to be 5 spaces long. So pretty much to find out how many spaces PADL adds, you do what the number you put after ABCD (or whatever you wanna type), minus how many letters (I'm assuming if you have spaces, they count too) long your string is. Wait, can a string even have spaces? I don't think it can, but I'm not positive, and if not, wouldn't it be better to use PADR because you can have spaces.


    and you said

    PadL('abcd', 6) will return ' abcd' (two spaces)

    So to use it for adding spaces to the front of a string do something like
    PadL(TheString, Length(TheString) + SpacesYouWant);

    I'm looking at just the code part for these two lines:

    PadL('abcd', 6) and
    PadL(TheString, Length(TheString) + SpacesYouWant);

    they dont seem to add up, PadL in the second one is PadL in the first one so now if we take that out we would have,

    ('abcd',6)
    (TheString, Length(TheString) + SpacesYouWant);

    abcd is the string so if we take both of those out we have left

    ,6)
    ,lenght(TheString) + SpacesYouWant);

    6 is the lenght, so then I'm left over with


    + SpacesYouWant);

    they don't add up..... or are you saying that I can put in

    PadL('abcd', 6 + SpacesYouWant)

    so it can be like

    PadL('abcd', 6 + 10)

    to add 10 spaces? but I thought the 6 was adding two spaces? why would you need 10? if you want 10 more spaces you could just add 10 to the 6, and put 16, right?


    EDIT: I was taking part of those two lines together as if it was an algebreic problem in case you were wonderin wtf I was doing, lol.

    if you don't get what I'm saying still I'll show you an example, maybe we don't do algebra the same way, I think for the most part, you should get what I was doing.

  11. #11
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    6 isnt the length though.. 4 is the length of the string. Its pretty simple actually. Subtract the Length(String) from i. And that's how many spaces you will have. Does that help at all?

  12. #12
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    from what he showed me there was no i, but do you mean subtract (using what he put) SpacesYouWant from Length(String)? and if you have 'ABCD' why would you put the lenght is 6? shouldn't you just put 4?

  13. #13
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SpacesYouWant is i.

    Ok, example:

    PadL('ABCD', 6);

    The length of "ABCD" is 4 right? Right.

    If you wanted 2 spaces you would put 6 in the next variable because PadL takes into account the length of the string already. Do you understand what im trying to say?

  14. #14
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    I guess, so to add two spaces to 'ABCD' you can do two things then either:

    1)PadL('ABCD', 6);

    or

    Const

    SpacesYouWant = 2;

    2)PadL('ABCD', 4 + SpacesYouWant);

    (if I'm right, then you could also change the 4 to a 5 and SpacesYouWant to a 1)

    is this correct? if so it makes no sense, why they would make two ways to add spaces (make the length longer then the word in '' or uses i (SpacesYouWant))

  15. #15
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Yes that is correct

  16. #16
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    alright, well I'm just going to keep PADR in my script because I just figured it out the day I posted this thread, took me a while too, and I don't feel like messing up my progress report, but thanks for the help....again lol rep+ to both of you

  17. #17
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    you need to include SRL to use TimeRunning.

    MSX1, MSY1 -> Top left corner of RS (mainscreen)
    MSX2, MSY2 -> Bottom right corner of RS mainscreen
    MIX1, MIY2 -> top left coner of inv
    MIX2, MIY2 -> bottom right corner of inv
    MMX1, MMY1 -> top left corner of MiniMap
    MMX2, MMY2 -> Bottom left corner of minimap
    MSC1, MSC2 -> center of mainscreen
    MMC1, MMC2 -> center of minimap.

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  18. #18
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Awesomesauce. Thanks for the rep. You check that other thread yet?

  19. #19
    Join Date
    Jan 2007
    Location
    Tennessee
    Posts
    642
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    Ya you understand PadL.
    What i was getting at is just a procedure like this-
    SCAR Code:
    var
      i: integer;

    function InsertSpaces(Text: string; Spaces: integer): string;
    begin
      Result:= PadL(Text, Length(Text) + Spaces);
    end;


    begin
      for i:= 1 to 5 do
      WriteLn(InsertSpaces('abcd', i));
    end.

    Try it out with some stuff and it's pretty easy to get.

  20. #20
    Join Date
    Mar 2007
    Posts
    3,042
    Mentioned
    1 Post(s)
    Quoted
    14 Post(s)

    Default

    Quote Originally Posted by Rasta Magician View Post
    MSC1, MSC2 -> center of mainscreen
    MMC1, MMC2 -> center of minimap.
    These are both incorrect. MSCX and MSCY and MMCX and MMCY are the correct center coordinates for the main screen and minimap.
    :-)

  21. #21
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    oh ok so it's basically the exact same as PADR?

    this is the line in my progress report that I added PADR to:

    Code:
    writeln(PADR('|This Script Ran For ' + TimeRunning, 83)  + '|'
    this is a line you wrote,

    Code:
    WriteLn(InsertSpaces('abcd', i));
    to do it with PADL you would do

    Code:
    WriteLn(PADL('|This Script Ran For ' + TimeRunning , 83 + '|'));
    Code:
    so it would say |This script has ran for 30 minutes 28 Seconds             |?
    hmm when I tried to run it, I had to do

    WriteLn(PADL('|This Script Ran For ' + TimeRunning + ' |', + 83));

    all I did was move the 83 to then end, but I thought you were telling me PADL adds spaces here:

    Code:
    |This script has ran for 30 minutes 28 Seconds             |
    I got them at the beggining, so that line is almost centered now. In the debug box it says.

    Code:
                                                       |This Script Ran For 3 Seconds|
    I put wait(3000) in there so it would come back with a time.

    but is that right? is it supposed to be on the left side? or did I mess it up somehow?

  22. #22
    Join Date
    Jan 2007
    Location
    Illinois.. >.<
    Posts
    1,158
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    PadL means that it will ad "padding" or spacing on the left side. PadR is the opposite.

  23. #23
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    Quote Originally Posted by Rasta Magician View Post
    you need to include SRL to use TimeRunning.

    MSX1, MSY1 -> Top left corner of RS (mainscreen)
    MSX2, MSY2 -> Bottom right corner of RS mainscreen
    MIX1, MIY2 -> top left coner of inv
    MIX2, MIY2 -> bottom right corner of inv
    MMX1, MMY1 -> top left corner of MiniMap
    MMX2, MMY2 -> Bottom left corner of minimap
    MSCX, MSCY -> center of mainscreen
    MMCX, MMCY -> center of minimap.

    ~RM
    so to search the top half of the MM I would have to do:

    FindColerTolerance(x, y, Color, MSX1, MSY1, MSX2, MSCY, 15)

    not

    FindColerTolerance(x, y, Color, MSCX, MSCY, MSX2, MSY2, 15)

    right? because if I set the MSY2 at center it would raise the search 1/2 way up because MSY2 is the bottom right corner's Y-cooridante, but if I changed (MSX1, MSY1) to (MSCX, MSCY) it move the top left corner's x-coordinate 1/2 way over to the right, and drop the top left corner's y-coordinate 1/2 way down, right? because MSX1 is the top left coner's X-coordinate and MSY1 is the top left corner's Y-coordinate, and that would center them both.

    I put in two attachments as a visual, the black box being the MS and the Red Box being a search in the main screen, I made the black box 6" x 6" then covered it in red where it would search, to clear any possible future questions up. Not the best visual, just two colored boxes, but it gets the job done.

    If I did

    FindColerTolerance(x, y, Color, MSCX, MSCY, MSX2, MSY2, 15)

    it would search like the attachment named "Wrong Search" does instead of searching like the attachment named "Right Search" does, which would be

    FindColerTolerance(x, y, Color, MSX1, MSY1, MSX2, MSCY, 15) .



    EDIT: oh alright, noone said that before, the first person to mention PADL just said

    Quote Originally Posted by almost View Post
    PadL is sort of hard to explain.
    It makes a string a certain length but won't make the string any smaller, it can only add on to it.

    PadL('abcd', 4) will just return 'abcd'
    and anything less then 4 will just return the original string.

    PadL('abcd', 5) will return ' abcd' (one space)
    PadL('abcd', 6) will return ' abcd' (two spaces)

    So to use it for adding spaces to the front of a string do something like
    PadL(TheString, Length(TheString) + SpacesYouWant);
    maybe they thought I already knew, but I just heard of it when they posted it I think, I know I saw it in one other post but I think that's because I was searching how to use PADL. So I still didn't know that it was gonna push it from the left, but it's pretty cool, I might take time on day when I'm bored to center my progress report now.

    althought now that I'm really looking at it I do see they have

    PadL('abcd', 5) will return ' abcd' (one space)
    PadL('abcd', 6) will return ' abcd' (two spaces)

    I never noticed till now, they put a space before abcd in the ' '.

  24. #24
    Join Date
    Jul 2007
    Location
    Right now? Chair.
    Posts
    8,488
    Mentioned
    3 Post(s)
    Quoted
    12 Post(s)

    Default

    To search the top part of the MM you would use

    FindColorTolerance(x, y, Color, MMX1, MMY1, MMX2, MMCY, 15)
    FindColorTolerance(var x, y:integer; Color, x1, y1, x2, y2, tol : integer):boolean

    point 1: MMX1, MMY1 --> top left corner of minimap (x is for horizontal, y iis for vertical
    point2: MMX2, MMCY -> MMX2 (all the way to the right) - MMCY (middle of minimap height)

    MM -> MiniMap
    MS -> MainScreen
    MI -> My Inventory

    ~RM

    I & I know Zion. It is in the spirit, body and mind of every one of us
    RMouse(obj: TMSIObject): boolean;

  25. #25
    Join Date
    Mar 2008
    Location
    New Jersey
    Posts
    1,673
    Mentioned
    1 Post(s)
    Quoted
    9 Post(s)

    Default

    ok, that's what I said, just, most likely, easier to understand, thanks for posting what all the codes meant that I quoted in my lasy post, it helped a lot, rep+.

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)

Similar Threads

  1. color finding
    By elobire in forum OSR Help
    Replies: 7
    Last Post: 12-15-2008, 09:03 PM
  2. Finding a color in the inv.
    By yanix in forum OSR Help
    Replies: 1
    Last Post: 01-30-2008, 09:51 PM
  3. Need Finding A Color Help >.<
    By pkzzz in forum OSR Help
    Replies: 5
    Last Post: 10-11-2007, 09:32 PM

Posting Permissions

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