Results 1 to 9 of 9

Thread: Need help with script.

  1. #1
    Join Date
    May 2007
    Location
    NSW, Australia
    Posts
    2,823
    Mentioned
    3 Post(s)
    Quoted
    25 Post(s)

    Default Need help with my script. VERY WEIRD

    Im working on my WCer+FMER and for some reason when you run and have less then a full inv of wood it just freezes in that one spot. I was looking through i dnt know whats causing it.

    In the loop i do this:
    SCAR Code:
    DoWhatToCut;
        repeat
          repeat;
            WhatToCut;
    Finds what your wc lv is and then woodcuts what you can cut, used to work fine the i ran it once and it froze?

    And these are the woodcut bits:
    SCAR Code:
    procedure DoWhatToCut;
    begin
      if ((GetSkillLevel('woodcutting')) < 15) and
        ((GetSkillLevel('woodcutting')) >= 1) then
        TreeToCut := Normal;
      if ((GetSkillLevel('woodcutting')) < 30) and
        ((GetSkillLevel('woodcutting')) >= 15) then
        TreeToCut := Oak;
      if ((GetSkillLevel('woodcutting')) < 99) and
        ((GetSkillLevel('woodcutting')) >= 30) then
        TreeToCut := Willow;

    end;

    procedure WhatToCut;
    begin
      if (TreeToCut = Normal) then
      begin
        CutNormalLogs;
      end;
      if (TreeToCut = Oak) then
      begin
        CutOakLogs;
      end;
      if (TreeToCut = Willow) then
      begin
        CutWillowLogs;
      end;
    end;

    can someone please test or find the problem, thanks!

    SCAR Code:
    {:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    ------------------------------------------------------------------
    <:-------------BH - Rhimngton Woodcutter + Firemaker!----------:>
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    ::[Instructions]
    :: 1. Low Detail highest brightness!
    :: 2. Fill in the Declare Players
    :: 3. Put your characters somewhere where is alot of trees.
    :: 4. Drag the (+) into Runescape and press play!
    :: 5. Enjoy! Post progress reports and bugs.
    :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :: [Script History]
    :: (DATE) First Release!
    ::
    ::
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    ::[Credits]
    :: SantaClause, he helped me with a few procedures. Thanks!
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    :: [What does the script do]
    :: It woodcuts Normal Logs,Oaks and Willows then burns them.
    :: If gets stuck, i made to move somewhere else.
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

    {.include SRL\SRL.scar}

    {.include SRL\SRL\Skill\Woodcutting.SCAR}

    var
      Tinderbox, AxeH, WoodcutLv, FiremakeLv, TreeToCut, Normal, x, y: Integer;
      Oak, Willow, NL, OL, WL, Burnt, Swapplayer, EntAvoid: Integer;

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

      Players[0].Name := 'sggggg';
      Players[0].Pass := 'ggg';
      Players[0].Nick := 'arr'; //3 letters of your username, example jonno you would choose onn.
      Players[0].Active := True;

      Players[1].Name := 'Username';
      Players[1].Pass := 'Password';
      Players[1].Nick := 'Nickname'; //3 letters of your username, example jonno you would choose onn.
      Players[1].Active := True;

    {  Players[2].Name := 'Username';  // take away the { on the left to show these
      Players[2].Pass := 'Password';
      Players[2].Nick := 'Nickname'; //3 letters of your username, example jonno you would choose onn.
      Players[2].Active := True;

      Players[3].Name := 'Username';
      Players[3].Pass := 'Password';
      Players[3].Nick := 'Nickname'; //3 letters of your username, example jonno you would choose onn.
      Players[3].Active := True;

      Players[4].Name := 'Username';
      Players[4].Pass := 'Password';
      Players[4].Nick := 'Nickname'; //3 letters of your username, example jonno you would choose onn.
      Players[4].Active := True; }
    //Take away this to work properly (the })
      NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);

    end;
    procedure LoadCertainDTMT;
    begin
      Tinderbox := DTMFromString('78DA63DCCFCCC0B08A910119C4D973303C04D' +
        '220D1FF40C0B81BA8662EAA1A902C17540D987712A86636013567' +
        '806A9613507304A8662301353B816A361350B301A8663D01351B8' +
        '16A961150B30DA866217E35005E0E1297');
    end;
    procedure LoadCertainDTMNL;
    begin
      NL := DTMFromString('78DA63E465616058CAC80002109281A125D59' +
           '6E12194FF1F081839806AE6C3646100550FA310116AA4816AE612' +
           '50230F54B39C801A39A09AF504D48802D56C24A0861BA8660B013' +
           '520BF6F20A08609A8661501356C4035CBF0AB010069480E46');
    end;
    procedure LoadCertainDTMOL;
    begin
      OL := DTMFromString('78DA63DCCDCCC0708A9101194CC877627808A' +
        '441A2FF8180710B50CD61543510591809A4F711A1E638116A4E62' +
        'BA0743CD19A09A0B04D41C02AAB94240CD56A09A6B04D4AC03AAB' +
        '94440CD26A09A93F8D50000C00C15B6');
    end;
    procedure LoadCertainDTMWL;
    begin
      WL := DTMFromString('78DA637CC6CCC0708A91011984F9CA333C04D' +
        '220D1FF40C0780FA8E630AA1A882C8C04D22F8850F311A8E62001' +
        '35DF806ACE1350F31AA8E62A01354F806AAE13507317A8E60A013' +
        '537816A4EE357030026DF1521');
    end;

    procedure LoadDTMS;
    begin
      Tinderbox := DTMFromString('78DA63DCCFCCC0B08A910119C4D973303C04D' +
        '220D1FF40C0B81BA8662EAA1A902C17540D987712A86636013567' +
        '806A9613507304A8662301353B816A361350B301A8663D01351B8' +
        '16A961150B30DA866217E35005E0E1297');
      AxeH := DTMFromString('78DA63EC63666058C1C8800C9A92781974804' +
        '220D1FF40C0D80D54B305550D48968B01A206CCEB01AA5949400D' +
        'C8AE8504D44C04AA994540CD1CA09AD944A8594C847BD61150D30' +
        'B54B309BF1A00B817109E');
      NL := DTMFromString('78DA63E465616058CAC80002109281A125D59' +
           '6E12194FF1F081839806AE6C3646100550FA310116AA4816AE612' +
           '50230F54B39C801A39A09AF504D48802D56C24A0861BA8660B013' +
           '520BF6F20A08609A8661501356C4035CBF0AB010069480E46');
      OL := DTMFromString('78DA63DCCDCCC0708A9101194CC877627808A' +
        '441A2FF8180710B50CD61543510591809A4F711A1E638116A4E62' +
        'BA0743CD19A09A0B04D41C02AAB94240CD56A09A6B04D4AC03AAB' +
        '94440CD26A09A93F8D50000C00C15B6');
      WL := DTMFromString('78DA637CC6CCC0708A91011984F9CA333C04D' +
        '220D1FF40C0780FA8E630AA1A882C8C04D22F8850F311A8E62001' +
        '35DF806ACE1350F31AA8E62A01354F806AAE13507317A8E60A013' +
        '537816A4EE357030026DF1521');

    end;



    procedure FindTinderDTM;
    begin
      if FindDTM(Tinderbox, x, y, 553, 209, 725, 457) then
      begin
        MMouse(x, y, 1, 1);
        if (IsUpText('ind')) then
          Writeln('Tinderbox found!');
        wait(1000);
      end;
      begin
        if FindDTM(AxeH, x, y, 553, 209, 725, 457) then
        begin
          Writeln('Axe found!')
            MMouse(x, y, 1, 1);
          if (IsUpText('axe')) then
            wait(1000);
          Exit;
        end else
          Writeln('Tinderbox or axe not found, Make sure its in your Inventory');
        TerminateScript;
      end;
    end;

    procedure Check;
    begin
      GameTab(4);
      LoadDTMS;
      FindTinderDTM;
      FreeDTM(AxeH);
      FreeDTM(TinderBox);
    end;

    procedure MoveIfProblem;
    begin
      MouseFindFlag(643, 78, 2, 2)
    end;

    procedure FmOak;
    begin
      if FindDTM(OL, x, y, 553, 209, 725, 457) then
      begin
        MMouse(x, y, 5, 5);
        if IsUpText('Oak') then
        begin
          if FindDTM(Tinderbox, x, y, 553, 209, 725, 457) then
          begin
            MMouse(x, y, 1, 1);
            if (IsUpText('ind')) then
              mouse(x, y, 4, 4, true);
            if FindDTM(OL, x, y, 553, 209, 725, 457) then
            begin
              Mouse(x, y, 5, 5, true);
            end;
          end;
        end;
      end;
    end;

    procedure FmNormal;
    begin
      if FindDTM(NL, x, y, 553, 209, 725, 457) then
      begin
        MMouse(x, y, 5, 5);
        if IsUpText('Logs') then
        begin
          if FindDTM(Tinderbox, x, y, 553, 209, 725, 457) then
          begin
            MMouse(x, y, 1, 1);
            if (IsUpText('ind')) then
              mouse(x, y, 4, 4, true);
            if FindDTM(NL, x, y, 553, 209, 725, 457) then
            begin
              Mouse(x, y, 5, 5, true);
            end;
            //Begins Drop
            begin
              if FindDTM(OL, x, y, 553, 209, 725, 457) then
              begin
                MMouse(x, y, 2, 2)
                  if IsUpText('Oak') then
                begin
                  Mouse(x, y, 3, 3, false);
                  Wait(200 + Random(50)); ;
                  ChooseOption('Drop');
                end;
              end;
            end;

          end;
        end;
      end;
    end;
    function FindOakWriting : Boolean;
    begin
    if InChatMulti('15', 'emaking', 'eed') then
          Wait(100 + Random(100));
          FindTalk;
          if (not (LoggedIn)) then
            Exit;
    end;

    procedure CantLightWaitBH;
    begin
      if InChatMulti('can', 'ire h', 'lig') then
      begin
      MouseFindFlag(643, 78, 2, 2);
      end;

    end;


    procedure LightWaitBH;
    begin
      if InChatMulti('att', 'emp', 'lig') then
        repeat
          Wait(100 + Random(100));
          FindTalk;
          if (not (LoggedIn)) then
            Exit;
        until InChatMulti('cat', 'urn', 'ire');
    end;



    procedure LightLogs;
    begin
      if FindDTM(Tinderbox, x, y, 553, 209, 725, 457) then
      begin
        MMouse(x, y, 1, 1);
        if (IsUpText('ind')) then
          wait(100);
        Mouse(x, y, 5, 5, true);
      end;
      begin
        if FindDTM(NL, x, y, 553, 209, 725, 457) then
          if FindDTM(OL, x, y, 553, 209, 725, 457) then
            if FindDTM(WL, x, y, 553, 209, 725, 457) then
            begin
              MMouse(x, y, 5, 5);
              wait(500);
              if IsUpTextMulti('Logs','Willow','Oak') then
              mouse(x, y, 1, 1, true);
              LightWaitBH;
              CantLightWaitBH;
            end;
      end;
      end;




    procedure check1;
    begin
      Setrun(false);
      WoodcutLv := GetSkillLevel('woodcutting')
      FiremakeLv := GetSkillLevel('firemaking')
      WriteLn('Starting WC level: ' + IntToStr(WoodcutLv));
      WriteLn('Starting FM level: ' + IntToStr(FiremakeLv));
    end;

    procedure CutNormalLogs;
    begin
     if invfull then
     begin Exit;
      wait(2000 + random(2000));
      if FindObj(x, y, 'Tree', 4690821, 5) then
      begin
        getmousepos(x, y);
        mouse(x, y, 0, 0, true);
        if Invfull then
        begin
          LightLogs;
          end;
        end;
      end;
    end;

    procedure CutOakLogs;
    begin
     if invfull then
     begin Exit;
      wait(6000 + random(2000));
      if FindObj(x, y, 'Oak', 4690821, 5) then
      begin
        getmousepos(x, y);
        mouse(x, y, 0, 0, true);
        end;
      end;
    end;

    procedure CutWillowLogs;
    begin
     if invfull then
     begin Exit;
      wait(8000 + random(2000));
      if FindObj(x, y, 'Willow', 4690821, 5) then
      begin
        getmousepos(x, y);
        mouse(x, y, 0, 0, true);
      end;
     end;
    end;

    procedure DoWhatToCut;
    begin
      if ((GetSkillLevel('woodcutting')) < 15) and
        ((GetSkillLevel('woodcutting')) >= 1) then
        TreeToCut := Normal;
      if ((GetSkillLevel('woodcutting')) < 30) and
        ((GetSkillLevel('woodcutting')) >= 15) then
        TreeToCut := Oak;
      if ((GetSkillLevel('woodcutting')) < 99) and
        ((GetSkillLevel('woodcutting')) >= 30) then
        TreeToCut := Willow;

    end;

    procedure WhatToCut;
    begin
      if (TreeToCut = Normal) then
      begin
        CutNormalLogs;
      end;
      if (TreeToCut = Oak) then
      begin
        CutOakLogs;
      end;
      if (TreeToCut = Willow) then
      begin
        CutWillowLogs;
      end;
    end;
    begin
      ActivateClient;
      SetupSRL;
      ActivateClient;
      wait(100);
      DeclarePlayers;
      if (not (loggedIn)) then
      begin
        LoginPlayer;
      end;
      begin
        Check;
        check1
        DoWhatToCut;
        repeat
          repeat;
            WhatToCut;
          until (invfull);
          if (invfull) then
          begin
            repeat
              LightLogs;
            until (InvCount = 26);
          end;
        until (false);
      end;
    end.

  2. #2
    Join Date
    Mar 2006
    Posts
    13,241
    Mentioned
    228 Post(s)
    Quoted
    267 Post(s)

    Default

    You left pass in script Check your pm for new pass
    STOP PM'ING ME

  3. #3
    Join Date
    May 2007
    Location
    NSW, Australia
    Posts
    2,823
    Mentioned
    3 Post(s)
    Quoted
    25 Post(s)

    Default

    Thanks, i noticed that after i posted so i editted

    Rep+

  4. #4
    Join Date
    Jan 2007
    Posts
    117
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    i couldnt tell from looking at the script, sry, perhaps u could either use debug statements or use status changes to try to pinpoint the problem?
    No Signature Assigned.

  5. #5
    Join Date
    May 2007
    Location
    NSW, Australia
    Posts
    2,823
    Mentioned
    3 Post(s)
    Quoted
    25 Post(s)

    Default

    Quote Originally Posted by joerobo View Post
    i couldnt tell from looking at the script, sry, perhaps u could either use debug statements or use status changes to try to pinpoint the problem?
    The only thing that it could be is the Woodcutting part but it makes no sence why it would just lag super bad.

    Was working fine before.

  6. #6
    Join Date
    Jan 2007
    Posts
    117
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hmmm not nescesarily, for example if for someone reason treetocut did not get set (i know it definitely looks as though it should) then the repeat loop containing whattocut would repeat endlessly. try doing:
    SCAR Code:
    DoWhatToCut;
        writeln(treetocut);
        repeat
    just to check on the off chance that what i suggested earlier isn the problem. Also perhaps this is a good indication that inpointing your problem might be beneficial. gd luck!
    No Signature Assigned.

  7. #7
    Join Date
    May 2007
    Location
    NSW, Australia
    Posts
    2,823
    Mentioned
    3 Post(s)
    Quoted
    25 Post(s)

    Default

    I found it, it doesnt make sence but here it is:

    I took
    SCAR Code:
    if invfull then
     begin Exit;

    out of the start of the tree its going to woodcut. Why would it work now?

    New Error:
    [Runtime Error] : Exception: Access violation at address 006FFBEA in module 'scar.exe'. Read of address 00000000 in line 247 in script

    Is this because i called Free(Dtm) thing?

  8. #8
    Join Date
    Jan 2007
    Posts
    117
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by bobbohobbo View Post
    I found it, it doesnt make sence but here it is:

    I took
    SCAR Code:
    if invfull then
     begin Exit;

    out of the start of the tree its going to woodcut. Why would it work now?
    ahh nice 1. wat happened is u missed off an end after exit.. but really all you need to do is to remove the begin:
    SCAR Code:
    if invfull then exit;
    thats all you need. the problem was that without an end it menat that your whole woodcutting procedure would only take place 'if invfull' , kinda counterintuative. hope u understand this nd that yr script is working now, if nt then continue to post for help nd i ll do my best lol...


    edit- i posted before yr edit, im not too gr8 on access violations, never quite understood them, try JAD's tut on avoiding irritating errors (its called something like that)
    No Signature Assigned.

  9. #9
    Join Date
    May 2007
    Location
    NSW, Australia
    Posts
    2,823
    Mentioned
    3 Post(s)
    Quoted
    25 Post(s)

    Default

    Quote Originally Posted by joerobo View Post
    ahh nice 1. wat happened is u missed off an end after exit.. but really all you need to do is to remove the begin:
    SCAR Code:
    if invfull then exit;
    thats all you need. the problem was that without an end it menat that your whole woodcutting procedure would only take place 'if invfull' , kinda counterintuative. hope u understand this nd that yr script is working now, if nt then continue to post for help nd i ll do my best lol...


    edit- i posted before yr edit, im not too gr8 on access violations, never quite understood them, try JAD's tut on avoiding irritating errors (its called something like that)
    Kk thanks, i read about the Acces the before, i just found it again. Hope i get noo more errors. Im gonna rep+ you becuase your the only one that helped thnx

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
  •