Results 1 to 8 of 8

Thread: blarge, readini not reading, probobly obvious error on my part lol

  1. #1
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default blarge, readini not reading, probobly obvious error on my part lol

    SCAR Code:
    procedure Start(sender: TObject);
    begin
      DeclarePlayers;
      FileName := AppPath + 'Scripts\AkwardMultiChopper.ini';
      if CheckBox4.Checked then
      begin
        WriteINI('PlayerSetUp', 'Name', Players[0].name, FileName);
        WriteINI('PlayerSetUp', 'Pass', Players[0].pass, FileName);
        WriteINI('PlayerSetUp', 'Nick', Players[0].nick, FileName);
        WriteINI('PlayerSetUp', 'World', inttostr(Players[0].Integers[1]), FileName);
        WriteINI('WoodCutSetUp', 'Tree', Players[0].Strings[0], FileName);
        WriteINI('WoodCutSetUp', 'Loads', inttostr(Players[0].Integers[0]), FileName);
        WriteINI('WoodCutSetUp', 'Weild', booltostr(Players[0].Booleans[0]), FileName);
      end;
      frmDesign.ModalResult:= mrOk;
    end;

    procedure Load(sender: TObject);
    begin
      Edit1.text := ReadINI('PlayerSetUp', 'Name', AppPath + 'Scripts\AkwardMultiChopper.ini');
      edit2.text := ReadINI('PlayerSetUp', 'Pass', AppPath + 'Scripts\AkwardMultiChopper.ini');
      edit3.text := ReadINI('PlayerSetUp', 'Nick', AppPath + 'Scripts\AkwardMultiChopper.ini');
      edit4.text := ReadINI('PlayerSetUp', 'World', AppPath + 'Scripts\AkwardMultiChopper.ini');
      ComboBox1.text := ReadINI('WoodCutSetUp', 'Tree', AppPath + 'Scripts\AkwardMultiChopper.ini');
      edit6.text := ReadINI('WoodCutSetUp', 'Loads', AppPath + 'Scripts\AkwardMultiChopper.ini');
      ComboBox2.text := ReadINI('WoodCutSetUp', 'Weild', AppPath + 'Scripts\AkwardMultiChopper.ini');
    end;

    this is my first time playing with ini files, so yeah lol.

    the writeini is all good, as in it rights the correct values to the correct names to the correct section in the correct files, but readini isnt reading it, or its not putting the text into the edit boxes/ combo boxes.

    it worked when i was testing it out, but not when i put it into the script

    thanks
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  2. #2
    Join Date
    Sep 2006
    Posts
    5,219
    Mentioned
    4 Post(s)
    Quoted
    1 Post(s)

    Default

    INI stuff looks fine to me with writeln. I'm guessing it's form stuff.

  3. #3
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    thats odd, i cant find anything bad with the form

    SCAR Code:
    TimeInitform := GetSystemTime;

      frmDesign := CreateForm;
      frmDesign.Position := poScreenCenter;
      frmDesign.BorderStyle := bsSingle;
      frmDesign.BorderIcons := [biMinimize,biSystemMenu];
      frmDesign.Width := 366;
      frmDesign.Height := 274;
      frmDesign.Caption := 'Akwardsaw'#39's Multi Tree Cutter';
      frmDesign.Color := clBtnFace;
      frmDesign.Font.Color := clWindowText;
      frmDesign.Font.Height := -11;
      frmDesign.Font.Name := 'MS Sans Serif';
      frmDesign.Font.Style := [];
      frmDesign.PixelsPerInch := 96;

      Label1 := TLabel.Create(frmDesign);
      Label1.Parent := frmDesign;
      Label1.Left := 0;
      Label1.Top := 0;
      Label1.Width := 353;
      Label1.Height := 31;
      Label1.Alignment := taCenter;
      Label1.Caption := 'Akwardsaw'#39's Multi Tree Cutter';
      Label1.Font.Color := clTeal;
      Label1.Font.Height := -17;
      Label1.Font.Name := 'Mangal';
      Label1.Font.Style := [fsBold, fsUnderline];

      GroupBox1 := TGroupBox.Create(frmDesign);
      GroupBox1.Parent := frmDesign;
      GroupBox1.Left := 8;
      GroupBox1.Top := 32;
      GroupBox1.Width := 185;
      GroupBox1.Height := 121;
      GroupBox1.Caption := 'Player Set Up';
      GroupBox1.TabOrder := 0;

      Label2 := TLabel.Create(GroupBox1);
      Label2.Parent := GroupBox1;
      Label2.Left := 8;
      Label2.Top := 24;
      Label2.Width := 56;
      Label2.Height := 13;
      Label2.Caption := 'User Name:';

      Label3 := TLabel.Create(GroupBox1);
      Label3.Parent := GroupBox1;
      Label3.Left := 8;
      Label3.Top := 48;
      Label3.Width := 49;
      Label3.Height := 13;
      Label3.Caption := 'Password:';

      Label4 := TLabel.Create(GroupBox1);
      Label4.Parent := GroupBox1;
      Label4.Left := 8;
      Label4.Top := 72;
      Label4.Width := 22;
      Label4.Height := 13;
      Label4.Caption := 'Nick';

      Label5 := TLabel.Create(GroupBox1);
      Label5.Parent := GroupBox1;
      Label5.Left := 8;
      Label5.Top := 96;
      Label5.Width := 69;
      Label5.Height := 13;
      Label5.Caption := 'SMART world:';

      Edit1 := TEdit.Create(GroupBox1);
      Edit1.Parent := GroupBox1;
      Edit1.Left := 72;
      Edit1.Top := 24;
      Edit1.Width := 105;
      Edit1.Height := 21;
      Edit1.TabOrder := 0;

      Edit2 := TEdit.Create(GroupBox1);
      Edit2.Parent := GroupBox1;
      Edit2.Left := 72;
      Edit2.Top := 48;
      Edit2.Width := 105;
      Edit2.Height := 21;
      Edit2.TabOrder := 1;

      Edit3 := TEdit.Create(GroupBox1);
      Edit3.Parent := GroupBox1;
      Edit3.Left := 72;
      Edit3.Top := 72;
      Edit3.Width := 105;
      Edit3.Height := 21;
      Edit3.TabOrder := 2;

      Edit4 := TEdit.Create(GroupBox1);
      Edit4.Parent := GroupBox1;
      Edit4.Left := 80;
      Edit4.Top := 96;
      Edit4.Width := 97;
      Edit4.Height := 21;
      Edit4.TabOrder := 3;

      GroupBox2 := TGroupBox.Create(frmDesign);
      GroupBox2.Parent := frmDesign;
      GroupBox2.Left := 208;
      GroupBox2.Top := 32;
      GroupBox2.Width := 137;
      GroupBox2.Height := 121;
      GroupBox2.Caption := 'Wood Cutting Set Up';
      GroupBox2.TabOrder := 1;

      ComboBox1 := TComboBox.Create(GroupBox2);
      ComboBox1.Parent := GroupBox2;
      ComboBox1.Left := 8;
      ComboBox1.Top := 20;
      ComboBox1.Width := 113;
      ComboBox1.Height := 21;
      ComboBox1.DropDownCount := 3;
      ComboBox1.ItemHeight := 13;
      ComboBox1.MaxLength := 3;
      ComboBox1.TabOrder := 0;
      ComboBox1.Text := 'Trees';
      ComboBox1.Items.Add('Normal');
      ComboBox1.Items.Add('Oak');
      ComboBox1.Items.Add('Willow');

      ComboBox2 := TComboBox.Create(GroupBox2);
      ComboBox2.Parent := GroupBox2;
      ComboBox2.Left := 8;
      ComboBox2.Top := 56;
      ComboBox2.Width := 113;
      ComboBox2.Height := 21;
      ComboBox2.ItemHeight := 13;
      ComboBox2.TabOrder := 1;
      ComboBox2.Text := 'Weild Hatchet?';
      ComboBox2.Items.Add('True');
      ComboBox2.Items.Add('False');

      Edit6 := TEdit.Create(GroupBox2);
      Edit6.Parent := GroupBox2;
      Edit6.Left := 8;
      Edit6.Top := 88;
      Edit6.Width := 113;
      Edit6.Height := 21;
      Edit6.TabOrder := 2;
      Edit6.Text := 'Amount of Loads';

      GroupBox3 := TGroupBox.Create(frmDesign);
      GroupBox3.Parent := frmDesign;
      GroupBox3.Left := 9;
      GroupBox3.Top := 160;
      GroupBox3.Width := 240;
      GroupBox3.Height := 73;
      GroupBox3.Caption := 'Script Set Up';
      GroupBox3.TabOrder := 2;

      CheckBox2 := TCheckBox.Create(GroupBox3);
      CheckBox2.Parent := GroupBox3;
      CheckBox2.Left := 7;
      CheckBox2.Top := 48;
      CheckBox2.Width := 89;
      CheckBox2.Height := 17;
      CheckBox2.Caption := 'Check News';
      CheckBox2.Checked := True;
      CheckBox2.State := cbChecked;
      CheckBox2.TabOrder := 0;

      CheckBox1 := TCheckBox.Create(GroupBox3);
      CheckBox1.Parent := GroupBox3;
      CheckBox1.Left := 7;
      CheckBox1.Top := 24;
      CheckBox1.Width := 97;
      CheckBox1.Height := 17;
      CheckBox1.Caption := 'Check Version';
      CheckBox1.Checked := True;
      CheckBox1.State := cbChecked;
      CheckBox1.TabOrder := 1;

      CheckBox3 := TCheckBox.Create(GroupBox3);
      CheckBox3.Parent := GroupBox3;
      CheckBox3.Left := 104;
      CheckBox3.Top := 24;
      CheckBox3.Width := 113;
      CheckBox3.Height := 17;
      CheckBox3.Caption := 'Save Progress to file';
      CheckBox3.Checked := True;
      CheckBox3.State := cbChecked;
      CheckBox3.TabOrder := 2;

      CheckBox4 := TCheckBox.Create(GroupBox3);
      CheckBox4.Parent := GroupBox3;
      CheckBox4.Left := 104;
      CheckBox4.Top := 48;
      CheckBox4.Width := 137;
      CheckBox4.Height := 17;
      CheckBox4.Caption := 'Save Player Data on run';
      CheckBox4.Checked := True;
      CheckBox4.State := cbChecked;
      CheckBox4.TabOrder := 3;

      Button1 := TButton.Create(frmDesign);
      Button1.Parent := frmDesign;
      Button1.Left := 264;
      Button1.Top := 168;
      Button1.Width := 75;
      Button1.Height := 25;
      Button1.Caption := 'Run Script';
      Button1.TabOrder := 3;
      Button1.OnClick:= @Start;

      Button2 := TButton.Create(frmDesign);
      Button2.Parent := frmDesign;
      Button2.Left := 264;
      Button2.Top := 200;
      Button2.Width := 75;
      Button2.Height := 25;
      Button2.Caption := 'Load Data';
      Button2.TabOrder := 4;

    is my form, if you want to look
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

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

    Default

    wow, too much typing... why not just use for..to..do loops for each thing?

  5. #5
    Join Date
    Jul 2007
    Location
    Norway.
    Posts
    1,938
    Mentioned
    3 Post(s)
    Quoted
    0 Post(s)

    Default

    While we're at it, I'd advise you to use with..do-statements, Akwardsaw. (Cool name!)

    Here's an example.

    SCAR Code:
    Label1 := TLabel.Create(frmDesign);
      Label1.Parent := frmDesign;
      Label1.Left := 0;
      Label1.Top := 0;
      Label1.Width := 353;
      Label1.Height := 31;
      Label1.Alignment := taCenter;
      Label1.Caption := 'Akwardsaw'#39's Multi Tree Cutter';
      Label1.Font.Color := clTeal;
      Label1.Font.Height := -17;
      Label1.Font.Name := 'Mangal';
      Label1.Font.Style := [fsBold, fsUnderline];

    If not to others, then at least to me this seems less organized alternative presented below. And, by the way -- expressions in forms that := 0 don't need to be declared.

    SCAR Code:
    Label1 := TLabel.Create(frmDesign);
      with Label1 do
      begin
        Parent := frmDesign;
        Width := 353;
        Height := 31;
        Alignment := taCenter;
        Caption := 'Akwardsaw'#39's Multi Tree Cutter';
        with Font do
        begin
          Color := clTeal;
          Height := -17;
          Name := 'Mangal';
          Style := [fsBold, fsUnderline];
        end;
      end;

  6. #6
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    yeah, i usually DO use with..do loops, but for some reason i wanted it the old fashioned way

    thanks though

    any idea on how to fix it though?
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

  7. #7
    Join Date
    Mar 2007
    Posts
    4,810
    Mentioned
    3 Post(s)
    Quoted
    3 Post(s)

    Default

    I'm not fully sure but try re-naming one Sender, so:

    SCAR Code:
    Sender1 : TObject;
    Because before I've had this problem with saving

    However, if you post the whole script then it may be easier to see where the error is.
    Last edited by Naum; 08-07-2009 at 09:31 PM.

  8. #8
    Join Date
    May 2007
    Location
    knoxville
    Posts
    2,873
    Mentioned
    7 Post(s)
    Quoted
    70 Post(s)

    Default

    mkay, let me get to the other cpu

    edit:
    SCAR Code:
    program New;
    {.include SRL/SRL/Misc/Smart.scar}
    {.Include SRL/SRL.scar}
    {.include srl/srl/reflection/reflection.scar}

    var
      logs, xp, loads, time: integer;
      exp: extended;
      frmDesign : TForm;
      Label1, Label2, Label3, Label4,
      Label5 : TLabel;
      GroupBox1, GroupBox2, GroupBox3 : TGroupBox;
      Edit1, Edit2, Edit3, Edit4,
      Edit6 : TEdit;
      ComboBox1, ComboBox2 : TComboBox;
      CheckBox2, CheckBox1, CheckBox3, CheckBox4 : TCheckBox;
      Button1, Button2 : TButton;
      filename: string;
     
    procedure DeclarePlayers;
    begin

      HowManyPlayers := 1;
      NumberOfPlayers(HowManyPlayers);
      CurrentPlayer := 0;

      with Players[0] do
      begin
        Name := edit1.text;
        Pass := edit2.text;
        Nick := edit3.text;
        Active := True;
        Integers[0] := strtoint(edit6.text);
        Integers[1] := strtoint(edit4.text);
        Booleans[0] := strtobool(ComboBox2.text);
        Strings[0] := ComboBox1.text;
        BoxRewards := ['XP', 'ostume'];
      end;
      writeln(Players[0].name + Players[0].Strings[0]);
    end;

    procedure Start(sender: TObject);
    begin
      DeclarePlayers;
      FileName := AppPath + 'Scripts\AkwardMultiChopper.ini';
      if CheckBox4.Checked then
      begin
        WriteINI('PlayerSetUp', 'Name', Players[0].name, FileName);
        WriteINI('PlayerSetUp', 'Pass', Players[0].pass, FileName);
        WriteINI('PlayerSetUp', 'Nick', Players[0].nick, FileName);
        WriteINI('PlayerSetUp', 'World', inttostr(Players[0].Integers[1]), FileName);
        WriteINI('WoodCutSetUp', 'Tree', Players[0].Strings[0], FileName);
        WriteINI('WoodCutSetUp', 'Loads', inttostr(Players[0].Integers[0]), FileName);
        WriteINI('WoodCutSetUp', 'Weild', booltostr(Players[0].Booleans[0]), FileName);
      end;
      frmDesign.ModalResult:= mrOk;
    end;

    procedure Load(sender: TObject);

    begin
      edit1.text := ReadINI('PlayerSetUp', 'Name', AppPath + 'Scripts\AkwardMultiChopper.ini');
      edit2.text := ReadINI('PlayerSetUp', 'Pass', AppPath + 'Scripts\AkwardMultiChopper.ini');
      edit3.text := ReadINI('PlayerSetUp', 'Nick', AppPath + 'Scripts\AkwardMultiChopper.ini');
      edit4.text := ReadINI('PlayerSetUp', 'World', AppPath + 'Scripts\AkwardMultiChopper.ini');
      ComboBox1.text := ReadINI('WoodCutSetUp', 'Tree', AppPath + 'Scripts\AkwardMultiChopper.ini');
      edit6.text := ReadINI('WoodCutSetUp', 'Loads', AppPath + 'Scripts\AkwardMultiChopper.ini');
      ComboBox2.text := ReadINI('WoodCutSetUp', 'Weild', AppPath + 'Scripts\AkwardMultiChopper.ini');
    end;

    procedure Initform;
    var
      TimeInitform : Integer;
    begin
      TimeInitform := GetSystemTime;

      frmDesign := CreateForm;
      frmDesign.Position := poScreenCenter;
      frmDesign.BorderStyle := bsSingle;
      frmDesign.BorderIcons := [biMinimize,biSystemMenu];
      frmDesign.Width := 366;
      frmDesign.Height := 274;
      frmDesign.Caption := 'Akwardsaw'#39's Multi Tree Cutter';
      frmDesign.Color := clBtnFace;
      frmDesign.Font.Color := clWindowText;
      frmDesign.Font.Height := -11;
      frmDesign.Font.Name := 'MS Sans Serif';
      frmDesign.Font.Style := [];
      frmDesign.PixelsPerInch := 96;

      Label1 := TLabel.Create(frmDesign);
      Label1.Parent := frmDesign;
      Label1.Left := 0;
      Label1.Top := 0;
      Label1.Width := 353;
      Label1.Height := 31;
      Label1.Alignment := taCenter;
      Label1.Caption := 'Akwardsaw'#39's Multi Tree Cutter';
      Label1.Font.Color := clTeal;
      Label1.Font.Height := -17;
      Label1.Font.Name := 'Mangal';
      Label1.Font.Style := [fsBold, fsUnderline];

      GroupBox1 := TGroupBox.Create(frmDesign);
      GroupBox1.Parent := frmDesign;
      GroupBox1.Left := 8;
      GroupBox1.Top := 32;
      GroupBox1.Width := 185;
      GroupBox1.Height := 121;
      GroupBox1.Caption := 'Player Set Up';
      GroupBox1.TabOrder := 0;

      Label2 := TLabel.Create(GroupBox1);
      Label2.Parent := GroupBox1;
      Label2.Left := 8;
      Label2.Top := 24;
      Label2.Width := 56;
      Label2.Height := 13;
      Label2.Caption := 'User Name:';

      Label3 := TLabel.Create(GroupBox1);
      Label3.Parent := GroupBox1;
      Label3.Left := 8;
      Label3.Top := 48;
      Label3.Width := 49;
      Label3.Height := 13;
      Label3.Caption := 'Password:';

      Label4 := TLabel.Create(GroupBox1);
      Label4.Parent := GroupBox1;
      Label4.Left := 8;
      Label4.Top := 72;
      Label4.Width := 22;
      Label4.Height := 13;
      Label4.Caption := 'Nick';

      Label5 := TLabel.Create(GroupBox1);
      Label5.Parent := GroupBox1;
      Label5.Left := 8;
      Label5.Top := 96;
      Label5.Width := 69;
      Label5.Height := 13;
      Label5.Caption := 'SMART world:';

      Edit1 := TEdit.Create(GroupBox1);
      Edit1.Parent := GroupBox1;
      Edit1.Left := 72;
      Edit1.Top := 24;
      Edit1.Width := 105;
      Edit1.Height := 21;
      Edit1.TabOrder := 0;

      Edit2 := TEdit.Create(GroupBox1);
      Edit2.Parent := GroupBox1;
      Edit2.Left := 72;
      Edit2.Top := 48;
      Edit2.Width := 105;
      Edit2.Height := 21;
      Edit2.TabOrder := 1;

      Edit3 := TEdit.Create(GroupBox1);
      Edit3.Parent := GroupBox1;
      Edit3.Left := 72;
      Edit3.Top := 72;
      Edit3.Width := 105;
      Edit3.Height := 21;
      Edit3.TabOrder := 2;

      Edit4 := TEdit.Create(GroupBox1);
      Edit4.Parent := GroupBox1;
      Edit4.Left := 80;
      Edit4.Top := 96;
      Edit4.Width := 97;
      Edit4.Height := 21;
      Edit4.TabOrder := 3;

      GroupBox2 := TGroupBox.Create(frmDesign);
      GroupBox2.Parent := frmDesign;
      GroupBox2.Left := 208;
      GroupBox2.Top := 32;
      GroupBox2.Width := 137;
      GroupBox2.Height := 121;
      GroupBox2.Caption := 'Wood Cutting Set Up';
      GroupBox2.TabOrder := 1;

      ComboBox1 := TComboBox.Create(GroupBox2);
      ComboBox1.Parent := GroupBox2;
      ComboBox1.Left := 8;
      ComboBox1.Top := 20;
      ComboBox1.Width := 113;
      ComboBox1.Height := 21;
      ComboBox1.DropDownCount := 3;
      ComboBox1.ItemHeight := 13;
      ComboBox1.MaxLength := 3;
      ComboBox1.TabOrder := 0;
      ComboBox1.Text := 'Trees';
      ComboBox1.Items.Add('Normal');
      ComboBox1.Items.Add('Oak');
      ComboBox1.Items.Add('Willow');

      ComboBox2 := TComboBox.Create(GroupBox2);
      ComboBox2.Parent := GroupBox2;
      ComboBox2.Left := 8;
      ComboBox2.Top := 56;
      ComboBox2.Width := 113;
      ComboBox2.Height := 21;
      ComboBox2.ItemHeight := 13;
      ComboBox2.TabOrder := 1;
      ComboBox2.Text := 'Weild Hatchet?';
      ComboBox2.Items.Add('True');
      ComboBox2.Items.Add('False');

      Edit6 := TEdit.Create(GroupBox2);
      Edit6.Parent := GroupBox2;
      Edit6.Left := 8;
      Edit6.Top := 88;
      Edit6.Width := 113;
      Edit6.Height := 21;
      Edit6.TabOrder := 2;
      Edit6.Text := 'Amount of Loads';

      GroupBox3 := TGroupBox.Create(frmDesign);
      GroupBox3.Parent := frmDesign;
      GroupBox3.Left := 9;
      GroupBox3.Top := 160;
      GroupBox3.Width := 240;
      GroupBox3.Height := 73;
      GroupBox3.Caption := 'Script Set Up';
      GroupBox3.TabOrder := 2;

      CheckBox2 := TCheckBox.Create(GroupBox3);
      CheckBox2.Parent := GroupBox3;
      CheckBox2.Left := 7;
      CheckBox2.Top := 48;
      CheckBox2.Width := 89;
      CheckBox2.Height := 17;
      CheckBox2.Caption := 'Check News';
      CheckBox2.Checked := True;
      CheckBox2.State := cbChecked;
      CheckBox2.TabOrder := 0;

      CheckBox1 := TCheckBox.Create(GroupBox3);
      CheckBox1.Parent := GroupBox3;
      CheckBox1.Left := 7;
      CheckBox1.Top := 24;
      CheckBox1.Width := 97;
      CheckBox1.Height := 17;
      CheckBox1.Caption := 'Check Version';
      CheckBox1.Checked := True;
      CheckBox1.State := cbChecked;
      CheckBox1.TabOrder := 1;

      CheckBox3 := TCheckBox.Create(GroupBox3);
      CheckBox3.Parent := GroupBox3;
      CheckBox3.Left := 104;
      CheckBox3.Top := 24;
      CheckBox3.Width := 113;
      CheckBox3.Height := 17;
      CheckBox3.Caption := 'Save Progress to file';
      CheckBox3.Checked := True;
      CheckBox3.State := cbChecked;
      CheckBox3.TabOrder := 2;

      CheckBox4 := TCheckBox.Create(GroupBox3);
      CheckBox4.Parent := GroupBox3;
      CheckBox4.Left := 104;
      CheckBox4.Top := 48;
      CheckBox4.Width := 137;
      CheckBox4.Height := 17;
      CheckBox4.Caption := 'Save Player Data on run';
      CheckBox4.Checked := True;
      CheckBox4.State := cbChecked;
      CheckBox4.TabOrder := 3;

      Button1 := TButton.Create(frmDesign);
      Button1.Parent := frmDesign;
      Button1.Left := 264;
      Button1.Top := 168;
      Button1.Width := 75;
      Button1.Height := 25;
      Button1.Caption := 'Run Script';
      Button1.TabOrder := 3;
      Button1.OnClick:= @Start;

      Button2 := TButton.Create(frmDesign);
      Button2.Parent := frmDesign;
      Button2.Left := 264;
      Button2.Top := 200;
      Button2.Width := 75;
      Button2.Height := 25;
      Button2.Caption := 'Load Data';
      Button2.TabOrder := 4;

      WriteLn('Initform compiled in ' + IntToStr(GetSystemTime - TimeInitform) + ' milliseconds!');
    end;

    procedure SafeInitform;
    var
      v : TVariantArray;
    begin
      SetArrayLength(v, 0);
      ThreadSafeCall('Initform', v);
    end;

    procedure ShowInitformModal;
    begin
      frmDesign.ShowModal;
    end;

    procedure SafeShowInitformModal;
    var
      v : TVariantArray;
    begin
      SetArrayLength(v, 0);
      ThreadSafeCall('ShowInitformModal', v);
    end;

    procedure MainInitform;
    begin
      try
        SafeInitform;
        SafeShowInitformModal;
      finally
        FreeForm(frmDesign);
      except
        WriteLn('An error seems to have occurred in: Initform');
      end;
    end;

    procedure AntiBan;
    begin
      R_FindRandoms;
      wait(100 + random(2000));
      case random(20) of
        0: Gametab(1+random(13));
        2: wait(1000 + random(3000));
        3: begin
             MakeCompass(IntToStr(random(361)));
             SleepAndMoveMouse(1000+random(500));
             MakeCompass(IntToStr(random(361)));
           end;
        end;
      gametab(tab_inv);
    end;

    Function ChopNorm: boolean;
    var
      T : tpointarray;
      i, x, y, d: integer;
    begin
      result:= true;
      d:= 0;
      repeat
        if not loggedin then exit;
        ColorToleranceSpeed(3);
        FindColorsSpiralTolerance(MSCX, MSCY, T, 2518368, MSX1, MSY1, MSX2, MSY2, 15);
        if Length(T) = 0 then
        begin
          writeln('color not found');
          result:= false;
          exit;
        end;
        for i:= 0 to high(t) do
        begin
          mmouse(T[i].X, T[i].Y, 0, 0);
          if isuptext('Tree') then
          begin
            getmousepos(x, y);
            mouse(x, y, 0, 0, true);
            wait(100 + random(2000));
            While (CharacterMoving or CharacterAnimating) do AntiBan;
          end;
            if invfull then exit;
          Break;
        end;
        While (CharacterMoving or CharacterAnimating) do AntiBan;
      until invfull or result = false;
      if not result then
        writeln('Something has gone wrong, Oaks not found.');
    end;

    Function ChopOak: boolean;
    var
      T : tpointarray;
      i, x, y, d: integer;
      label comeback;
    begin
      result:= true;
      d:= 0;
      comeback:
      repeat
        if not loggedin then exit;
        ColorToleranceSpeed(3);
        FindColorsSpiralTolerance(MSCX, MSCY, T, 1064755, MSX1, MSY1, MSX2, MSY2, 15);
        if Length(T) = 0 then
        begin
          writeln('color not found');
          result:= false;
          exit;
        end;
        for i:= 0 to high(t) do
        begin
          mmouse(T[i].X, T[i].Y, 0, 0);
          if isuptext('Oak') then
          begin
            getmousepos(x, y);
            mouse(x, y, 0, 0, true);
            wait(100 + random(2000));
            While (CharacterMoving or CharacterAnimating) do AntiBan;
          end;
            if invfull then exit;
          Break;
        end;
      until invfull or result = false;
      if not result then
        writeln('Something has gone wrong, Oaks not found.');
    end;

    Function Chopwillow: boolean;
    var
      T : tpointarray;
      i, x, y, d: integer;

    begin
      result:= true;
      d:= 0;
      repeat
        if not loggedin then exit;
        ColorToleranceSpeed(3);
        FindColorsSpiralTolerance(MSCX, MSCY, T, 6063478, MSX1, MSY1, MSX2, MSY2, 15);
        if Length(T) = 0 then
        begin
          writeln('color not found');
          result:= false;
          exit;
        end;
        for i:= 0 to high(t) do
        begin
          mmouse(T[i].X, T[i].Y, 0, 0);
          if isuptext('illow') then
          begin
            getmousepos(x, y);
            mouse(x, y, 0, 0, true);
            wait(100 + random(2000));
            While (CharacterMoving or CharacterAnimating) do AntiBan;
          end;
            if invfull then exit;
          Break;
        end;
        While (CharacterMoving or CharacterAnimating) do AntiBan;
      until invfull or result = false;
      if not result then
        writeln('Something has gone wrong, willows not found.');
    end;

    procedure DropLogs;
    var c: integer;
    begin
      if not loggedin then exit;
      if not invfull then exit;
      if players[CurrentPlayer].booleans[0] then
      begin
         dropall;
         incex(logs, 28);
         exp:= logs * 67.5 //need to change
         xp:= round(exp);
      end;
      if not players[CurrentPlayer].booleans[0] then
      begin
        for c:= 2 to 28 do
          DropItem(c);
        incex(logs, 27);
        exp:= logs * 67.5 //need to change
        xp:= round(exp);
        inc(loads);
      end;
    end;

    procedure ChopTree;
    begin
      case lowercase(players[currentplayer].strings[0]) of
        'normal': ChopNorm;
        'oak': ChopOak;
        'willow': Chopwillow;
      end;
    end;

    procedure saveprog;
    var h, m, s: integer;
    begin
      ConvertTime(GetSystemTime - Time, h, m, s);
      WriteINI('Progress', 'Current_Player', players[currentplayer].nick, Apppath +
        'Akward Multi Power Cutter Proggress report.ini');
      WriteINI('Progress', 'Player_Status', booltostr(players[currentplayer].active),
      Apppath + 'Akward Multi Power Cutter Proggress report.ini');
      WriteINI('Progress', 'Tree', players[currentplayer].strings[0], Apppath +
        'Akward Multi Power Cutter Proggress report.ini');
      WriteINI('Progress', 'Hatchet_Weilded', booltostr(players[currentplayer].booleans[0]), Apppath +
        'Akward Multi Power Cutter Proggress report.ini');
      WriteINI('Progress', 'Logs_Chopped', inttostr(logs), Apppath +
        'Akward Multi Power Cutter Proggress report.ini');
      WriteINI('Progress', 'xp_gained', inttostr(xp), Apppath +
        'Akward Multi Power Cutter Proggress report.ini');
      WriteINI('Progress', 'xp_gained', (inttostr(h) + ':' + inttostr(m) + ':' +  inttostr(s)), Apppath +
        'Akward Multi Power Cutter Proggress report.ini');
    end;

    procedure prog;
    var h, m, s: integer;
    begin
      changereportwidth(250);
      Clearreport;
      ConvertTime(GetSystemTime - Time, h, m, s);
      addtoreport('Akwardsaw''s Multi Chopper');
      addtoreport('                         ');
      addtoreport('Current player: ' + players[currentplayer].nick);
      addtoreport('Player Status: ' + booltostr(players[currentplayer].active));
      addtoreport('Logs to chop: ' + players[currentplayer].strings[0]);
      addtoreport('Hatchet weilded: ' + booltostr(players[currentplayer].booleans[0]));
      addtoreport('Logs Chopped: ' + inttostr(logs));
      addtoreport('Exp Gained: ' + inttostr(xp));
      addtoreport('Time Running: ' + inttostr(h) + ':' + inttostr(m) + ':' +  inttostr(s));
      if CheckBox3.Checked then saveprog;
    end;

    function getversion: boolean;
    var Version, Ver : string;
    begin
      Ver:= '1.0'; //DO NOT CHANGE UNLESS YOU WANT AN OUTDATED VERSION!
      Version:= GetPage('http://akwardversions.webs.com/PowerChopperVersion.txt');
      if Version <> Ver then
        result:= false
      else
      result:= true;
    end;

    procedure NewsFlash;
    var
      News : string;
    begin
      News:= GetPage('http://akwardversions.webs.com/PowerChopperNews.txt');
      writeln(' ');
      WriteLn(News);
      Wait(10000);
      writeln(' ');
    end;

    procedure scriptterminate;
    begin
      prog;
    end;

    begin
      MainInitform;
      if CheckBox1.Checked then
      if not getversion then
         if GetApplication.MessageBox('Current Script is outdated! continue?', 'OUTDATED', 4) = mrno then
          begin
            writeln('You can get the updated version on the thread');
            writeln('Terminating script');
            terminatescript;
          end;
      if CheckBox2.Checked then newsflash;

      Smart_Server := players[currentplayer].Integers[1];
      SetupSRL;
      Setupreflection;
      mousespeed:= 10;
      if not loggedin then loginplayer;
      while not gametab(tab_inv) do wait(10);
      setangle(true);
      clearreport;
      cleardebug;
      marktime(time);
      repeat
        ChopTree;
        DropLogs;
      until (loads = players[currentplayer].integers[0]) or AllPlayersInactive;
    end.

    i'll try changing the senders name real fast too

    edit before naum ninjas: i forgot teh onclick for button2, and i changed the sender names. it still doenst load when you click "load", but when you click start, and it doesnt start lol. i need to read up on senders i guess

    triple edit: fixed it hopfully, i just changed around the order of the proceduders, and that somehow fixed it

    +rep for every one who helped though
    Last edited by Awkwardsaw; 08-07-2009 at 10:11 PM.
    <TViYH> i had a dream about you again awkwardsaw
    Malachi 2:3

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
  •