Results 1 to 10 of 10

Thread: Scripting Help: My first script :)

  1. #1
    Join Date
    Dec 2006
    Posts
    173
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Scripting Help: My first script :)

    Hello,
    When I came to the SRL Community, I wanted to learn to script. I have read a few tutorials for begginers and how to put Anti randoms and anti ban in my script. I just finished making my first real script. I was wondering if anyone could look over the code and help me fix all the errors. Ill list the error I keep on getting:

    Line 26: [Error] (26:11): is ('=') expected in script C:\Program Files\SCAR 2.03\Scripts\MachoChopper_v1.0.scar

    So if you could post suggestions, help, comments, fixes, or anything else with the script, it would be VERY appreciated!

    Update:

    Whenever I run it its all laggy. It logs in a stuff, but after it does nothing. Can anyone help me?

  2. #2
    Join Date
    Dec 2006
    Location
    Australia
    Posts
    698
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Fair few silly mistakes but all fixed, just read the comment i placed and fix it
    SCAR Code:
    program AutoChopper;
    {========================================}
    {    Macho's AutoChopper V.01            }
    { By: Macho Man67                        }
    {========================================}
    {         Setup Information              }
    {  1) Set Client Window                  }
    {  2) Fill in Your Players at line       }
    {  3) Fill in Setup                      }
    {  4) Hit play and watch for first load  }
    {========================================}
    {         Extra Info                     }
    { This is my first real script so it may }
    { be buggy. Please post suggestions and  }
    { fixes in my post. Also all the         }
    { functions are straight from SRL        }
    {========================================}
    {         Credits                        }
    {-The whole SRL Community                }
    {-JAD for his tutorials                  }
    {-Junior for his randoms tutroial        }
    {========================================}

    {=============Setup======================}
    Const
         TreeColor1=0000;//Color of the tree you are cutting
         TreeColor2=0000;//Another color of the tree
         Treecolor3=0000;//Last color of the tree
    {===============End of Setup=============}
    {++++++++++++++++++++++++++++++++++++++++}
    {===========Setup=Players================}

    {.include SRL\SRL.scar}
    {.include SRL\SRL\skill\Woodcutting.scar}

    var
       Clicks, Loads, mins : Integer;
       rx, ry, m, n: Integer;

    procedure DeclarePlayers;
    begin
      HowManyPlayers :=1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer:=0;

         Players[0].Name :='';
         Players[0].Pass :='';
         Players[0].Nick :='';

    end;
    procedure MySign;
    begin
     ClearDebug;
      Writeln('This is brought to you by:The Noobish  ');
      Writeln('        /--\      /--\                 ');
      Writeln('       /    \    /    \                ');
      Writeln('      /      \  /      \               ');
      Writeln('     /        \/        \              ');
      Writeln('    /       /\  /\       \             ');
      Writeln('   /       /  \/  \       \  acho Man67');
      Writeln('  /_______/        \_______\           ');
      Wait(2000+ random(550));
     end;

    procedure LoginDaPlayer;
    begin
       if(not(LoggedIn))then
       LoginPlayer
    end;

    procedure KillAntiRandoms;
    begin
    FindTalk;
    FindNormalRandoms;
    if(FindFight = true) then
    begin
    RunAwayDirection('N');
    Wait(10000+random(3005));
    RunBack;
    end;
    end;

    procedure MyProggy;
    begin
    ClearDebug;
       Writeln('[]========================================[]');
        Writeln('------------>TheProgressReport<--------------');
        Writeln('  did ' + IntToStr(Loads) + ' Loads' + '    ');
        Writeln('---------------------------------------------');
        Writeln('  Did ' + IntToStr(Clicks) + ' Clicks' + '        ');
        Writeln('[]========================================[]');
    end;

    procedure DaAntiBan;
    begin
    case Random(10) of
         0: MouseBox(MIx1, MIy1, MIx2, MIy2, 3);
         1: AntiBan;
         2: PickUpMouse;
         3: HoverSkill('Woodcutting', False);
         4: LeaveScreenEvery(5 + random(10));
         5: BoredHuman;
         6: PickUpMouse;
         7: RotateEvery(20 + random(20));
         8: AlmostLogout;
         9: RandomChatEvery(10 + Random(5));
         10: MouseBox(MSx1, MSy1, MSx2, MSy2, 3);
    end;
    end;

    procedure FindingDaTree;
    begin
    repeat
    if FindObjMulti('Tree', 123, 456, 789, 10) then
    begin
    GetMousePos(x, y);
    Wait(100+random(10));
    MMouse(x,y,0,0);
    Wait(100+random(67));
    Mouse(x, y, 0, 0, True);
    Wait(10+random(20));
    KillAntiRandoms;
    Wait(10+random(5))
    DaAntiBan;
    Clicks:=Clicks+1;
    end;
    until(InvFull);
    end;

    procedure DropDaLogs;
    begin
    DropAllLogs; { WHats this meant to be?}
    Loads:=Loads+1;
    Wait(100+random(27));
    end;

    begin
    SetupSRL;
    repeat
    MySign;
    FindingDaTree;
    DropDaLogs;
    MyProggy;
    until(false);
    end.

  3. #3
    Join Date
    Dec 2006
    Posts
    173
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thank you for your corrections. Well I had more silly mistakes(like its a suprise). And Im going to change the dropdalogs procedure. DropAllLogs,is a procedure from srl (i think) but ill change it.

  4. #4
    Join Date
    Mar 2007
    Posts
    138
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Make a DTM, its really easy and sufficient. Read tuts and you can use DTM's with alot of stuff and very helpful

  5. #5
    Join Date
    Sep 2006
    Location
    New Jersey, USA
    Posts
    5,347
    Mentioned
    1 Post(s)
    Quoted
    3 Post(s)

    Default

    Mental, won't that still lag?


    SCAR Code:
    program AutoChopper;
    {========================================}
    {    Macho's AutoChopper V.02            }
    { By: Macho Man67                        }
    {========================================}
    {         Setup Information              }
    {  1) Set Client Window                  }
    {  2) Fill in Your Players at line 46-48 }
    {  3) Fill in Setup                      }
    {  4) Hit play and watch for first load  }
    {========================================}
    {         Extra Info                     }
    { This is my first real script so it may }
    { be buggy. Please post suggestions and  }
    { fixes in my post. Also all the         }
    { functions are straight from SRL        }
    {========================================}
    {         Credits                        }
    {-The whole SRL Community                }
    {-JAD for his tutorials                  }
    {-Junior for his randoms tutroial        }
    {Me_tal for all his help with the bugs   }
    {========================================}

    {=============Setup======================}
    const
      TreeColor1 = ; //Color of the tree you are cutting
      TreeColor2 = ; //Another color of the tree
      Treecolor3 = ; //Last color of the tree
    {===============End of Setup=============}
    {++++++++++++++++++++++++++++++++++++++++}
    {===========Setup=Players================}

    {.include SRL\SRL.scar}
    {.include SRL\SRL\skill\Woodcutting.scar}

    var
      Clicks, Loads: Integer;

    procedure DeclarePlayers;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name := '';
      Players[0].Pass := '';
      Players[0].Nick := '';

    end;

    procedure MySign;
    begin
      ClearDebug;
      Writeln('This is brought to you by:The Noobish  ');
      Writeln('        /--\      /--\                 ');
      Writeln('       /    \    /    \                ');
      Writeln('      /      \  /      \               ');
      Writeln('     /        \/        \              ');
      Writeln('    /       /\  /\       \             ');
      Writeln('   /       /  \/  \       \  acho Man67');
      Writeln('  /_______/        \_______\           ');
      Wait(2000 + random(550));
    end;

    procedure LoginDaPlayer;
    begin
      if (not (LoggedIn)) then
        LoginPlayer;
    end;

    procedure KillAntiRandoms;
    begin
      FindTalk;
      FindNormalRandoms;
      if (FindFight = true) then
      begin
        RunAwayDirection('N');
        Wait(10000 + random(3005));
        RunBack;
      end;
    end;

    procedure MyProggy;
    begin
      ClearDebug;
      Writeln('[]========================================[]');
      Writeln('------------>TheProgressReport<--------------');
      Writeln('  did ' + IntToStr(Loads) + ' Loads' + '    ');
      Writeln('---------------------------------------------');
      Writeln('  Did ' + IntToStr(Clicks) + ' Clicks' + '        ');
      Writeln('[]========================================[]');
    end;

    procedure DaAntiBan;
    begin
      case Random(10) of
        0: MouseBox(MIx1, MIy1, MIx2, MIy2, 3);
        1: AntiBan;
        2: PickUpMouse;
        3: HoverSkill('Woodcutting', False);
        4: LeaveScreenEvery(5 + random(10));
        5: BoredHuman;
        6: PickUpMouse;
        7: RotateEvery(20 + random(20));
        8: AlmostLogout;
        9: RandomChatEvery(10 + Random(5));
        10: MouseBox(MSx1, MSy1, MSx2, MSy2, 3);
      end;
    end;

    procedure FindingDaTree;
    begin
      repeat
        if FindObjMulti('Tree', 123, 456, 789, 10) then
        begin
          GetMousePos(x, y); //
          Wait(10 + random(10)); //
          MMouse(x, y, 0, 0); //  What's the point of all this?
          Wait(10 + random(67)); //
          Mouse(x, y, 0, 0, True); //
          Wait(10 + random(20)); //
          KillAntiRandoms;
          Wait(10 + random(5));
          DaAntiBan;
          Clicks := Clicks + 1;
        end;
        wait(10 + random(5));
      until (InvFull);
    end;

    procedure DropDaLogs;
    begin
      DropAllLogs;
      Loads := Loads + 1;
      Wait(100 + random(27));
    end;

    begin
      SetupSRL;
      DeclarePlayers;
      LoginDaPlayer;
      MySign;
      repeat
        FindingDaTree;
        DropDaLogs;
        MyProggy;
      until (false);
    end.
    Interested in C# and Electrical Engineering? This might interest you.

  6. #6
    Join Date
    Dec 2006
    Posts
    173
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thank you both Mental and Smatzkid, I am going to add you both to the credits(for helping me). Also Smatzkid I wondering if you could tell me why it lagged soo much?

  7. #7
    Join Date
    May 2007
    Location
    baltimore, md
    Posts
    836
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    the lag could possibly be from not enough wait time try making it like 50 ms
    it is unnoticably even up to 100 ms

  8. #8
    Join Date
    May 2007
    Location
    baltimore, md
    Posts
    836
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    o yea and also very nice script for first but you should try to learn failsafes and add them such as while your Cutting the tree
    SCAR Code:
    procedure FindingDaTree;
    begin
      repeat
        if FindObjMulti('Tree', 123, 456, 789, 10) then
        begin
          GetMousePos(x, y); //
          Wait(10 + random(10)); //
          MMouse(x, y, 0, 0); //  What's the point of all this?
          Wait(10 + random(67)); //
          Mouse(x, y, 0, 0, True); //
          Wait(10 + random(20)); //
          KillAntiRandoms;
          Wait(10 + random(5));
          DaAntiBan;
          Clicks := Clicks + 1;
        end;
        wait(10 + random(5));
      until (InvFull) or Clicks = 60;
    end;

    and also you should check the color of the text in the top right corner right here
    SCAR Code:
    procedure FindingDaTree;
    begin
      repeat
        if FindObjMulti('Tree', 123, 456, 789, 10) then
        begin
        if Findcolor(color of tree text x,y,yellow) then
        RunawayDirection('N');
         wait(7000+random(1000));
         runback;
          GetMousePos(x, y); //
          Wait(10 + random(10)); //
          MMouse(x, y, 0, 0); //  What's the point of all this?
          Wait(10 + random(67)); //
          Mouse(x, y, 0, 0, True); //
          Wait(10 + random(20)); //
          KillAntiRandoms;
          Wait(10 + random(5));
          DaAntiBan;
          Clicks := Clicks + 1;
        end;
        wait(10 + random(5));
      until (InvFull);
    end;

  9. #9
    Join Date
    Dec 2006
    Posts
    173
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Thank you jhildy. I saw you added a failsafe(or clicks=60) and I understand why you wanted to put in a function for finding the words in right hand corner, but I would have just added a if(IsUpText('hop')); and then after put a Mouse(x,y,0,0,true);. But thank you for the suggestions. You have boosted my self confidence and made me more determined to script more(As everyone above has too . Also I am going to look into putting in failsafes(dont want the script to hang)!

  10. #10
    Join Date
    May 2007
    Location
    baltimore, md
    Posts
    836
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    the tree color was for ents sorry i 4got to add that in but yea the 'hop' thing is another thing

    but yea i added that because of ents turns the tree text to yellow so if it saw that it would stop.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Scripting Help
    By Simtoon in forum OSR Help
    Replies: 0
    Last Post: 10-22-2008, 08:02 AM
  2. Looking for script requests and a scripting partner
    By Raskolnikov in forum RS3 Outdated / Broken Scripts
    Replies: 1
    Last Post: 06-30-2008, 12:01 PM
  3. New to scripting-first script-please help
    By Adamb_135 in forum OSR Help
    Replies: 9
    Last Post: 04-16-2007, 07:50 PM
  4. Scripting Help(first script)Im a noob
    By Macho Man67 in forum OSR Help
    Replies: 1
    Last Post: 03-15-2007, 03:29 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
  •