Results 1 to 4 of 4

Thread: Unknown Error...

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

    Default Unknown Error...

    Okay i have no clue why my script is not working, it compiles fine but quickly shuts off after the forms. I have spent 20 Minutes trying to fix but not work.I have decided to post here for help Thank You. I know some parts are pretty bad but i'm not able to test at moment to really work on it.

    SCAR Code:
    program YewCutter;
    {.include SRL/SRL.Scar}
    {.include SRL/SRL/Skill/WoodCutting.Scar}

    var
      Banked, Gotten, x, y, TestColor, TColor1, TColor2:Integer;
      Tree, SPass, SUser, UserNames, PassWord, Nick, TreeT :String;
      Cuttz : TForm;
      Label1, Label3, Label4, NickName : TLabel;
      Button1, Button2 : TButton;
      Coolness, UserName, SRL_ID, SRL_Password, Middle_Letters : TEdit;
      Tree_Type : TComboBox;

    const
      LoadsToDo = 10; // The number of loads to do
      Bank = 3324887; //ban

    Procedure Extra;
    begin
    SPass := SRL_Password.Text;
    SUser := SRL_ID.Text;
    UserNames := UserName.Text;
    PassWord := Coolness.Text;
    Nick := Middle_Letters.Text;
    end;

    Procedure InitForm;
    begin
    Cuttz := CreateForm;
    Cuttz.Left := 250;
    Cuttz.Top := 111;
    Cuttz.Width := 534;
    Cuttz.Height := 451;
    Cuttz.Caption := 'Cut'#39'z N'#39' Fletch';
    Cuttz.Color := clMaroon;
    Cuttz.Font.Color := clWindowText;
    Cuttz.Font.Height := -11;
    Cuttz.Font.Name := 'MS Sans Serif';
    Cuttz.Font.Style := [];
    Cuttz.Visible := False;
    Cuttz.PixelsPerInch := 96;
    Label1 := TLabel.Create(Cuttz);
    Label1.Parent := Cuttz;
    Label1.Left := 24;
    Label1.Top := 24;
    Label1.Width := 480;
    Label1.Height := 38;
    Label1.Caption := '<^>Reece'#39's L33T Cut N'#39' Fletch<^>';
    Label1.Font.Color := clWindowText;
    Label1.Font.Height := -32;
    Label1.Font.Name := 'Script MT Bold';
    Label1.Font.Style := [fsBold];
    Label1.ParentFont := False;
    Label3 := TLabel.Create(Cuttz);
    Label3.Parent := Cuttz;
    Label3.Left := 8;
    Label3.Top := 160;
    Label3.Width := 73;
    Label3.Height := 20;
    Label3.Caption := 'PassWord';
    Label3.Font.Color := clWindowText;
    Label3.Font.Height := -16;
    Label3.Font.Name := 'MS Sans Serif';
    Label3.Font.Style := [];
    Label3.ParentFont := False;
    Label4 := TLabel.Create(Cuttz);
    Label4.Parent := Cuttz;
    Label4.Left := 8;
    Label4.Top := 120;
    Label4.Width := 76;
    Label4.Height := 20;
    Label4.Caption := 'UserName';
    Label4.Font.Color := clWindowText;
    Label4.Font.Height := -16;
    Label4.Font.Name := 'MS Sans Serif';
    Label4.Font.Style := [];
    Label4.ParentFont := False;
    NickName := TLabel.Create(Cuttz);
    NickName.Parent := Cuttz;
    NickName.Left := 8;
    NickName.Top := 200;
    NickName.Width := 73;
    NickName.Height := 20;
    NickName.Caption := 'NickName';
    NickName.Font.Color := clWindowText;
    NickName.Font.Height := -16;
    NickName.Font.Name := 'MS Sans Serif';
    NickName.Font.Style := [];
    NickName.ParentFont := False;
    Button1 := TButton.Create(Cuttz);
    Button1.Parent := Cuttz;
    Button1.Left := 272;
    Button1.Top := 352;
    Button1.Width := 1;
    Button1.Height := 1;
    Button1.Caption := 'Button1';
    Button1.TabOrder := 8;
    Button2 := TButton.Create(Cuttz);
    Button2.Parent := Cuttz;
    Button2.Left := 200;
    Button2.Top := 280;
    Button2.Width := 105;
    Button2.Height := 25;
    Button2.Caption := 'Start!';
    Button2.Font.Color := clBlue;
    Button2.Font.Height := -11;
    Button2.Font.Name := 'MS Sans Serif';
    Button2.Font.Style := [];
    Button2.ModalResult := 6;
    Button2.ParentFont := False;
    Button2.TabOrder := 9;
    Coolness := TEdit.Create(Cuttz);
    Coolness.Parent := Cuttz;
    Coolness.Left := 88;
    Coolness.Top := 160;
    Coolness.Width := 121;
    Coolness.Height := 21;
    Coolness.Color := clMonkeyGreen;
    Coolness.PasswordChar := '*';
    Coolness.TabOrder := 10;
    Coolness.Text := 'Coolness';
    UserName := TEdit.Create(Cuttz);
    UserName.Parent := Cuttz;
    UserName.Left := 88;
    UserName.Top := 120;
    UserName.Width := 121;
    UserName.Height := 21;
    UserName.Color := clMonkeyGreen;
    UserName.TabOrder := 11;
    UserName.Text := 'UserName';
    Tree_Type := TComboBox.Create(Cuttz);
    Tree_Type.Parent := Cuttz;
    Tree_Type.Left := 313;
    Tree_Type.Top := 120;
    Tree_Type.Width := 120;
    Tree_Type.Height := 21;
    Tree_Type.Color := clSkyBlue;
    Tree_Type.ItemHeight := 13;
    Tree_Type.TabOrder := 12;
    Tree_Type.Text := 'Tree_Type';
    Tree_Type.Items.Add('Normal');
    Tree_Type.Items.Add('Oak');
    Tree_Type.Items.Add('Willow');
    SRL_ID := TEdit.Create(Cuttz);
    SRL_ID.Parent := Cuttz;
    SRL_ID.Left := 312;
    SRL_ID.Top := 160;
    SRL_ID.Width := 121;
    SRL_ID.Height := 21;
    SRL_ID.Color := clSkyBlue;
    SRL_ID.TabOrder := 13;
    SRL_ID.Text := 'SRL_ID';
    SRL_Password := TEdit.Create(Cuttz);
    SRL_Password.Parent := Cuttz;
    SRL_Password.Left := 312;
    SRL_Password.Top := 200;
    SRL_Password.Width := 121;
    SRL_Password.Height := 21;
    SRL_Password.Color := clSkyBlue;
    SRL_Password.TabOrder := 15;
    SRL_Password.Text := 'SRL_Password';
    Middle_Letters := TEdit.Create(Cuttz);
    Middle_Letters.Parent := Cuttz;
    Middle_Letters.Left := 88;
    Middle_Letters.Top := 200;
    Middle_Letters.Width := 121;
    Middle_Letters.Height := 21;
    Middle_Letters.Color := clMonkeyGreen;
    Middle_Letters.TabOrder := 16;
    Middle_Letters.Text := 'Middle_Letters';
    end;

    Procedure SafeInitForm;
    var
       v: TVariantArray;
    begin
       setarraylength(V, 0);
       ThreadSafeCall('InitForm', v);
    end;

    Procedure ShowFormModal;
    begin
      Cuttz.ShowModal;
    end;

    Procedure SafeShowFormModal;
    var
      v: TVariantArray;
    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowFormModal', V);
    end;

    Procedure checksB;
    begin
    If TreeT = 'Normal' then
      Writeln('Out Of Order Try Again Later. Sorry.');
      TerminateScript;
    If TreeT = 'Oak' then
      Writeln('Out Of Order Try Again Later. Sorry.');
      TerminateScript;
    end;

    Procedure TreeType;
    begin
    TreeT := Tree_Type.Text;
    checksB;
    Writeln('')
    writeln('Cutting Down ' +(TreeT));
    Writeln('');
    end;


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

      Players[0].Name := UserNames;//UserName
      Players[0].Pass := PassWord;//PassWord
      Players[0].Strings[1] := TreeT;//Tree Type
      Players[0].Loc := 'Bank';//Leave Alone

      NickNameBMP := CreateBitmapMaskFromText(Players[CurrentPlayer].Nick, UpChars);
    end;

    Procedure Colorzz;
    begin
      If(TreeT = 'Normal') then
        TColor1:=345345 TColor2:=5345345;
      If(TreeT = 'Oak') then
        TColor1:=345345 TColor2:=5345345;
      If(TreeT = 'Willow') then
        TColor1:=345345 TColor2:=5345345;
    end;


    function FindRockColorz: Integer;
    var
      GC, a, l, Red, Green, Blue, x, y : integer;
    var
      P:array of Tpoint;
    begin
      if (RoadColor = 0) then RoadColor:=FindRoadColor;
      if not (FindColor(x, y, RoadColor, MMX1, MMY1, MMX2, MMY2)) then
        RoadColor := FindRoadColor;
      GC := 6444639;
      Flag;
      FindColorsSpiralTolerance(MMCX, MMCY, P, GC, 595, 30, 700, 120, 50);
      l:=GetArrayLength(P);
      for a:= 0 to l-1 do
      begin
        if rs_OnMinimap(P[a].x,P[a].y) then
        begin
          TestColor := GetColor(P[a].x,P[a].y);
          if SimilarColors(TestColor,GC,50) then
          begin
            if SimilarColors(TestColor,GC,50) then
            begin
              red := (TestColor mod 256);
              green := ((TestColor / 256) mod 256);
              blue := ((TestColor / 256) / 256);
              if not (TestColor = RoadColor) then
                if Abs(Red - Green) <= 20 then
                  if Abs(Red - Blue) <= 20 then
                    if Abs(Green - Blue) <= 20 then
                      if GetColor(P[a].x + 1, P[a].y + 1) = TestColor then
                        if GetColor(P[a].x + 1, P[a].y) = TestColor then
                          if GetColor(P[a].x, P[a].y + 1) = TestColor then
                          begin
                            Result := TestColor;
                            WriteLn('Rock Color = ' + IntToStr(TestColor));
                            Exit;
                          end;
            end;
          end;
        end;
      end;
      WriteLn('Could not find Rock Color!');
      TerminateScript;
      Result := 0;
    end;

    Procedure Walk;
    begin
     FindRockColorz;
     RadialWalk(TestColor, 90, 270, 70, x, y);
     Writeln('Walking To Rocks');
    end;


    function FindFastRandoms: Boolean; //Function by WT-Fakawi
    var
    i: Integer;
    begin
    for i := 1 to 8 do
    begin
       case I of
         1: if FindDead then
             Result := True;
         2: if FindMod then
             Result := True;
         3: if FindMime then
             Result := True;
         4: if FindMaze then
             Result := True;
         5: if FindQuiz then
             Result := True;
         6: if FindDemon then
             Result := True;
         7:
           begin
             if NoGameTab then
             begin
               Result := True;
               Logout;
               Exit;
             end;
           end;
         7:
           begin
             if InBlack then
             begin
               Result := True;
               Logout;
               Exit;
             end;
           end;
         8: RC;
       end;
       wait(1);
    end;
    end;

    procedure antiz;
    begin
    case Random(6) of

       0: AlmostLogout;

       1: begin
            HoverSkill('Woodcutting', True);
            Wait(564 + random(365));
            GameTab(4);
          end;

       2: begin
            HoverSkill('Prayer', false);
            Wait(733 + random(421));
            GameTab(4);
          end;

       3: begin
            GameTab(1)
            Wait(126 + random(895));
            GameTab(4)
          end;

       4: SayCurrentLevels('Woodcutting');

       5: PickUpMouse;
    end;
    end;


    Procedure FindThoseRandoms;
    begin
      if(FindFight)then
      begin
        RunAwayDirection('N');
        Wait(9500+Random(5500));
        RunBack;
      end;
      if(FindDead)then
      begin
        Writeln('You are Dead!');
        Writeln('Next player.');
      end;
      antiz;
      DwarfItem;
      SolveFrog;
      FindCerter;
      FindDemon;
      FindQuiz;
      SolveBox;
      SolveSandWich;
      FindNormalRandoms;
      FindFastRandoms;
        FindLamp('woodcutting');
    end;

    Procedure ChopTree;
    begin
    if not LoggedIn then Exit;
      begin
      repeat
      if not LoggedIn then Break;
        FindEnt(x,y, True);
        wait(3000+random(500));
        if FindObj(x, y, TreeT , TColor1 , 2) then
        begin
          Gotten := 0
          MMouse(x, y, 1, 1);
          Mouse(x, y, 1, 1, True);
          WriteLn('Choping Tree');
          FindThoseRandoms;
        end;
        If not FindObj(x, y, TreeT , TColor2 , 5) then
        begin
        WriteLn(' Cannot find' + Tree);
          wait(2000+random(300));
          Exit;
         end;
       Until(True);
      end;
    end;

    Procedure CheckIt;
    begin
     repeat
      ChopTree;
      FindThoseRandoms;
     until(InvFull) or (Gotten = 5);
      if (Gotten > 5) and (InvFull = False) then
        begin
        CheckIt;
        end;
    end;

    function fletchem(Fletchnum : Integer): Boolean;
    var x, y, Fletchtime: Integer;
    begin
    if not LoggedIn then Exit;
    MouseItem(1, True);
      Wait(150 + Random(200));
    MouseItem(2, True);
      Wait(1000 + Random(127));
      if (FindNpcChatText('ong')) then
      begin
        Wait((256) + Random(1353));
        if ChooseOption('X') then
        begin
            TypeSend(IntToStr(Fletchnum));
            MarkTime(Fletchtime);
          MMouse(700, 445, 1, 2);
          repeat
          if not LoggedIn then Break;
            wait(125 + random(1000));
            FindThoseRandoms;
              if TimeFromMark(Fletchtime) > 60000 then begin Exit; Result := False; end;
          until (IsUpTextMulti('long', 'bow', 'ow'))
            Result := True;
        end;
      end;
    end;


    procedure ProgressReport;
    begin
    ClearDebug;
      WriteLn('{-----------------Reeces Cut N" Fletch---------------}');
      WriteLn('{----------------------------------------------------}');
      WriteLn('{--------You have worked for ' +(TimeRunning)+ '---------------}');
      WriteLn('{----------------------------------------------------}');
      WriteLn('{--------You have cut and Fletched ' +inttostr(Banked)+ ' loads-----------}');
      WriteLn('{----------------------------------------------------}');
      WriteLn('{-----------------Reeces Cut N" Fletch---------------}');
    end;


    procedure SRLZ;
    begin
      SetupSRL;
      SRLID := SRL_ID.Text;
      SRLPassword := SRL_Password.Text;
      ClearDebug;
    end;

    procedure SetUp;
    begin
      SRLZ;
      if not LoggedIn then LoginPlayer;
      HighestAngle;
      MakeCompass('N');
      GameTab(4);
    end;

    Procedure Form;
    begin
      SafeInitForm;
      SafeShowFormModal;
      TreeType;
      SetUp;
        Wait(5000);
      Colorzz;
    end;

    begin
      Form;
      If not LoggedIn then LoginPlayer;
      repeat
      Walk;
      Wait(236);
      CheckIt;//Cutting
      FindThoseRandoms;
      ProgressReport;
      FletchEm(27);//Fletching
      FindThoseRandoms;
      ProgressReport;
      DropExcept([1]);
      FindThoseRandoms;
    until(True);
    end.

  2. #2
    Join Date
    Aug 2007
    Posts
    429
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    Your error is here:
    SCAR Code:
    Procedure checksB;
    begin
    If TreeT = 'Normal' then
      Writeln('Out Of Order Try Again Later. Sorry.');
      TerminateScript;
    If TreeT = 'Oak' then
      Writeln('Out Of Order Try Again Later. Sorry.');
      TerminateScript;
    end;
    You forgot begins/ends after the if statement if you want to do more than one thing.

    FIX:
    SCAR Code:
    Procedure checksB;
    begin
      If TreeT = 'Normal' then
      begin  //begin here
        Writeln('Out Of Order Try Again Later. Sorry.');
        TerminateScript;
      end;  //end here
      If TreeT = 'Oak' then
      begin  //begin here
        Writeln('Out Of Order Try Again Later. Sorry.');
        TerminateScript;
      end;  //end here
    end;

    Ohterwise it would do the TerminateScript part no matter what.

    =]]

  3. #3
    Join Date
    Jun 2007
    Posts
    1,312
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    lol holy crap, apply for membership?
    Active only during the Summer...

  4. #4
    Join Date
    Aug 2007
    Posts
    1,404
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    More than a certain percentage of the script must be ones own work, to get an honest application. Except for the form, there is quite much of others; like Fakawi's FindFastRandoms (But that's default to have it almost, so that doesn't mean anything). A really good script needs a lot more kewlz0r stuff, but I don't know if a fletcher can really have very much stuff.

    -Knives

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Unknown Error
    By TViYH in forum OSR Help
    Replies: 3
    Last Post: 09-24-2008, 04:01 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
  •