Results 1 to 9 of 9

Thread: Need help with first script

  1. #1
    Join Date
    Dec 2009
    Posts
    380
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default Need help with first script

    EDIT: And sorry if this is the wrong section.

    So I was following YoHoJo's tutorial for making my first script.

    I understand there's a thread for it Here but I posted there and had no luck so I'm hoping I can get an answer here.

    So this is the script so far:
    Simba Code:
    Program PowerChopper;

    //{$DEFINE SMART}
    {$i SRL\SRL.simba}


    Const
      SRLStats_Username = '';// Your SRL Stats Username
      SRLStats_Password = '';// Your SRL Stats Password
      BreakEvery        = 120; //How Many Minutes To Break After
      BreakFor          = 20; //How Long To Break For
      Version           = '1.0';


    procedure DeclarePlayer;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := ''; //Your Runescape username
      Players[0].Pass := ''; //Your Runescape password
      Players[0].Active := True;
    end;

    Procedure StatsGuise(wat:String);
    Begin
      Status(wat);
      Disguise(wat);
    End;

    Function CheckAndClick(Uptext, Option:String; X,Y:Integer; RClick:Boolean):Boolean;
    Begin
      MMouse(x, y, 5, 5)
      If WaitUptext(UpText, 1500+Random(500)) Then
      Begin
        Result:=True;
        GetMousePos(x, y);
        If RClick Then
        Begin
          Mouse(x, y, 0, 0, False);
          Result:= WaitOption(Option, 5000);
          If Result Then FFlag(0);
        End Else
        Begin
          Mouse(x, y, 0, 0, True);
          Wait(100+Random(100));
          FFlag(0);
        End;
      End;
    End;

    Procedure Antiban;
    Begin
      Case Random(250) Of
        0: Begin StatsGuise('AntiBan') GameTab(tab_Inv) ExamineInv; GameTab(28); End;
        1: Begin StatsGuise('AntiBan') RandomAngle(1); End;
        2: Begin StatsGuise('AntiBan') GameTab(tab_Stats) HoverSkill('Woodcutting', False); GameTab(tab_Inv); End;
        3: Begin StatsGuise('AntiBan') GameTab(tab_Stats); Wait(3000+Random(500)); GameTab(tab_Inv); End;
      End;
    End;

    Procedure FailSafe(Reason:String);
    Begin
      Players[CurrentPlayer].Loc:=Reason;
      Logout;
      Stats_Commit;
      TerminateScript;
    End;

    Function ChopDown:Boolean;
    Var
      seX, seY: Integer;
    Begin
      if FindObjCustom(seX, seY, ['Chop', 'Down'], [1056282, 1582114], 5) Then
      begin
        StatsGuise('Hooray, we found a tree');

        GetMousePos(seX, seY);
        Case Random(2) Of
          0: Mouse(seX, seY, 5, 5, True);
          1: Begin
               Mouse(seX, seY, 5, 5, False);
               WaitOption('Chop', 500);
              End;
        End;

      End;
    End;
    begin
      SetupSRL;
      DeclarePlayer;
      //repeat
        ChopDown;
      //until(false);
    end.

    I stopped scripting up to the point in the video where YoHoJo begins to test the script by having it cut down a few trees one at a time.

    When I hit play, the mouse will go to a tree, kind of does a "twitch" (stays on the tree color, but kind of shakes a bit), and then I get this error:

    Code:
    New window: 14288022
    [Hint] (71:10): Variable 'Result' never used at line 70
    Compiled successfully in 578 ms.
    SRL Compiled in 0 msec
    Exception: Range check error at line 840
    The following DTMs were not freed: [SRL - Lamp bitmap, 1]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]
    Can anyone help me out?

  2. #2
    Join Date
    Feb 2012
    Location
    Somewhere, over the rainbow...
    Posts
    2,272
    Mentioned
    3 Post(s)
    Quoted
    45 Post(s)

    Default

    Take away the capital letters in your uptexts and options

    Should be:

    ['hop', 'own']
    WaitOption('hop', 500);

  3. #3
    Join Date
    Dec 2009
    Posts
    380
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by abu_jwka View Post
    Take away the capital letters in your uptexts and options

    Should be:

    ['hop', 'own']
    WaitOption('hop', 500);
    THANK YOU SO MUCH! I knew I made a stupid mistake somewhere

  4. #4
    Join Date
    Oct 2011
    Location
    Australia, Vic
    Posts
    1,517
    Mentioned
    2 Post(s)
    Quoted
    120 Post(s)

    Default

    Quote Originally Posted by Roflme View Post
    THANK YOU SO MUCH! I knew I made a stupid mistake somewhere
    Mistakes aren't Stupid, There part of learning

  5. #5
    Join Date
    Dec 2011
    Location
    Nj
    Posts
    2,341
    Mentioned
    1 Post(s)
    Quoted
    18 Post(s)

    Default

    Shizz, Wasn't first to answer...

    For the basics of the basics of pascal, try my TuT. ||Photoshop Editing ||MapleResourceDung Script || Book a flight! BuySellTrip

  6. #6
    Join Date
    Dec 2009
    Posts
    380
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default Need more help :(

    So to save this section from another thread I'll just add a post here.

    I continued with the script and am now have this:

    Simba Code:
    Program PowerChopper;

    //{$DEFINE SMART}
    {$i SRL\SRL.simba}


    Const
      SRLStats_Username = '';   // Your SRL Stats Username
      SRLStats_Password = '';   // Your SRL Stats Password
      BreakEvery        = 120;  //How Many Minutes To Break After
      BreakFor          = 20;   //How Long To Break For
      Version           = '1.0';


    procedure DeclarePlayer;
    begin
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;
      Players[0].Name := ''; //Your Runescape username
      Players[0].Pass := ''; //Your Runescape password
      Players[0].Active := True;
    end;

    Procedure StatsGuise(wat:String);
    Begin
      Status(wat);
      Disguise(wat);
    End;

    Function CheckAndClick(Uptext, Option:String; X,Y:Integer; RClick:Boolean):Boolean;
    Begin
      MMouse(x, y, 5, 5)
      If WaitUptext(UpText, 1500+Random(500)) Then
      Begin
        Result:=True;
        GetMousePos(x, y);
        If RClick Then
        Begin
          Mouse(x, y, 0, 0, False);
          Result:= WaitOption(Option, 5000);
          If Result Then FFlag(0);
        End Else
        Begin
          Mouse(x, y, 0, 0, True);
          Wait(100+Random(100));
          FFlag(0);
        End;
      End;
    End;

    Procedure Antiban;
    Begin
      Case Random(250) Of
        0: Begin StatsGuise('AntiBan') GameTab(tab_Inv) ExamineInv; GameTab(28); End;
        1: Begin StatsGuise('AntiBan') RandomAngle(1); End;
        2: Begin StatsGuise('AntiBan') GameTab(tab_Stats) HoverSkill('Woodcutting', False); GameTab(tab_Inv); End;
        3: Begin StatsGuise('AntiBan') GameTab(tab_Stats); Wait(3000+Random(500)); GameTab(tab_Inv); End;
      End;
    End;

    Procedure FailSafe(Reason:String);
    Begin
      Players[CurrentPlayer].Loc:=Reason;
      Logout;
      Stats_Commit;
      TerminateScript;
    End;

    Function ChopDown:Boolean;
    Var
      seX, seY, PlusOne, TreeCounter: Integer;
    Begin
      PlusOne:= InvCount + 1;
      if FindObjCustom(seX, seY, ['hop', 'own'], [1056282, 1582114], 5) Then
      begin
        StatsGuise('Hooray, we found a tree');
        GetMousePos(seX, seY);

        Case Random(1) Of
          0: Mouse(seX, seY, 5, 5, True);
          1: Begin
               Mouse(seX, seY, 5, 5, False);
               WaitOption('hop', 500);
             End;
        End;

        Repeat
          MarkTime(TreeCounter);
          AntiBan;
          Wait(200);
        Until (InvCount=PlusOne) Or (TimeFromMark(TreeCounter) > 7000)

      End;
    End;
    begin
      SetupSRL;
      DeclarePlayer;
      repeat
        ChopDown;
      until(false);
    end.

    And still got the same error!
    Code:
    New window: 5571526
    [Hint] (72:10): Variable 'Result' never used at line 71
    Compiled successfully in 578 ms.
    SRL Compiled in 0 msec
    Exception: Range check error at line 286
    The following DTMs were not freed: [SRL - Lamp bitmap, 1]
    The following bitmaps were not freed: [SRL - Mod bitmap, SRL - Admin bitmap, SRL - Flag bitmap]

    When ChopDown is like:
    Simba Code:
    //repeat
        ChopDown;
      //until(false)
    It can click a tree successfully (I was unable to do that before). But for some reason it does not like to repeat

    If anyone can tell me what I did now to cause this I'd highly appreciate it

  7. #7
    Join Date
    May 2012
    Location
    England
    Posts
    52
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I'm going to follow his tutorials now =D Wonder if I'll arrive at the same error =3

    Also, if you're still only at this stage (same as me) you should add me as a friend ^-^ we can climb through the ranks of scripting awesomeness together xD

  8. #8
    Join Date
    Jan 2012
    Location
    Calgary, AB, Canada
    Posts
    1,819
    Mentioned
    5 Post(s)
    Quoted
    120 Post(s)

    Default

    Since you're not using Results in you ChopDown function you might as well make it a procedure which would also fix your problem.

    Like this:

    Simba Code:
    Procedure ChopDown;
    Var
      seX, seY, PlusOne, TreeCounter: Integer;
    Begin
      PlusOne:= InvCount + 1;
      if FindObjCustom(seX, seY, ['hop', 'own'], [1056282, 1582114], 5) Then
      begin
        StatsGuise('Hooray, we found a tree');
        GetMousePos(seX, seY);

        Case Random(1) Of
          0: Mouse(seX, seY, 5, 5, True);
          1: Begin
               Mouse(seX, seY, 5, 5, False);
               WaitOption('hop', 500);
             End;
        End;

        Repeat
          MarkTime(TreeCounter);
          AntiBan;
          Wait(200);
        Until (InvCount=PlusOne) Or (TimeFromMark(TreeCounter) > 7000)

      End;
    End;

    Or if you want it as a function(not sure why) I think it would have to be:

    Simba Code:
    repeat
      ChopDown(x, y)
    until(false)
    Current Project: Retired

  9. #9
    Join Date
    Dec 2009
    Posts
    380
    Mentioned
    0 Post(s)
    Quoted
    8 Post(s)

    Default

    Quote Originally Posted by Gucci View Post
    Since you're not using Results in you ChopDown function you might as well make it a procedure which would also fix your problem.

    Like this:

    Simba Code:
    Procedure ChopDown;
    Var
      seX, seY, PlusOne, TreeCounter: Integer;
    Begin
      PlusOne:= InvCount + 1;
      if FindObjCustom(seX, seY, ['hop', 'own'], [1056282, 1582114], 5) Then
      begin
        StatsGuise('Hooray, we found a tree');
        GetMousePos(seX, seY);

        Case Random(1) Of
          0: Mouse(seX, seY, 5, 5, True);
          1: Begin
               Mouse(seX, seY, 5, 5, False);
               WaitOption('hop', 500);
             End;
        End;

        Repeat
          MarkTime(TreeCounter);
          AntiBan;
          Wait(200);
        Until (InvCount=PlusOne) Or (TimeFromMark(TreeCounter) > 7000)

      End;
    End;

    Or if you want it as a function(not sure why) I think it would have to be:

    Simba Code:
    repeat
      ChopDown(x, y)
    until(false)
    Nooby question, why do I need the (x, y) if it's a function?

    I just made it a function from following the video but never understood why. I thought a procedure would have worked just as fine, which you have confirmed with that post.


    Quote Originally Posted by Mufasa View Post
    I'm going to follow his tutorials now =D Wonder if I'll arrive at the same error =3

    Also, if you're still only at this stage (same as me) you should add me as a friend ^-^ we can climb through the ranks of scripting awesomeness together xD

    I can add you and we can chat, but until July I'm going to be extremely busy and don't even know when I'll be able to continue the tutorial. Nonetheless, I'd love to learn how to script alongside someone
    Last edited by Roflme; 05-28-2012 at 04:07 PM.

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
  •