Results 1 to 9 of 9

Thread: small issue first script

  1. #1
    Join Date
    Feb 2013
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default small issue first script

    Hey guys,
    I'm having a little issue with a very simple script i'm making.
    It basicly just needs to search for the color of the lifebar and then click a monk.
    I keep getting this error though:
    "Exception in Script: Invalid evaluation at line 9, column 70"

    Simba Code:
    program monkkiller;

    Procedure ClickMonk;
    var
      x, y :Integer;
      begin;
         if FindColorSpiralTolerance(x, y, 65280, 1, 1, 511, 336, 5) then
            begin;
              FindColorSpiralTolerance(x, y, 2106718, 1, 1, 511, 336, 5) or;
              FindColorSpiralTolerance(x, y, 3817636, 1, 1, 511, 336, 5) or;
              FindColorSpiralTolerance(x, y, 3422867, 1, 1, 511, 336, 5) then;
              MoveMouse (x, y);
              wait(200)
              ClickMouse(x, y, 1);
              wait(1000);
            end;
      end;

    begin
      repeat
        ClickMonk;
      until(false);
    end.

    I'm very new to this stuff so would you guys mind taking a look?
    Thanks.

  2. #2
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    I'm guessing line 9 is
    Simba Code:
    FindColorSpiralTolerance(x, y, 2106718, 1, 1, 511, 336, 5) or;

    try removing the semicolons after your or statements
    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

  3. #3
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    You also shouldn't put semicolons after a begin.
    Wrong:
    Simba Code:
    begin;
    Right:
    Simba Code:
    begin

  4. #4
    Join Date
    Apr 2013
    Posts
    395
    Mentioned
    1 Post(s)
    Quoted
    177 Post(s)

    Default

    You don't put semicolon behind or. No semicolon behind begin as well. As for mouse clicking, its better for you to use Mouse function.

  5. #5
    Join Date
    Oct 2006
    Location
    Netherlands
    Posts
    3,285
    Mentioned
    105 Post(s)
    Quoted
    494 Post(s)

    Default

    Simba Code:
    program monkkiller;

    Procedure ClickMonk;
    var
      x, y :Integer;
    begin
      if FindColorSpiralTolerance(x, y, 65280, 1, 1, 511, 336, 5) or
              FindColorSpiralTolerance(x, y, 2106718, 1, 1, 511, 336, 5) or
              FindColorSpiralTolerance(x, y, 3817636, 1, 1, 511, 336, 5) or
              FindColorSpiralTolerance(x, y, 3422867, 1, 1, 511, 336, 5) then
      begin
        MoveMouse (x, y);
        wait(200)
        ClickMouse(x, y, 1);
        wait(1000);
      end;  //end of if x then begin...end
    end;  //end of procedure ClickMonk

    begin
      repeat
        ClickMonk;
      until(false);
    end.

    Fixed it properly.

    All those or statements were outside an if statement.
    Working on: Tithe Farmer

  6. #6
    Join Date
    Feb 2013
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    Thanks!
    But doesn't he constantly click the monk now, without checking for the colour of the life bar?
    I actually just need it to click if he can't find that colour, but i'm not really sure how to implement that.

    EDIT: Also thank you to everyone else trying to help me here. :P
    Last edited by fluffee; 06-25-2014 at 03:56 PM.

  7. #7
    Join Date
    Dec 2011
    Location
    East Coast, USA
    Posts
    4,231
    Mentioned
    112 Post(s)
    Quoted
    1869 Post(s)

    Default

    Quote Originally Posted by fluffee View Post
    Thanks!
    But doesn't he constantly click the monk now, without checking for the colour of the life bar?
    I actually just need it to click if he can't find that colour, but i'm not really sure how to implement that.

    EDIT: Also thank you to everyone else trying to help me here. :P
    Simba Code:
    program monkkiller;

    Procedure ClickMonk;
    var
      x, y :Integer;
    begin
      if FindColorSpiralTolerance(x, y, 65280, 1, 1, 511, 336, 5) then
              if FindColorSpiralTolerance(x, y, 2106718, 1, 1, 511, 336, 5) or
              FindColorSpiralTolerance(x, y, 3817636, 1, 1, 511, 336, 5) or
              FindColorSpiralTolerance(x, y, 3422867, 1, 1, 511, 336, 5) then
      begin
        MoveMouse (x, y);
        wait(200)
        ClickMouse(x, y, 1);
        wait(1000);
      end;  //end of if x then begin...end
    end;  //end of procedure ClickMonk

    begin
      repeat
        ClickMonk;
      until(false);
    end.

    Fixed masterBB's fix. That should do it.

    also I recommend you look into mainScreen.findObject() for faster and more accurate object finding.
    Last edited by KeepBotting; 06-25-2014 at 04:07 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

  8. #8
    Join Date
    Jun 2012
    Posts
    4,867
    Mentioned
    74 Post(s)
    Quoted
    1663 Post(s)

    Default

    Quote Originally Posted by fluffee View Post
    Thanks!
    But doesn't he constantly click the monk now, without checking for the colour of the life bar?
    I actually just need it to click if he can't find that colour, but i'm not really sure how to implement that.

    EDIT: Also thank you to everyone else trying to help me here. :P
    Consider having a new function to check the colour, like

    Simba Code:
    function foundLifeBarColor: Boolean; //returns true if the LifeBarColor is found.
    begin
      result:= FindColorSpiralTolerance(...); //replace the FindColorSpiralTolerance(...) with the actual one.
    end;

    and then in your script you could have
    Simba Code:
    if (not foundLifeBarColor) then
      clickMonk;

    And clickMonk could be just a procedure/function to click the monk.

  9. #9
    Join Date
    Feb 2013
    Posts
    15
    Mentioned
    0 Post(s)
    Quoted
    7 Post(s)

    Default

    I got it running.
    I used KeepBotting's adjustment and replaced the "if" with "if not" on the first colourfinder, and now it basicly does what I want.
    It's just for a small simple private server, so I don't really need more accurate object finding atm.
    Thanks!

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
  •