Results 1 to 16 of 16

Thread: Will this code work?

  1. #1
    Join Date
    Jun 2009
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Will this code work?

    Code:
    program CrystalBowCounter;
    
    procedure BowCount;
    
    var count: integer;
    var randstore: integer;
    var x, y: integer;
    var flag: boolean;
    
    
    
    begin
      repeat
        flag := true;
        count :=0
        randstore := RandomRange(230, 245);
          while (flag) do
          begin
            if (FindColorTolerance(x, y, 7517833, 232, 121, 324, 219, 7)) then
            begin
              count := count+1;
              writeln('Arrows shot: ' +inttostr(count)); //For testing purposes
              wait(1200);
            end;
            if (count = randstore) then
            begin
              writeln('Time to switch bows!');
              //flag := true;
            end;
            if (IsTextInAreaEx(5, 343, 514, 475, x, y, 'Your crystal bow has degraded'{place holder, I dont really have the real string}, 0, ChatChars, False, False, 0, 0, -1) and flag) then
            begin
              writeln('Bow has degraded');
              flag = false;
            end;
            wait(300);
          end;
      until(false)
    end;
    
    begin
      BowCount;
    end.
    A quick explanation:

    This code will count the number of arrows shot via the color of the arrow every time the arrow is shot. Then it will alert me every time around 230-245 arrows have been shot so I can swap my crystal bows in order to maintain one of them in 10/10 condition.

    It's very basic (my first script haha) so I dont expect much...

    I can't test this because I don't really have a crystal bow. (In fact, I'm writing this code so I can get the most out of my bow when I do get one) The color I put in was from a msb special, which has a similar glow like the crystal bow arrows. This also explains why I didnt use bitmapping, since I dont have a image of the crystal bow arrow, and google didnt either

    I eventually plan to expand the code to include playing a sound and/or automatically switching bows, then switching back when the bow degrades.

    Sorry for being such a newbie =P
    Thanks!

    EDIT:
    I have rewritten my script to make it a little more flexible.

    However, I have a few more questions:

    Code:
    if (IsTextInAreaEx(5, 343, 514, 475, x, y, 'Your crystal bow has degraded', 0, ChatChars, False, False, 0, 0, -1) and flag) then
    What do I put in place for ChatChars? I got this from the F1 help. I get a compile error when I try to run this.
    Also, what is the sign for "opposite" or "not"? (In C++ it is the ! sign). For example:

    Code:
    if (!flag)
    would run only when the flag was false. I've tried using the ! sign, but the compiler does not recognize it =/
    Last edited by flamer; 07-30-2009 at 11:29 AM.

  2. #2
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    In theory it should work. I would be worried about getting the right color if I were you

  3. #3
    Join Date
    Jun 2009
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Haha, thanks =P

    Is searching for color or bitmap better? I assume there isnt too much of a difference in this case, since I'm confining the area just to my character...

    I think tomorrow I'll go get two crystal seeds and enchant them into bows and get the colors for the arrows.

  4. #4
    Join Date
    Feb 2008
    Posts
    517
    Mentioned
    0 Post(s)
    Quoted
    1 Post(s)

    Default

    By the way, when you first acquire your bow, you actually SHOULD let it degenerate and recharge it I believe it's around 3 times, for the to be at it's best condition, not realy sure if that's the number, check it on tip.it, but I'm sure that you have to use it up a few times for it to be in its most powerful state.

  5. #5
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by Feroc1ty View Post
    By the way, when you first acquire your bow, you actually SHOULD let it degenerate and recharge it I believe it's around 3 times, for the to be at it's best condition, not realy sure if that's the number, check it on tip.it, but I'm sure that you have to use it up a few times for it to be in its most powerful state.
    How does that make sense? How is recharging going to make it more powerful than it was when it was recharged before? They are both 10/10, so would they not be equally as powerful?

  6. #6
    Join Date
    Jun 2009
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Every time you recharge it, it becomes cheaper to recharge, until 180k.

    That's all =P

  7. #7
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Are you going to be playing legit?

  8. #8
    Join Date
    Apr 2008
    Location
    Marquette, MI
    Posts
    15,252
    Mentioned
    138 Post(s)
    Quoted
    680 Post(s)

    Default

    Quote Originally Posted by flamer View Post
    Every time you recharge it, it becomes cheaper to recharge, until 180k.

    That's all =P
    Oh, haha yeah I knew that.

    He just made it sound like you would hit higher after you recharge it a certain amount of times.

  9. #9
    Join Date
    Jun 2009
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by mormonman View Post
    Are you going to be playing legit?
    As much as possible... I haven't autoed since my f2p days. This code is just to assist me (Or anyone else with a crystal bow for that matter) so I don't have to count every single arrow that comes out of my crystal bow.

  10. #10
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Can't you tell when it degrades?

  11. #11
    Join Date
    Jan 2008
    Location
    Ontario, Canada
    Posts
    7,805
    Mentioned
    5 Post(s)
    Quoted
    3 Post(s)

    Default

    The point tlis not let the main one degrade. Leaving one at tenten and letting a second one decrease.

    Might be easier to manual.
    Writing an SRL Member Application | [Updated] Pascal Scripting Statements
    My GitHub

    Progress Report:
    13:46 <@BenLand100> <SourceCode> @BenLand100: what you have just said shows you 
                        have serious physchological problems
    13:46 <@BenLand100> HE GETS IT!
    13:46 <@BenLand100> HE FINALLY GETS IT!!!!1

  12. #12
    Join Date
    Jun 2009
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I dont like focusing on the screen while training =P I usually browse forums or do homework/read while I train, and look back every 30 seconds or so.

    Plus, I like to get my money's worth. Using a crystal bow at 1/10 is kind of depressing really.

  13. #13
    Join Date
    Dec 2006
    Location
    Copy pastin to my C#
    Posts
    3,788
    Mentioned
    8 Post(s)
    Quoted
    29 Post(s)

    Default

    Not is simply not.

  14. #14
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    time it then?

  15. #15
    Join Date
    Jun 2009
    Posts
    35
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Not is simply not.
    Thanks!

    Quote Originally Posted by mormonman View Post
    time it then?
    Well, thats not as accurate as using a counter haha. Besides, it wasnt too difficult to write... just figuring out the language was the hard part.

    BTW does anyone know how to use ChatChars? (The one I used in my code) Apparently I'm supposed to define a function ChatChars and it returns a value? If so, what is the value for the rs text box?
    Last edited by flamer; 07-31-2009 at 07:01 AM.

  16. #16
    Join Date
    Feb 2009
    Location
    AZ, USA
    Posts
    460
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    Instead of

    SCAR Code:
    var count: integer;
    var randstore: integer;
    var x, y: integer;
    var flag: boolean;

    you can do

    SCAR Code:
    var
      count, randstore, x, y: Integer;
      flag: Boolean;

    Also, count will already equal 0 so you don't need to do count:= 0;, and there is no need for the variable randstore because you can do

    SCAR Code:
    if (count = RandomRange(230,245)) then

    I know you asked if it would just work, I'm just pointing out a few things.
    Is your account in an old-school random? Help SRL-OSR solve randoms!

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
  •