Results 1 to 2 of 2

Thread: My second script... My millionth error

  1. #1
    Join Date
    Oct 2006
    Posts
    21
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default My second script... My millionth error

    Ok, I'm wondering if anyone could help me clean up this script a little, and advise me on the really crappy areas of this script. I really do feel it helps me when someone tells me what areas I could improve on. Also, I get a runtime error.

    Heres the code

    SCAR Code:
    program deadlycowkiller;

    {.include SRL\SRL.Scar}
    {.include SRL\SRL\Skill\Fighting.Scar}

    var
      Cow : array[0..2] of Integer;
      Kills, TakeCount: Integer;
      bury, meatCooked, time: Integer;
    const
      iPlay       = 10; //# of minutes until switch player
      StartPlayer = 0;  //Player to Play first.
      cows2kill = 3; //the ammount of cows you want to kill before exiting loop
      Col1 = 15922164; // First monster color
      Col2 = 2160891; // Second monster color
      Col3 = 858759; // Third monster color
      Col4 = 993083; // Fourth monster color
    procedure suPlayers;
    begin
      HowManyPlayers:= 4;
      NumberOfPlayers(HowManyPlayers);

      Players[0].Name     :='';
      Players[0].Pass     :='';
      Players[0].Nick     :='one';
      Players[0].Integer1 := 2; //1 - 4 fightmode.
      Players[0].Active   := True;

      Players[1].Name     :='';
      Players[1].Pass     :='';
      Players[1].Nick     :='one';
      Players[1].Integer1 := 2; //1 - 4 fightmode.
      Players[1].Active   := True;

      Players[2].Name     :='';
      Players[2].Pass     :='';
      Players[2].Nick     :='t a';
      Players[2].Integer1 := 2; //1 - 4 fightmode.
      Players[2].Active   := True;

      Players[3].Name     :='';
      Players[3].Pass     :='';
      Players[3].Nick     :='one';
      Players[3].Integer1 := 1; //1 - 4 fightmode.
      Players[3].Active   := True;

    end;


    procedure myAntiBan;
    begin
      RotateEvery(4 + random(3));
      LeaveScreenEvery(5 + random(5));
      RandomRClickEvery(15 + random(5));
    end;

    procedure FindRandoms;
    begin
      FindNormalRandoms;
      FindLamp(LampSkill);
    end;


    procedure attcow;
    begin
      if (LoggedIn) then
      begin
      if isfight = true then
      begin
        myAntiBan;
        wait(5000+random(2500));
      end;
      FightNPC(Col1, Col2, Col3, Col4, 15922164, 15922164, 10, 12);
      kills:= kills + 1
    end;
    end;


      begin
        SetupSRL;
      repeat
        if(not(LoggedIn))then
        findrandoms;
        attcow;
        FindNormalRandoms


    until(kills = cows2kill);
    end.

    It isn't the nicest code, nor have I done alot of the things I want to do in it (mostly make it pick up the bones, bury them and pick up the meat and cook it. Those things will come up later. Also, I'll most likely break up the code into more procedures later, but for now....

    Anyway, my error is this
    Code:
    [Runtime Error] : Out Of Range in line 65 in script C:\Program Files\SCAR 2.03\includes\SRL\SRL\Skill\Fighting.Scar
    That happens after I kill one cow.

    If anyone could help me fix up that error, explain to me what parts of the script are badly coded, and which ones aren't so bad, that'd be great.

    Also, i'm unsure if I've scripted it right so that it loggs in...

    Thanks,

    Maver

  2. #2
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    The kills+1 should only happen after you know the fight is over. Put this in

    writeln(inttostr(kills));

    after the kills + 1 to see how it's working.

    Check out the template or another example for the logging in.

    Work on a function that knows when the fight is over, so you don't attack the same cow multiple times.

    Also work on a procedure that trys to find cow on MS and if it can't to click on a yellow dot on minimap and try again.

    Take things a little at a time and you'll get better and better.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Line 135: [Error] (14845:1): Syntax error in script
    By AbsTrACt'^.| in forum OSR Help
    Replies: 16
    Last Post: 05-23-2008, 01:14 PM
  2. Replies: 5
    Last Post: 02-26-2008, 04:14 PM
  3. Error: Cannot Fix Script - Error Overgrowth - Begin Headdesking
    By PhantasmalScripter in forum OSR Help
    Replies: 6
    Last Post: 12-23-2006, 12:50 AM

Posting Permissions

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