Results 1 to 5 of 5

Thread: What is wrong with this function?

  1. #1
    Join Date
    Dec 2007
    Location
    Michigan, USA
    Posts
    280
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default What is wrong with this function?

    SCAR Code:
    Function FindAxeIn: Boolean;
    var
      axe: Integer;
    begin
      axe := DTMFromString('78DA6374636260D0676440066D2902601A26C' +
           'AE80454638BAA06260B57E300546345408D07508D320135414035' +
           '2A04D48402D56811618E2E7E3500C7870471');
      Gametab(5);
      wait(1000);
      If (finddtm(axe, x, y, MIX1, MIY1, MIX2, MIY2)) then
        Writeln('Axe Found');
      else
        result := false;
      Gametab(4);
      wait(1000);
      If finddtm(axe, x, y, MIX1, MIY1, MIX2, MIY2) then
        Writeln('Axe Found');
      else
        result := false;
    end;
    Any ideas? I keep getting the 'Identifier expected in script' error... idk whats wrong though help would be greatly appreciated
    Kindof Inactive...

  2. #2
    Join Date
    May 2007
    Location
    Netherlands, Amersfoort
    Posts
    2,701
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    wrong:
    SCAR Code:
    If (finddtm(axe, x, y, MIX1, MIY1, MIX2, MIY2)) then
        Writeln('Axe Found'); // kill this ;
      else
        result := false;
    correct:
    SCAR Code:
    If (finddtm(axe, x, y, MIX1, MIY1, MIX2, MIY2)) then
      Writeln('Axe Found') else result := false;
    good luck scripting.

  3. #3
    Join Date
    Dec 2007
    Location
    Michigan, USA
    Posts
    280
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by MasterKill View Post
    wrong:
    SCAR Code:
    If (finddtm(axe, x, y, MIX1, MIY1, MIX2, MIY2)) then
        Writeln('Axe Found'); // kill this ;
      else
        result := false;
    correct:
    SCAR Code:
    If (finddtm(axe, x, y, MIX1, MIY1, MIX2, MIY2)) then
      Writeln('Axe Found') else result := false;
    good luck scripting.
    Thanks alot man, and thanks for the encouragement.
    Kindof Inactive...

  4. #4
    Join Date
    Jan 2008
    Location
    UK
    Posts
    500
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    You never had result := true; in there so even it if found an axe it would be false. As a rule, unless result is declared it is false. so in this case you do not need to declare result := false.

    SCAR Code:
    Function FindAxeIn: Boolean;
    var
      axe: Integer;
    begin
      axe := DTMFromString('78DA6374636260D0676440066D2902601A26C' +
           'AE80454638BAA06260B57E300546345408D07508D320135414035' +
           '2A04D48402D56811618E2E7E3500C7870471');
      Gametab(5);
      wait(1000);
      If finddtm(axe, x, y, MIX1, MIY1, MIX2, MIY2) then
        begin
          Writeln('Axe Found');
          result := true;
          exit;
        end;
      Gametab(4);
      wait(1000);
      If finddtm(axe, x, y, MIX1, MIY1, MIX2, MIY2) then
        begin
          Writeln('Axe Found');
          result := true;
        end;
    end;
    For the Ultimate Monk Fisher: Ultra Monkfish n Bank Click Here


  5. #5
    Join Date
    Dec 2007
    Location
    Michigan, USA
    Posts
    280
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Quote Originally Posted by PriSoner View Post
    You never had result := true; in there so even it if found an axe it would be false. As a rule, unless result is declared it is false. so in this case you do not need to declare result := false.

    SCAR Code:
    Function FindAxeIn: Boolean;
    var
      axe: Integer;
    begin
      axe := DTMFromString('78DA6374636260D0676440066D2902601A26C' +
           'AE80454638BAA06260B57E300546345408D07508D320135414035' +
           '2A04D48402D56811618E2E7E3500C7870471');
      Gametab(5);
      wait(1000);
      If finddtm(axe, x, y, MIX1, MIY1, MIX2, MIY2) then
        begin
          Writeln('Axe Found');
          result := true;
          exit;
        end;
      Gametab(4);
      wait(1000);
      If finddtm(axe, x, y, MIX1, MIY1, MIX2, MIY2) then
        begin
          Writeln('Axe Found');
          result := true;
        end;
    end;
    Ohh yeah, I never thought about that, thanks. Sorry this is my first function so I don't really understand them 100% yet.... thanks for the help though guys\

    Edit: Ok... now it doesn't find the axe dtm.... it doesn't even click on the game tabs.... can someone help me out here?
    heres the script:
    SCAR Code:
    {/////|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\\\\\
    /////|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||\\\\\
    |||||/                                                                   \|||||
    |||||                   PowerCutter Ver 3 Mikevskater                     |||||
    |||||              This ver only cuts normal, oak, and willows            |||||
    |||||          BIG Shout Out to JAD for his great tuts and advice!        |||||
    |||||            Thanks ALOT to pwnaz0r for fixing my cut procedure!      |||||
    |||||  Also big thanks to Timer, as well as richk1693 for all their help  |||||
    |||||\              Start by a bunch of trees with axe equppied          /|||||
    \\\\\|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||/////
     \\\\\|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||/////
    }

    program FirstScript;
    {.include srl/srl.scar}
    {.include srl/srl/skill/woodcutting.scar}

    var
      x, y, Logs, Clicks, TreeColor, xp: Integer;
      TreeName, Log: String;

    const
      Treetype = 'Willow';//Valid Trees are Tree, Oak, and Willow. More to come later.
     
    ////////////////////////////////////////////////////////////////////////////////
    procedure DeclarePlayers;
    begin
      SRLID := '';       //enter or script will terminate
      SRLPassword := ''; //register at srl please if dont have one of these!
      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      Players[0].Name   := '';//Enter username
      Players[0].Pass   := '';//Enter password
      Players[0].Nick   := '';    //Enter nickname
      Players[0].Active := True;
    end;
    ////////////////////////////////////////////////////////////////////////////////
    procedure Anti;
    begin
      FindNormalRandoms;
      if FindFight then
        RunAway('N', True, 1, 9000+random(1000));
    end;
    ////////////////////////////////////////////////////////////////////////////////
    procedure Antiban;
    begin
      case random(20) of
        0,3,6: BoredHuman;
        4,7,10: RandomMovement;
        8,11,14: PickUpMouse;
        12,15,18: HoverSkill('woodcutting', false);
        16,19: begin
                 Gametab(random(13+1));
                 wait(random(1000)+random(500));
                 Gametab(random(13+1));
                 wait(random(1000)+random(500));
                 Gametab(random(13+1));
                 wait(random(1000)+random(500));
                 gametab(4);
               end;
      end;
    end;
    ////////////////////////////////////////////////////////////////////////////////
    Function FindAxeIn: Boolean;
    var
      axe: Integer;
    begin
      axe := DTMFromString('78DA6374636260D0676440066D2902601A26C' +
           'AE80454638BAA06260B57E300546345408D07508D320135414035' +
           '2A04D48402D56811618E2E7E3500C7870471');
      Gametab(5);
      wait(1000);
      If finddtm(axe, x, y, MIX1, MIY1, MIX2, MIY2) then
        begin
          Writeln('Axe Found');
          result := true;
          exit;
        end;
      Gametab(4);
      wait(1000);
      If finddtm(axe, x, y, MIX1, MIY1, MIX2, MIY2) then
        begin
          Writeln('Axe Found');
          result := true;
        end;
      freedtm(axe);
    end;
    ////////////////////////////////////////////////////////////////////////////////
    Procedure CheckForBrokenAxe;
    var
      x, y, BrokenAxe: Integer;
    begin
      BrokenAxe := DTMFromString('78DA636C616260E0636440061D697C601A26C' +
      'AD80354C38FAA06260B57D30754C34D404D2F508D080135CD4035' +
      '5C04D4D400D5A8E05703008C0604B4');
      Gametab(4);
      wait(1000);
      if finddtm(BrokenAxe, x, y, MIX1, MIY1, MIX2, MIY2) then
        Logout;
      freedtm(BrokenAxe);
    end;
    ////////////////////////////////////////////////////////////////////////////////
    procedure Cut;
    var
      Inv, z: Integer;
    begin
      repeat
        CheckForBrokenAxe;
        if FindColorTolerance(x , y, treecolor, MSX1, MSY1, MSX2, MSY2, 15) then
        begin
          mmouse(x,y,0,0);
          wait(500);
          if isuptext(treename) and not(findent(x, y, true)) then
          begin
            Inv := InvCount;
            Mouse(x, y, 0, 0, True);
            z := 0;
            FFlag(0);
            Clicks := Clicks + 1
            ReportVars[1] := ReportVars[1] + 1;
            Anti;
            repeat
              wait(250+random(250));
              z := z+1;
              Anti;
            until(InvCount > Inv) or (z > 100) or InvFull;
            Anti;
          end;
        end;
      until(InvFull);
    end;
    ////////////////////////////////////////////////////////////////////////////////
    Procedure Drop;// By Timer150
    var
      i: Integer;
      ItemPoint: TPoint;
    begin
      GameTab(4);
      Wait(500 + Random(500));
      for i := 1 to 28 do
        if (ExistsItem(i)) then
        begin
          ItemPoint := ItemCoords(i);
          MMouse(ItemPoint.x, ItemPoint.y, 5, 5);
          Wait(250 + Random(60));
          if IsUpText(Log) then
          begin
            Mouse(ItemPoint.x, ItemPoint.y, 5, 5, False);
            Wait(250 + Random(50));
            ChooseOption('rop');
            logs := logs + 1;
            ReportVars[0] := ReportVars[0] + 1;
            case Treename of
            'ree': begin
                     xp := xp + 25;
                     ReportVars[2] := ReportVars[2] + 25;
                   end;
            'ak': begin
                    xp := xp + 37;
                    ReportVars[2] := ReportVars[2] + 37;
                  end;
            'illow': begin
                       xp := xp + 67;
                       ReportVars[2] := ReportVars[2] + 67;
                     end;
            end;
          end;
        end;
      ArrangeInv;
    end;
    ////////////////////////////////////////////////////////////////////////////////
    procedure Proggy;
    begin
      ClearDebug;
      Writeln('/-----------------------------------\');
      Writeln('|    PowerCutter by MikeVSkater     |');
      Writeln('\-----------------------------------/');
      Writeln('/-----------------------------------\');
      writeln('Clicks: ' + inttostr(clicks));
      Writeln('Logs: ' + inttostr(logs));
      Writeln('Time: ' + TimeRunning);
      Writeln('Xp Gaind: ' + inttostr(xp));
      Writeln('\-----------------------------------/');
    end;
    ////////////////////////////////////////////////////////////////////////////////
    procedure Signature;
    begin
      ClearDebug;
      Writeln('PowerCutter made by Mikevskater');
      wait(1000);
      Writeln('This is my first script so please help me '+
       'on anything you know that I dont?');
      Wait(5000+random(1000))
    end;
    ////////////////////////////////////////////////////////////////////////////////
    procedure Setup;
    begin
      case LowerCase(TreeType) of
      'Tree': begin
                TreeColor := 1190181;
                TreeName := 'ree';
                Log := 'og';
              end;
      'Oak': begin
               TreeColor := 2317131;
               TreeName := 'ak';
               Log := 'ak log';
             end;
      'Willow': begin
                  TreeColor := 5078394;
                  TreeName := 'illow';
                  Log := 'illow log';
                end;
      end;
    end;
    ////////////////////////////////////////////////////////////////////////////////
    begin
      SetupSRL;
      ScriptID := '599';
      Setup;
      DeclarePlayers;
      Signature;
      If SRLID = '' then
      begin
        ClearDebug;
        Writeln('Register at SRL now and stop Leech`n');
        Writeln('Please go to : http://www.srl-forums.com/forum/register.php');
        TerminateScript;
      end;
      wait(100 + Random(500));
      ActivateClient;
      Writeln('Found RuneScape');
      Wait(500 + random(50));
      If (not Loggedin) then
        LoginPlayer;
      SetAngle(True);
      MakeCompass('N');
      wait(2000);
      FindAxeIn;
      if FindAxein = false then
      begin
        Writeln('Axe not found');
        Logout;
        TerminateScript;
      end;
      repeat
        Cut;
        AntiBan;
        Anti;
        Drop;
        Anti;
        AntiBan;
        Proggy;
        SRLRandomsReport;
      until(False)
    end.
    Kindof Inactive...

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. What is wrong? (FindBitmapIn- function)
    By marpis in forum OSR Help
    Replies: 1
    Last Post: 11-10-2008, 06:35 PM
  2. Whats wrong with this function?
    By fabis94 in forum OSR Help
    Replies: 13
    Last Post: 07-30-2008, 04:50 PM
  3. Replies: 2
    Last Post: 02-26-2008, 08:26 PM

Posting Permissions

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