Results 1 to 5 of 5

Thread: Help On My New Script Please!

  1. #1
    Join Date
    Oct 2007
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Help On My New Script Please!

    Hello, iam making a new script its called GuardFighterZero (Zero Represents The Version), and i have some problems fixing the errors in it. So i need somone to fix my new script for me please.
    SCAR Code:
    program GuardFighterZero;
    {.Include SRL/SRL.Scar}

    {
      ________                       .___
     /  _____/ __ _______ _______  __| _/
    /   \  ___|  |  \__  \\_  __ \/ __ |
    \    \_\  \  |  // __ \|  | \/ /_/ |
     \______  /____/(____  /__|  \____ |
            \/           \/           \/
    ___________.__       .__     __                 __________
    \_   _____/|__| ____ |  |___/  |_  ___________  \____    /___________  ____
     |    __)  |  |/ ___\|  |  \   __\/ __ \_  __ \   /     // __ \_  __ \/  _ \
     |     \   |  / /_/  >   Y  \  | \  ___/|  | \/  /     /\  ___/|  | \(  <_> )
     \___  /   |__\___  /|___|  /__|  \___  >__|    /_______ \___  >__|   \____/
         \/      /_____/      \/          \/                \/   \/

    }


    {Version : Zero}
    {Next Version: One}

    const
    GuardType = 'varrock';//The city you are fighting guards in: varrock, ardougne.

    var
    GuardV, GuardA : Integer;
    X, Y : Integer;

    procedure DeclareGuardType(CityGuardType : String);
    begin
      case LowerCase(CityGuardType) of
     
      'varrock': GuardV := 7111560;
      'ardougne': GuardA := 9770770;
     
      end;
    end;

    function AttackGuard(Guard : String) : Boolean;
    begin
    if(not(LoggedIn))then Exit;
    begin
      case LowerCase(Guard) of
     
      'varrock': begin
                 if(FindObj(X, Y, 'uard', GuardV, 5))then
                 begin
                 MMouse(X, Y, 1, 1);
                 if(IsUpText('uard'))then
                 begin
                 Mouse(X, Y, 1, 1, True);
                 Result:=True;
                 end;
                 end;
                 end;
                 
      'ardougne': begin
                 if(FindObj(X, Y, 'uard', GuardV, 5))then
                  begin
                  MMouse(X, Y, 1, 1);
                  if(IsUpText('uard'))then
                  begin
                  MOuse(X, Y, 1, 1, True);
                  Result:=True;
                  end;
                  end;
                  end;

                 end;
              end;
         end else
       Result:=False;
     end;
    end;



    procedure Fight;
    var
    GFT : Integer;
    begin
    if(not(LoggedIn))then Exit;
    GFT := 0;
    repeat
    AttackGuard(GuardType);
    GFT := GFT + 1;
    until(AttackGuard(GuardType)or(GFT >= 7);
    if(GFT >= 7)then
    begin
    WriteLn('Could not attack/find guards, terminating scrpt.');
    TerminateScript;
    end;
    end;

    begin
    SetUpSRL;
    DeclareGuardType(GuardType);
    begin
    Fight;
    end;
    end.

    Fix all the errors/wrong things that you could find please.
    -Thanks, Ultra.
    Woot woot.

  2. #2
    Join Date
    Jan 2008
    Posts
    89
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I tried and i just cannot do it. LEARN some scripting standards, if u make it look neat, ill fix everything ina jiffy.

    yours,
    prince

  3. #3
    Join Date
    Feb 2007
    Location
    EST (US East Coast)
    Posts
    250
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    program GuardFighterZero;
    {.Include SRL/SRL.Scar}

    {
      ________                       .___
     /  _____/ __ _______ _______  __| _/
    /   \  ___|  |  \__  \\_  __ \/ __ |
    \    \_\  \  |  // __ \|  | \/ /_/ |
     \______  /____/(____  /__|  \____ |
            \/           \/           \/
    ___________.__       .__     __                 __________
    \_   _____/|__| ____ |  |___/  |_  ___________  \____    /___________  ____
     |    __)  |  |/ ___\|  |  \   __\/ __ \_  __ \   /     // __ \_  __ \/  _ \
     |     \   |  / /_/  >   Y  \  | \  ___/|  | \/  /     /\  ___/|  | \(  <_> )
     \___  /   |__\___  /|___|  /__|  \___  >__|    /_______ \___  >__|   \____/
         \/      /_____/      \/          \/                \/   \/

    }


    {Version : Zero}
    {Next Version: One}

    const
    GuardType = 'varrock';//The city you are fighting guards in: varrock, ardougne.

    var
    GuardV, GuardA : Integer;
    X, Y : Integer;

    procedure DeclareGuardType(CityGuardType : String);
    begin
      case LowerCase(CityGuardType) of
        'varrock' : GuardV := 7111560;
        'ardougne' : GuardA := 9770770;
      end;
    end;

    function AttackGuard(Guard : String) : Boolean;
    begin
      if(not(LoggedIn))then Exit;
      case LowerCase(Guard) of
        'varrock' :
          begin
            if(FindObj(X, Y, 'uard', GuardV, 5))then
            begin
              MMouse(X, Y, 1, 1);
              if(IsUpText('uard'))then
              begin
                Mouse(X, Y, 1, 1, True);
                Result:=True;
                Exit;
              end;
            end;
          end;

        'ardougne' :
          begin
            if(FindObj(X, Y, 'uard', GuardV, 5))then
            begin
              MMouse(X, Y, 1, 1);
              if(IsUpText('uard'))then
              begin
                MOuse(X, Y, 1, 1, True);
                Result:=True;
                Exit;
              end;
            end;
          end;
        end;
      Result := False;
    end;



    procedure Fight;
    var
      GFT : Integer;
    begin
      if(not(LoggedIn))then Exit;
      GFT := 0;
      repeat
        AttackGuard(GuardType);
        GFT := GFT + 1;
      until(AttackGuard(GuardType)) or (GFT >= 7);
      if(GFT >= 7)then
      begin
        WriteLn('Could not attack/find guards, terminating scrpt.');
        TerminateScript;
      end;
    end;

    begin
      SetUpSRL;
      DeclareGuardType(GuardType);
      Fight;
    end.

    What I did:
    • Fixed some standards
    • Removed useless begins and ends
    • Close round error fixed (you forgot a close parentheses)
    • You had a useless "end else" which was causing your semicolon expected error.


    BTW FindObj checks for uptext, so your IsUpText isn't really necessary.
    Temporarily inactive.

  4. #4
    Join Date
    Sep 2007
    Location
    Pennsylvania
    Posts
    3,396
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Learn scripting standards, I fixed it up a bit but it's not perfect. I commented where I fixed stuff, not sure if it's all good now though.

    It's getting an Identifier Expected error now though, Idk how to fix
    SCAR Code:
    program GuardFighterZero;
    {.Include SRL/SRL.Scar}

    {
      ________                       .___
     /  _____/ __ _______ _______  __| _/
    /   \  ___|  |  \__  \\_  __ \/ __ |
    \    \_\  \  |  // __ \|  | \/ /_/ |
     \______  /____/(____  /__|  \____ |
            \/           \/           \/
    ___________.__       .__     __                 __________
    \_   _____/|__| ____ |  |___/  |_  ___________  \____    /___________  ____
     |    __)  |  |/ ___\|  |  \   __\/ __ \_  __ \   /     // __ \_  __ \/  _ \
     |     \   |  / /_/  >   Y  \  | \  ___/|  | \/  /     /\  ___/|  | \(  <_> )
     \___  /   |__\___  /|___|  /__|  \___  >__|    /_______ \___  >__|   \____/
         \/      /_____/      \/          \/                \/   \/

    }


    {Version : Zero}
    {Next Version: One}

    const
      GuardType = 'varrock';//The city you are fighting guards in: varrock, ardougne.

    var
      GuardV, GuardA : Integer;
      X, Y : Integer;

    procedure DeclareGuardType(CityGuardType : String);
      begin
        case LowerCase(CityGuardType) of
        'varrock': GuardV := 7111560;
        'ardougne': GuardA := 9770770;
      end;
    end;

    function AttackGuard(Guard : String) : Boolean;
    begin
        if(not(LoggedIn))then Exit;
           //You had an extra begin there
      case LowerCase(Guard) of

      'varrock': begin
                   if(FindObj(X, Y, 'uard', GuardV, 5))then
                     begin
                       MMouse(X, Y, 1, 1);
                       if(IsUpText('uard'))then
                         begin
                           Mouse(X, Y, 1, 1, True);
                           Result:=True;
                         end else
                           begin
                             Result:=False; //Put this in here for false
                           end;
                     end;
                 end;

      'ardougne': begin
                    if(FindObj(X, Y, 'uard', GuardV, 5))then
                      begin
                        MMouse(X, Y, 1, 1);
                        if(IsUpText('uard'))then
                          begin
                            Mouse(X, Y, 1, 1, True);
                            Result:=True;
                          end else
                            begin
                              Result:=False;  //put this in here for false
                            end;
                      end;
                  end;
      end;
    end;                  //That's the end for the AttackGaurd Function
       {  end else               //These next four lines aren't part of any procedure :\
       Result:=False;
     end;
    end;          }




    procedure Fight;
      var GFT : Integer;
      begin
        if(not(LoggedIn))then Exit;
        GFT := 0;
        repeat
          AttackGuard(GuardType);
          GFT := GFT + 1;
        until(AttackGuard(GuardType)or(GFT >= 7)); //you were missing a ) there (on the end)
        if(GFT >= 7)then
          begin
            WriteLn('Could not attack/find guards, terminating scrpt.');
            TerminateScript;
          end;
      end;

    begin
      SetUpSRL;
      DeclareGuardType(GuardType);
      begin
        Fight;
      //no end; there, you only need end. for end of MainLoop
    end.

    EDIT: ops didn't see that ducels beat me to it

  5. #5
    Join Date
    Oct 2007
    Posts
    742
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thanks alot guys for helping me.
    Woot woot.

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
  •