Results 1 to 3 of 3

Thread: That dang out of range thang

  1. #1
    Join Date
    Oct 2011
    Location
    Canada
    Posts
    192
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default That dang out of range thang

    I know you guys get a lot of these "out of range errors" here but I'd be positively elated if someone could tell me what I'm doing wrong please. Thanks!

    When I press the "run script" button


    I receive this

    To which I press ok (Living on the edge ;p). Then receive

    Compiled successfully in 858 ms.
    Error: Out Of Range at line 199
    Simba Code:
    program Uz3sStunAlch;
    {$define SMART}
    {$I SRL/SRL/misc/smart.simba}
    {$I SRL/SRL.simba}
    {$I SRL/SRL/misc/paintsmart.simba}

    //*********************Credits to CRU1Z1N for his gui form thingy*********************


    var
      x, y, Stun, Alch, Xp, iMonsterChoice, MonsterColor, MonsterTolerance, MonsterCounter: Integer;// We Declare our DTM, x and y as Integers.
      frmDesign: TForm;
      Button1: TButton;
      Label1: TLabel;
      WhatMonster: TComboBox;
      MonsterChoice,Pinn,Pass,UsrName: TEdit;
      Debug:string;

    procedure SetupPlayers;
    begin
       NumberOfPlayers(1);
       CurrentPlayer := 0;
       Players[0].Name := UsrName.Text;
       Players[0].Pass := Pass.Text;
       Players[0].Pin := Pinn.Text;
       Players[0].Active := True;
    end;

    procedure SetupLogin;
    begin
      ClearDebug;

      Smart_Server := 123;
      Smart_Members := True;
      Smart_Signed := True;
      Smart_SuperDetail := False;
      SetupSRL;
      SetupPlayers;
      LoginPlayer;
    end;

    procedure AntiRandoms;
    begin
      FindNormalRandoms;
      LampSkill := 'magic';
      LevelUp;
    end;

    Procedure Antiban;
    Begin
      Case Random(500) Of
        0: Begin GameTab(tab_Stats) HoverSkill('Magic', False) GameTab(28); GameTab(tab_magic); End;
        1: Begin SleepAndMoveMouse(7000 + Random(500));  End;
        2: Begin GameTab(tab_Inv) ExamineInv; GameTab(28); GameTab(tab_magic); End;
        3: Begin RandomAngle(1); End;
        4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(28); GameTab(tab_magic); End;
        5: Begin GameTab(tab_Stats) HoverSkill('random', False); GameTab(28); GameTab(tab_magic); End;
      End;
    End;

    procedure MonsterColorFunc;
    begin
    MonsterCounter:= 0;
    MonsterChoice:= 2; // 1 = Lesser Demon, 2 = Black Knight
      if(MonsterChoice.text = 'LesserDemon') then
        begin
          MonsterColor:= 3626480;
          MonsterTolerance:=39;
        end else
        if(MonsterChoice.text = 'BlackKnight') then
          begin
            MonsterColor:= 1119824;
            MonsterTolerance:= 13;
          end;
    end;

    Procedure LogOutFunc;
    begin
          WriteLn('Couldnt find monster');
          WriteLn('Logging out');
          Logout;
          TerminateScript;
        end;

     Procedure PrintOnSmart(TP: TStringArray; Placement: TPoint; Colour: integer);
      var
        mx, my, Pic, I, B, H, TPH, Numb: Integer;
        TTP: TPointArray;
        Canvas: TCanvas;
      begin
        SmartSetDebug(True);
        GetClientDimensions(mx, my);
        Pic := BitmapFromString(mx, my, '');
        TPH := High(TP);
        for I := 0 to TPH do
        begin
          TTP := LoadTextTPA(TP[i], SmallChars, H);
          for B := 0 to High(TTP) do
          begin
            Numb := ((I + 1) * 13);
            FastSetPixel(Pic, TTP[b].x + 1, TTP[b].y + Numb + 1,8388736);
            FastSetPixel(Pic, TTP[b].x, TTP[b].y + Numb, Colour);
          end;
        end;
        Canvas := TCANVAS.Create;
        Canvas.Handle := SmartGetDebugDC;
        DrawBitmap(Pic, Canvas, Placement.x, Placement.y);
        FreeBitmap(Pic);
      end;

      Procedure ButtonClick(Sender: TObject);
    Begin
      frmDesign.ModalResult:= mrOk;
      iMonsterChoice:= StrToInt(MonsterChoice.Text);
    end;

      procedure InitForm;
    begin
      frmDesign := CreateForm;
      frmDesign.Left := 100;
      frmDesign.Top := 100;
      frmDesign.Width := 400;
      frmDesign.Height := 140;
      frmDesign.Caption := 'Uz3s Stunner Alcher!';
      frmDesign.Color := 900849;
      frmDesign.Font.Color := ClBlack;
      frmDesign.Font.Name := 'Comic Sans MS';

      Button1 := TButton.Create(FrmDesign);
      Button1.Parent := FrmDesign;
      Button1.Left := 260;
      Button1.Top := 10;
      Button1.Height := 30;
      Button1.Width := 120;
      Button1.Caption := 'Run Script';
      Button1.OnClick := @ButtonClick;

      Label1 := TLabel.Create(FrmDesign);
      Label1.Parent := FrmDesign;
      Label1.Top := 60;
      Label1.Left := 10;
      Label1.Caption := 'UserName?';

      Label1 := TLabel.Create(FrmDesign);
      Label1.Parent := FrmDesign;
      Label1.Top := 60;
      Label1.Left := 150;
      Label1.Caption := 'Password?';

      Label1 := TLabel.Create(FrmDesign);
      Label1.Parent := FrmDesign;
      Label1.Top := 60;
      Label1.Left := 300;
      Label1.Caption := 'Bank Pin?';

      UsrName := TEdit.Create(FrmDesign);
      UsrName.Parent := FrmDesign;
      UsrName.Top := 80;
      UsrName.Left := 10;
      UsrName.Width := 100;
      UsrName.Height := 20;

      Pass := TEdit.Create(FrmDesign);
      Pass.Parent := FrmDesign;
      Pass.Top := 80;
      Pass.Left := 150;
      Pass.Width := 100;
      Pass.Height := 20;

      Pinn := TEdit.Create(FrmDesign);
      Pinn.Parent := FrmDesign;
      Pinn.Top := 80;
      Pinn.Left := 280;
      Pinn.Width := 100;
      Pinn.Height := 20;

      WhatMonster := TComboBox.Create(FrmDesign);
      WhatMonster.Parent := FrmDesign;
      WhatMonster.Top := 10;
      WhatMonster.Left := 10;
      WhatMonster.Width := 200;
      WhatMonster.Height := 15;
      WhatMonster.Caption := 'Which Monster?';
      WhatMonster.Items.Add('LesserDemon');
      WhatMonster.Items.Add('BlackKnight');

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

    procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end; [B]// This where the error occurs[/B]

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

    vv end; is where the error occurs vv
    Simba Code:
    procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end; [B]// This where the error occurs[/B]

    And here is the main procedure

    Simba Code:
    begin
    SafeInitForm;
    SafeShowFormModal;
    SetupLogin;
    ActivateClient;
    MonsterColorFunc;
    Debug:='none';
      repeat
        if not LoggedIn then LogInPlayer;
        if(MonsterCounter > 4) then
          LogoutFunc;
        Antiban;
        StunMonster;
        AlchItem;
        ProgressReport;
      until(false)
    Freeform(frmDesign);
    end.


    I left the rest of the script out because it shouldn't have anything to do with this error.

  2. #2
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Huge design flaws..

    Should be.. frmDesign := TForm.Create(nil);
    Needs to have frmDesign.Visible := False;

    Needs to be:
    iMonsterChoice:= StrToInt(MonsterChoice.Text); //switched them around.. u cannot close the form first then access it's members -__-
    frmDesign.ModalResult:= mrOk;


    *sigh* so many problems I CBA to point all of them out.. Just see below.. NOTE: I removed your paint smart because I did not want smart running while I tested this..

    Another NOTE: Do not copy the below -___- I left some of the problems in there purposefully.. I expect you to fix them and report back.. I left some comments on the "Important ones"..

    Simba Code:
    program Uz3sStunAlch;
    {$I SRL/SRL.simba}

    //*********************Credits to CRU1Z1N for his gui form thingy*********************


    var
      x, y, Stun, Alch, Xp, iMonsterChoice, MonsterColor, MonsterTolerance, MonsterCounter: Integer;// We Declare our DTM, x and y as Integers.
      frmDesign: TForm;
      Button1: TButton;
      Label1: TLabel;
      WhatMonster: TComboBox;
      MonsterChoice,Pinn,Pass,UsrName: TEdit;
      Debug:string;

    procedure SetupPlayers;
    begin
       NumberOfPlayers(1);
       CurrentPlayer := 0;
       Players[0].Name := UsrName.Text;
       Players[0].Pass := Pass.Text;
       Players[0].Pin := Pinn.Text;
       Players[0].Active := True;
    end;

    procedure SetupLogin;
    begin
      ClearDebug;

      Smart_Server := 123;
      Smart_Members := True;
      Smart_Signed := True;
      Smart_SuperDetail := False;
      SetupSRL;
      SetupPlayers;
      LoginPlayer;
    end;

    procedure AntiRandoms;
    begin
      FindNormalRandoms;
      LampSkill := 'magic';
      LevelUp;
    end;

    Procedure Antiban;
    Begin
      Case Random(500) Of
        0: Begin GameTab(tab_Stats) HoverSkill('Magic', False) GameTab(28); GameTab(tab_magic); End;
        1: Begin SleepAndMoveMouse(7000 + Random(500));  End;
        2: Begin GameTab(tab_Inv) ExamineInv; GameTab(28); GameTab(tab_magic); End;
        3: Begin RandomAngle(1); End;
        4: Begin GameTab(Tab_Stats); Wait(3000 + Random(500)); GameTab(28); GameTab(tab_magic); End;
        5: Begin GameTab(tab_Stats) HoverSkill('random', False); GameTab(28); GameTab(tab_magic); End;
      End;
    End;

    procedure MonsterColorFunc;
    begin
    MonsterCounter:= 0;
    MonsterChoice:= 2; // 1 = Lesser Demon, 2 = Black Knight
      if(MonsterChoice.text = 'LesserDemon') then
        begin
          MonsterColor:= 3626480;
          MonsterTolerance:=39;
        end else
        if(MonsterChoice.text = 'BlackKnight') then
          begin
            MonsterColor:= 1119824;
            MonsterTolerance:= 13;
          end;
    end;

    Procedure LogOutFunc;
    begin
          WriteLn('Couldnt find monster');
          WriteLn('Logging out');
          Logout;
          TerminateScript;
        end;

    Procedure ButtonClick(Sender: TObject);
    Begin
      //iMonsterChoice := StrToIntDef(MonsterChoice.Text, 10);     HUGE PROBLEM... MONSTER CHOICE EDIT BOX DOES NOT EXIST!!!
      frmDesign.ModalResult:= mrOk;
    end;

      procedure InitForm;
    begin
      frmDesign := TForm.Create(nil);
      with frmDesign do
      begin
        frmDesign.Left := 100;
        frmDesign.Top := 100;
        frmDesign.Width := 400;
        frmDesign.Height := 140;
        frmDesign.Caption := 'Uz3s Stunner Alcher!';
        frmDesign.Color := 900849;
        frmDesign.Font.Color := ClBlack;
        frmDesign.Font.Name := 'Comic Sans MS';
        frmDesign.Visible := False;
      end;

      Button1 := TButton.Create(FrmDesign);
      with Button1 do
      begin
        Button1.Parent := FrmDesign;
        Button1.Left := 260;
        Button1.Top := 10;
        Button1.Height := 30;
        Button1.Width := 120;
        Button1.Caption := 'Run Script';
        Button1.OnClick := @ButtonClick;
      end;

      Label1 := TLabel.Create(FrmDesign);
      with Label1 do
      begin
        Label1.Parent := FrmDesign;
        Label1.Top := 60;
        Label1.Left := 10;
        Label1.Caption := 'UserName?';
      end;

      Label1 := TLabel.Create(FrmDesign);
      with Label1 do
      begin
        Label1.Parent := FrmDesign;
        Label1.Top := 60;
        Label1.Left := 150;
        Label1.Caption := 'Password?';

        Label1 := TLabel.Create(FrmDesign);
        Label1.Parent := FrmDesign;
        Label1.Top := 60;
        Label1.Left := 300;
        Label1.Caption := 'Bank Pin?';
      end;

      UsrName := TEdit.Create(FrmDesign);
      with UsrName do
      begin
        UsrName.Parent := FrmDesign;
        UsrName.Top := 80;
        UsrName.Left := 10;
        UsrName.Width := 100;
        UsrName.Height := 20;
      end;

      Pass := TEdit.Create(FrmDesign);
      with Pass do
      begin
        Pass.Parent := FrmDesign;
        Pass.Top := 80;
        Pass.Left := 150;
        Pass.Width := 100;
        Pass.Height := 20;
      end;

      Pinn := TEdit.Create(FrmDesign);
      with Pinn do
      begin
        Pinn.Parent := FrmDesign;
        Pinn.Top := 80;
        Pinn.Left := 280;
        Pinn.Width := 100;
        Pinn.Height := 20;
      end;

      WhatMonster := TComboBox.Create(FrmDesign);
      with WhatMonster do
      begin
        WhatMonster.Parent := FrmDesign;
        WhatMonster.Top := 10;
        WhatMonster.Left := 10;
        WhatMonster.Width := 200;
        WhatMonster.Height := 15;
        WhatMonster.Caption := 'Which Monster?';
        WhatMonster.Items.Add('LesserDemon');
        WhatMonster.Items.Add('BlackKnight');
      end;

    end;

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

    procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end;

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

    begin
    SafeInitForm;
    SafeShowFormModal;
    SetupSRL;
    end.
    I am Ggzz..
    Hackintosher

  3. #3
    Join Date
    Oct 2011
    Location
    Canada
    Posts
    192
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ha, I thought that's what someone would say. Thanks. I'll work on it tomorrow.
    Sorry about getting you into a frizzle, I should have researched into it more.
    Last edited by uz3; 01-25-2012 at 01:30 AM.

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
  •