Results 1 to 11 of 11

Thread: Newbie needing some help with script.

  1. #1
    Join Date
    Jul 2009
    Posts
    53
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Newbie needing some help with script.

    I have read a few tuts and things (its actually rather annoying since some of them are old and the includes don't work therefor them procedures arent useable anymore..) but anyway I was just playing around with a script trying to get it to kill some Goblins, this is what I have so far...

    Code:
    Program GoblinKiller;
    {.include SRL/SRL.Scar}
    
    var
    OresMined, TotalProggies, x,y : Integer;
    Const
    MonsterName = 'Goblin';
    MonsterColourOne = 2986635;
    MonsterColourTwo = 3053713;
    MonsterColourThree = 6066293;
    
    Procedure Attack;
    begin;
          if findcolor(x,y,MonsterColourOne,4,4,514,335) then;
             Mouse(x, y, 10, 10, False);
             else;
                   if findcolor(x,y,MonsterColourTwo,4,4,514,335) then;
             Mouse(x, y, 10, 10, False);
             else;
                   if findcolor(x,y,MonsterColourThree,4,4,514,335) then;
             Mouse(x, y, 10, 10, False);
             else;
         Writeln('We could not find that Monster.');
      Wait(5000);
    end;
    
    
    
    
    Procedure GoblinsKilled;
    begin
         Wait(15000);
         inc(TotalProggies);
         ClearDebug;
         TimeRunning;
         Writeln('This has been running for ' + (Timerunning) + '.');
         Writeln('You have killed ' (------------) ' ' + MonsterName + 's');
         Writeln('We have updated you ' + IntToStr(TotalProggies) + ' times.');
    end;
    
    
       
    Begin
         Repeat
               Attack;
               GoblinsKilled;
         Until(false);
    end.

    What I am having problems with is the 'Attack' Part;

    Code:
    Procedure Attack;
    begin;
          if findcolor(x,y,MonsterColourOne,4,4,514,335) then;
             Mouse(x, y, 10, 10, False);
             else;
                   if findcolor(x,y,MonsterColourTwo,4,4,514,335) then;
             Mouse(x, y, 10, 10, False);
             else;
                   if findcolor(x,y,MonsterColourThree,4,4,514,335) then;
             Mouse(x, y, 10, 10, False);
             else;
         Writeln('We could not find that Monster.');
      Wait(5000);
    end;

    I can not get the command 'Else' to work, it just comes up saying 'Line 16: [Error] (19838:1): Identifier expected in script ' Unless I take the 'else' out.

    Another problem I have is the mouse speed, for some reason the mouse moves reaaaaaly slow to get to places and this only happens my script and I dont know why. Any help would be loved and ++rep.


    Another thing I need help with that you might see in the code is
    Code:
    Writeln('You have killed ' (------------) ' ' + MonsterName + 's');
    I haven't really figured out how to make it tell you how many it has killed.

    once again thanks for the help in advance!


    (Ps Ive been here a week and have over 10 posts, does my JRN status happen automaticly?)
    Last edited by vinnievinboy; 07-26-2009 at 11:03 PM.

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

    Default

    you have to remove the ';' in the line above the else and the ';' right after else. Good to see your eagerness on scripting

    ~RM

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

  3. #3
    Join Date
    Jul 2009
    Posts
    53
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ah thank you so much, but I am still having problems with the mouse speed. It moves soooo slow.

  4. #4
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    begin
      SetupSRL;
      repeat
        Attack;
        GoblinsKilled;
      until(False);
    end.

  5. #5
    Join Date
    Jul 2009
    Posts
    53
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thats it! Thank you so much.
    Now to try add some anti ban and stuff, any help appreciated.

  6. #6
    Join Date
    Dec 2008
    Posts
    2,813
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Check in Antiban.scar (SRL\SRL\core\Antiban.scar).

  7. #7
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Just for a little extra help to, since JaGeX changes there colors a lot, even sometimes while your playing, try using:
    SCAR Code:
    (FindColorTolerance(Color, x, y, MSx1, MSy1, MSx2, MSy2, 15))

    The last parameter "15" is the tolerance. Just trying to help out

  8. #8
    Join Date
    Jul 2009
    Posts
    53
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Where would I add that in, it just says 'Duplicate identifier 'FindColorTolerance' '
    so do I even need it?

  9. #9
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by vinnievinboy View Post
    Where would I add that in, it just says 'Duplicate identifier 'FindColorTolerance' '
    so do I even need it?
    SCAR Code:
    Procedure Attack;
    begin;
          if findcolorTolerance(x,y,MonsterColourOne,4,4,514,335, 15) then;
             Mouse(x, y, 10, 10, False);
             else
                   if findcolorTolerance(x,y,MonsterColourTwo,4,4,514,335, 15) then;
             Mouse(x, y, 10, 10, False);
             else
                   if findcolor(x,y,MonsterColourThree,4,4,514,335, 15) then;
             Mouse(x, y, 10, 10, False);
             else
         Writeln('We could not find that Monster.');
      Wait(5000);
    end;

    And to make it easier use an array:
    SCAR Code:
    program New;
    {.include srl/srl.scar}
    var
      OreMined{?}, TotalProggies, x, y, i: integer;
      MonsterColour: TintegerArray;
    const
      MonsterName = 'Goblin';
    procedure Attack;
    begin
      SetLength(MonsterColour, 3)
      MonsterColour[0] := 32434;
      MonsterColour[1] := 34234;
      MonsterColour[2] := 32422;
      for i := 0 to 2 do
      begin
        if(FindColorTolerance(x, y, MonsterColour[i], MSx1, MSy1, MSx2, MSy2, 15))then
        begin
          Writeln('We have found the monster!');
          Mouse(x, y, 5, 5, false);
          Wait(500+random(500));
          ChooseOption('ttack');
        end;
      end;
    end;

    Procedure GoblinsKilled;
    begin
         Wait(15000);
         inc(TotalProggies);
         ClearDebug;
         TimeRunning;
         Writeln('This has been running for ' + (Timerunning) + '.');
         Writeln('You have killed  (------------)  ' + MonsterName + 's');
         Writeln('We have updated you ' + IntToStr(TotalProggies) + ' times.');
    end;



    begin
      SetUpSRl;
      repeat
       Attack;
       GoblinsKilled;
      until(false)
    end.

    Any questions?

  10. #10
    Join Date
    Jul 2009
    Posts
    53
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thats why it wasnt working
    '(FindColorTolerance(Color, x, y, MSx1, MSy1, MSx2, MSy2, 15))'
    on your first post you put colour and x/y the wrong way round, I should of saw that -.-

    Yeah the oremined was when I was playing around with it and then changed it to killing gobbo's and forgot to take that out.

    And yeah array looks alot better, Few things I'll have to understand first.

    Thanks loads

  11. #11
    Join Date
    Mar 2009
    Location
    Illinois
    Posts
    292
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by vinnievinboy View Post
    Thats why it wasnt working
    '(FindColorTolerance(Color, x, y, MSx1, MSy1, MSx2, MSy2, 15))'
    on your first post you put colour and x/y the wrong way round, I should of saw that -.-

    Yeah the oremined was when I was playing around with it and then changed it to killing gobbo's and forgot to take that out.

    And yeah array looks alot better, Few things I'll have to understand first.

    Thanks loads
    Yup np if you have any questions just send me a PM and i'll get back to you, and i didn't even notice my typo >.< sorry bout that

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
  •