Results 1 to 13 of 13

Thread: Form Troubles...

  1. #1
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default Form Troubles...

    Ok, so today I decided to l2m4k3f0rmz.
    Got this far, and can't figure out why it won't work...
    SCAR Code:
    Program newbhackform;

    var
      NewbHack : TForm;
      MyLabel : Array[1..4] of TLabel;
      MyCBox : Array[1..6] of TComboBox;
      Close : TButton;
      i : Integer;
       //thanks widget
    procedure DragForm(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    var sx,sy,tx,ty:integer;
    begin
      getmousepos(tx,ty);
      repeat
        getmousepos(sx,sy);
        NewbHack.Top := NewbHack.Top - (ty-sy);
        NewbHack.Left := NewbHack.Left - (tx-sx);
        sleep(1);
        tx := sx;
        ty := sy;
      until (not IsMouseButtonDown(True));
    end;

    procedure InitForm;
    begin
      NewbHack := CreateForm;
      with NewbHack do
      begin
        Left := 0;
        Top := 0;
        Width := 500;
        Height := 400;
        Caption := 'Newb Hacker';
        Color := clBtnFace;
        Font.Color := clWindowText;
        Font.Height := -11;
        Font.Name := 'MS Sans Serif';
        Font.Style := [];
        Visible := False;
        PixelsPerInch := 96;
        BorderStyle := bsNone;
        OnMouseDown := @DragForm;
      end;
      for i := 1 to 3 do
      begin
        MyLabel[i] := TLabel.Create(NewbHack);
        with MyLabel[i] do
        begin
          Parent := NewbHack;
          Left := 32;
          Top := 40 + (65 * (i - 1));
          Width := 41;
          Height := 13;
          Alignment := taCenter;
        end;
        MyCBox[i] := TComboBox.Create(NewbHack);
        with MyCBox[i] do
        begin
          Parent := NewbHack;
          Left := 32;
          Top := 64 + (65 * (i - 1));
          Width := 150;
          Height := 21;
          ItemHeight := 13;
          TabOrder := 8;
        end;
      end;
      for i := 4 to 6 do
      begin
        MyCBox[i] := TComboBox.Create(NewbHack);
        with MyCBox[i] do
        begin
          Parent := NewbHack;
          Left := 32 + ((i - 1) * 50);
          Top := MyLabel[3].Top + 65;
          Width := 50;
          Height := 21;
          ItemHeight := 13;
          TabOrder := 8;
        end;
      end;
      MyLabel[1].Caption := 'Location';
      MyLabel[2].Caption := 'Tree To Start';
      MyLabel[3].Caption := 'Goal Level';
      with MyLabel[4] do
      begin
        Parent := NewbHack;
        Left := 32;
        Top := 40 + (65 * 3);
        Width := 41;
        Height := 13;
        Alignment := taCenter;
        Caption := 'Levels To Switch';
      end;
      MyCBox[1].Text := 'Please Choose a Location';
      MyCBox[2].Text := 'Please Choose a Tree';
      MyCBox[3].Text := 'Please Choose a Level';
      for i := 2 to 99 do
      begin
        MyCBox[3].Items.Add(IntToStr(i));
        MyCBox[4].Items.Add(IntToStr(i));
        MyCBox[5].Items.Add(IntToStr(i));
        MyCBox[6].Items.Add(IntToStr(i));
      end;
      Close := TButton.Create(NewbHack);
      with Close do
      begin
        Parent := NewbHack;
        Left := 64;
        Top := 340;
        Width := 81;
        Height := 25;
        Caption := 'Close';
        TabOrder := 16;
        ModalResult := mrOk;
      end;
    end;

    procedure SafeShow;
    var
      tva: TVariantArray;
    begin
      setarraylength(tva, 0);
      ThreadSafeCall('InitForm', tva);
    end;

    procedure ShowFormModal;
    begin
      NewbHack.ShowModal;
    end;

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

    procedure doForm;
    begin
      SafeShow;
      SafeShowFormModal;
    end;

    begin
      GetSelf.Visible := False;
      doForm;
      GetSelf.Visible := True;
    end.

    Help is appreciated!

  2. #2
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    Program newbhackform;

    var
      NewbHack : TForm;
      MyLabel : Array[1..4] of TLabel;
      MyCBox : Array[1..6] of TComboBox;
      Close : TButton;
      i : Integer;
       //thanks widget
    procedure DragForm(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    var sx,sy,tx,ty:integer;
    begin
      getmousepos(tx,ty);
      repeat
        getmousepos(sx,sy);
        NewbHack.Top := NewbHack.Top - (ty-sy);
        NewbHack.Left := NewbHack.Left - (tx-sx);
        sleep(1);
        tx := sx;
        ty := sy;
      until (not IsMouseButtonDown(True));
    end;

    procedure InitForm;
    begin
      NewbHack := CreateForm;
      with NewbHack do
      begin
        Left := 0;
        Top := 0;
        Width := 500;
        Height := 400;
        Caption := 'Newb Hacker';
        Color := clBtnFace;
        Font.Color := clWindowText;
        Font.Height := -11;
        Font.Name := 'MS Sans Serif';
        Font.Style := [];
        Visible := False;
        PixelsPerInch := 96;
        BorderStyle := bsNone;
        OnMouseDown := @DragForm;
      end;
      for i := 1 to 4 do
      begin
        MyLabel[i] := TLabel.Create(NewbHack);
        with MyLabel[i] do
        begin
          Parent := NewbHack;
          Left := 32;
          Top := 40 + (65 * (i - 1));
          Width := 41;
          Height := 13;
          Alignment := taCenter;
        end;
        MyCBox[i] := TComboBox.Create(NewbHack);
        with MyCBox[i] do
        begin
          Parent := NewbHack;
          Left := 32;
          Top := 64 + (65 * (i - 1));
          Width := 150;
          Height := 21;
          ItemHeight := 13;
          TabOrder := 8;
        end;
      end;
      for i := 4 to 6 do
      begin
        MyCBox[i] := TComboBox.Create(NewbHack);
        with MyCBox[i] do
        begin
          Parent := NewbHack;
          Left := 32 + ((i - 1) * 50);
          Top := MyLabel[3].Top + 65;
          Width := 50;
          Height := 21;
          ItemHeight := 13;
          TabOrder := 8;
        end;
      end;
      MyLabel[1].Caption := 'Location';
      MyLabel[2].Caption := 'Tree To Start';
      MyLabel[3].Caption := 'Goal Level';
      with MyLabel[4] do
      begin
        Parent := NewbHack;
        Left := 32;
        Top := 40 + (65 * 3);
        Width := 41;
        Height := 13;
        Alignment := taCenter;
        Caption := 'Levels To Switch';
      end;
      MyCBox[1].Text := 'Please Choose a Location';
      MyCBox[2].Text := 'Please Choose a Tree';
      MyCBox[3].Text := 'Please Choose a Level';
      for i := 2 to 99 do
      begin
        MyCBox[3].Items.Add(IntToStr(i));
        MyCBox[4].Items.Add(IntToStr(i));
        MyCBox[5].Items.Add(IntToStr(i));
        MyCBox[6].Items.Add(IntToStr(i));
      end;
      Close := TButton.Create(NewbHack);
      with Close do
      begin
        Parent := NewbHack;
        Left := 64;
        Top := 340;
        Width := 81;
        Height := 25;
        Caption := 'Close';
        TabOrder := 16;
        ModalResult := mrOk;
      end;
    end;

    procedure SafeShow;
    var
      tva: TVariantArray;
    begin
      setarraylength(tva, 0);
      ThreadSafeCall('InitForm', tva);
    end;

    procedure ShowFormModal;
    begin
      NewbHack.ShowModal;
    end;

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

    procedure doForm;
    begin
      SafeShow;
      SafeShowFormModal;
    end;

    begin
      GetSelf.Visible := False;
      doForm;
      GetSelf.Visible := True;
    end.

  3. #3
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Ok, Thanks. But why did you have to declare MyLabel[4] twice?

  4. #4
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I didn't do that. AFAIK, it was never declared in script.
    SCAR Code:
    for i := 1 to 4 do
      begin
        MyLabel[i] := TLabel.Create(NewbHack);
        with MyLabel[i] do
        begin
          Parent := NewbHack;
          Left := 32;
          Top := 40 + (65 * (i - 1));
          Width := 41;
          Height := 13;
          Alignment := taCenter;
        end;

    You had that at for i := 0 to 3 and you need 4 as you have 5 labels.

  5. #5
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Oops, I meant MyCBox[4]...

  6. #6
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Meh all I changed was 3 to 4 .

  7. #7
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Here, I smexyfied it now... Works great
    (now to learn to add a background !)
    SCAR Code:
    Program newbhackform;

    var
      NewbHack : TForm;
      MyLabel : Array[0..3] of TLabel;
      MyCBox  : Array[0..3] of TComboBox;
      MyCBoxLvl : Array[0..2] of TComboBox;
      Close : TButton;
      i : Integer;
       //thanks widget
    procedure DragForm(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
    var sx,sy,tx,ty:integer;
    begin
      getmousepos(tx,ty);
      repeat
        getmousepos(sx,sy);
        NewbHack.Top := NewbHack.Top - (ty-sy);
        NewbHack.Left := NewbHack.Left - (tx-sx);
        sleep(1);
        tx := sx;
        ty := sy;
      until (not IsMouseButtonDown(True));
    end;

    procedure InitForm;
    begin
      NewbHack := CreateForm;
      with NewbHack do
      begin
        Left := 0;
        Top := 0;
        Width := 250;
        Height := 360;
        Caption := 'Newb Hacker';
        Color := clBtnFace;
        Font.Color := clWindowText;
        Font.Height := -11;
        Font.Name := 'MS Sans Serif';
        Font.Style := [];
        Visible := False;
        PixelsPerInch := 96;
        BorderStyle := bsNone;
        OnMouseDown := @DragForm;
      end;
      for i := 0 to 3 do
      begin
        MyLabel[i] := TLabel.Create(NewbHack);
        with MyLabel[i] do
        begin
          Parent := NewbHack;
          Left := 32;
          Top := 40 + (65 * i);
          Width := 41;
          Height := 13;
          Alignment := taCenter;
        end;
        if i < 3 then
        begin
          MyCBox[i] := TComboBox.Create(NewbHack);
          with MyCBox[i] do
          begin
            Parent := NewbHack;
            Left := 32;
            Top := 64 + (65 * i);
            Width := 150;
            Height := 21;
            ItemHeight := 13;
            TabOrder := 8;
          end;
          MyCBoxLvl[i] := TComboBox.Create(NewbHack);
          with MyCBoxLvl[i] do
          begin
            Parent := NewbHack;
            Left := 32 + (50 * i);
            Top := 64 + (65 * 3);
            Width := 50;
            Height := 21;
            ItemHeight := 13;
            TabOrder := 8;

          end;
        end;
      end;
      MyLabel[0].Caption := 'Location';
      MyLabel[1].Caption := 'Tree To Start';
      MyLabel[2].Caption := 'Goal Level';
      MyLabel[3].Caption := 'Levels To Switch';
      MyCBox[0].Text := 'Please Choose a Location';
      MyCBox[1].Text := 'Please Choose a Tree';
      MyCBox[2].Text := 'Please Choose a Level';
      MyCBoxLvl[0].Text := 'Nml to Oaks';
      MyCBoxLvl[1].Text := 'Oaks to Wils';
      MyCBoxLvl[2].Text := 'Wils to Yews';
      for i := 2 to 99 do
      begin
        MyCBox[2].Items.Add(IntToStr(i));
        if i >= 15 then
          MyCBoxLvl[0].Items.Add(IntToStr(i));
        if i >= 30 then
          MyCBoxLvl[1].Items.Add(IntToStr(i));
        if i >= 60 then
          MyCBoxLvl[2].Items.Add(IntToStr(i));
      end;
      Close := TButton.Create(NewbHack);
      with Close do
      begin
        Parent := NewbHack;
        Left := 64;
        Top := 330;
        Width := 81;
        Height := 25;
        Caption := 'Close';
        TabOrder := 16;
        ModalResult := mrOk;
      end;
    end;

    procedure SafeShow;
    var
      tva: TVariantArray;
    begin
      setarraylength(tva, 0);
      ThreadSafeCall('InitForm', tva);
    end;

    procedure ShowFormModal;
    begin
      NewbHack.ShowModal;
    end;

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

    procedure doForm;
    begin
      SafeShow;
      SafeShowFormModal;
    end;

    begin
      GetSelf.Visible := False;
      doForm;
      GetSelf.Visible := True;
    end.

  8. #8
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    My sig: DrawImage, DownloadImage (<--optional) .
    What exactly is NewbHack.

  9. #9
    Join Date
    Oct 2006
    Posts
    1,190
    Mentioned
    0 Post(s)
    Quoted
    2 Post(s)

    Default

    great looking form... im assuming its a woodcutting script that has the ability to change trees at a user defined level great idea



  10. #10
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Yes, it is an army-oriented script. I am going to use it on my 76 character army, and then release it.(with some good proggies). I am still debugging it, and it is reflection. Don't flame.

    I have been reading some more form tuts, and I am going to add a tabbed playerform to it (or maybe one like masterkill has in his a-i-o form tut)

  11. #11
    Join Date
    Jan 2008
    Location
    California, US
    Posts
    2,765
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Read my tab tut .
    And also, reflection is cool, I like it now. Just never used it besides for walking . Write a tut on it kai?

  12. #12
    Join Date
    Dec 2007
    Location
    192.168.1.73
    Posts
    2,439
    Mentioned
    6 Post(s)
    Quoted
    119 Post(s)

    Default

    I just read this whole thread thinking that Da 0wner was Dr D Dervish, why have the same avvy?

    Anyway, 76 army?!

  13. #13
    Join Date
    Sep 2008
    Location
    Not here.
    Posts
    5,422
    Mentioned
    13 Post(s)
    Quoted
    242 Post(s)

    Default

    Yes, ... remember when I fixed Nielsie's tut runner... I had to make all of those, so that I could test it ... They are all about the same lvl, so when bounty hunter comes back, my rwt might still work.

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
  •