Results 1 to 9 of 9

Thread: Trouble with bitmaps.

  1. #1
    Join Date
    Jan 2010
    Location
    U.S.
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Trouble with bitmaps.

    First off here's the part of the script I'll be asking about. (Thanks to The Man for cleaning it up.)

    Code:
    procedure FireRain;
    var i, fire, bandage: Integer;
    begin
      repeat
        Wait(2 * 250 + random(50));
        Writeln('Casting Fire Rain.');
        if FindBitmap(fire, x, y) then
        begin
          HoldMouse(x, y, True);
          Wait(2 * 500 + random(50));
          ReleaseMouse(x, y, True);
        end;
        Wait(6 * 1500 + random(50));
        Writeln('Healing with Bandage.');
        if FindBitmap(bandage, x, y) then
        begin
          MoveMouseSmooth(x, y);
          ClickMouse(x, y, True);
        end;
        Wait(2 * 2000 + random(50));
        Inc(i);
      until (i = 10);
    end;
    For some odd reason, everything works perfect in the script besides this one procedure. It compiles perfect with 0 errors, though it does not run the procedure correctly so there is something wrong.

    It only does the 'FireRain' (fire bitmap) command without doing the 'bandage' command following afterwards. So basically it ignores the whole bandage section of the procedure and only does the hold mouse/release mouse on the fire bitmap, will not do the bandage.

    Any advice on what this could be? I'm starting to think I need a Begin somewhere in the script for it to begin the one section of the procedure which is Bandage. Thanks in advance <3

    Notes:
    I have the bitmaps loaded and identified.
    I tried adding a Begin since theres a end in the middle of the procedure though comes back requesting an identifier near the end of the script that is NOT an end.
    Last edited by Littma; 01-28-2010 at 10:07 PM.

  2. #2
    Join Date
    May 2007
    Location
    UK
    Posts
    4,007
    Mentioned
    1 Post(s)
    Quoted
    12 Post(s)

    Default

    Not sure but here is your script with some standards :P
    SCAR Code:
    procedure FireRain;
    var i, fire, bandage: Integer;
    begin
      repeat
        Wait(2 * 250 + random(50));
        Writeln('Casting Fire Rain.');
        if FindBitmap(fire, x, y) then
        begin
          HoldMouse(x, y, True);
          Wait(2 * 500 + random(50));
          ReleaseMouse(x, y, True);
        end;
        Wait(6 * 1500 + random(50));
        Writeln('Healing with Bandage.');
        if FindBitmap(bandage, x, y) then
        begin
          MoveMouseSmooth(x, y);
          ClickMouse(x, y, True);
        end;
        Wait(2 * 2000 + random(50));
        Inc(i);
      until (i = 10);
    end;

  3. #3
    Join Date
    Jan 2007
    Posts
    8,876
    Mentioned
    123 Post(s)
    Quoted
    327 Post(s)

    Default

    I don't know if it will make any difference, but have you tried declaring x and y locally instead of globally?

  4. #4
    Join Date
    Jan 2010
    Location
    U.S.
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by The Man View Post
    Not sure but here is your script with some standards :P
    SCAR Code:
    procedure FireRain;
    var i, fire, bandage: Integer;
    begin
      repeat
        Wait(2 * 250 + random(50));
        Writeln('Casting Fire Rain.');
        if FindBitmap(fire, x, y) then
        begin
          HoldMouse(x, y, True);
          Wait(2 * 500 + random(50));
          ReleaseMouse(x, y, True);
        end;
        Wait(6 * 1500 + random(50));
        Writeln('Healing with Bandage.');
        if FindBitmap(bandage, x, y) then
        begin
          MoveMouseSmooth(x, y);
          ClickMouse(x, y, True);
        end;
        Wait(2 * 2000 + random(50));
        Inc(i);
      until (i = 10);
    end;
    Thank you, much cleaner than what I had. Getting back into Pascal is a pain

    Doesn't solve the problem, but I appreciate you cleaning it up a bit.

  5. #5
    Join Date
    Jan 2010
    Location
    U.S.
    Posts
    72
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Zyt3x View Post
    I don't know if it will make any difference, but have you tried declaring x and y locally instead of globally?
    Hmm, no I have not. Interesting thought though.
    I might know a solution to it.
    Making FireRain + Bandage separate procedures then repeating in the loop?
    It seems logical, but I can't be sure.
    Also, declaring x and y's coordinates globaly? I personally would not know how.

  6. #6
    Join Date
    Oct 2008
    Location
    C:\Simba\Includes\
    Posts
    7,566
    Mentioned
    19 Post(s)
    Quoted
    180 Post(s)

    Default

    You're already declaring x, y globally. in the var section of your function add x, y and that will declare them locally, it *may* solve your problem.

    ~Camo
    Away for awhile, life is keeping me busy. | Want to get my attention in a thread? @Kyle Undefined; me.
    { MSI Phoenix || SRL Stats Sigs || Paste || Scripts || Quotes || Graphics }

    When posting a bug, please post debug! Help us, help you!

    I would love to change the world, but they won't give me the source code. || To be the best, you've got to beat the rest. || Logic never changes, just the syntax.
    If you PM me with a stupid question or one listed in FAQ, or about a script that is not mine, I will NOT respond.


    SRL is a Library of routines made by the SRL community written for the Program Simba. We produce Scripts for the game Runescape.


  7. #7
    Join Date
    Aug 2009
    Location
    Inside the Matrix...yes it has me, and it has you too.
    Posts
    1,896
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by Littma View Post
    Also, declaring x and y's coordinates globaly? I personally would not know how.
    SCAR Code:
    Program New;
    {.Include SRL/srl.scar}

    Var
      x, y, Fire, Bandage: Integer; //Globally declared variables, as they are not declared in a procedure/function

    Procedure DoWat;

    Var
      I, R: Integer; //Locally declared variables, as they are declared in a procedure

    Begin
    End;

    Procedure DoNotherThing;

    Begin
    End;

    Begin
      DoWat;
      DoNotherThing;
    End.

    Also try declaring fire and bandage globally too
    NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN NYAN

  8. #8
    Join Date
    Nov 2007
    Location
    46696E6C616E64
    Posts
    3,069
    Mentioned
    44 Post(s)
    Quoted
    302 Post(s)

    Default

    Quote Originally Posted by Camo Developer View Post
    You're already declaring x, y globally. in the var section of your function add x, y and that will declare them locally, it *may* solve your problem.

    ~Camo
    Why would it? If you have the bitmaps already declared, there should be no need for the variable bandage. Try removing it from everywhere and add it globally.
    Last edited by Frement; 01-28-2010 at 10:35 PM.
    There used to be something meaningful here.

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

    Default

    It's probably not finding the bitmap. Try running this:
    SCAR Code:
    procedure FireRain;
    var i, fire, bandage: Integer;
    begin
      repeat
        Wait(2 * 250 + random(50));
        Writeln('Casting Fire Rain.');
        if FindBitmap(fire, x, y) then
        begin
          HoldMouse(x, y, True);
          Wait(2 * 500 + random(50));
          ReleaseMouse(x, y, True);
        end else
          Writeln('Didn''t find fire bitmap.');
        Wait(6 * 1500 + random(50));
        Writeln('Healing with Bandage.');
        if FindBitmap(bandage, x, y) then
        begin
          MoveMouseSmooth(x, y);
          ClickMouse(x, y, True);
        end else
          Writeln('Didn''t find bandage bitmap.');
        Wait(2 * 2000 + random(50));
        Inc(i);
      until (i = 10);
    end;

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
  •