Results 1 to 7 of 7

Thread: How to make script wait until...

  1. #1
    Join Date
    Oct 2006
    Posts
    334
    Mentioned
    0 Post(s)
    Quoted
    18 Post(s)

    Default How to make script wait until...

    so far, the script makes a form AND starts typing at the same time. I want it to make the form THEN wait until the button is pressed to start typing.

    I also want to make it so that certain editforms in the form change certain constants. How do I do this?

    SCAR Code:
    {
    _______________   ____________  ______________  _____    ____        _____
    |             |   |          |  |           ||  |   |  |/    |       |   ||
    |    _________|   |___    ___| ||   ________|   |___|  |     |       |   ||
     \   \____________    |  |     |   |/                  |     |\      |   ||
      \               |   |  |     |   |            |   |  |       ||    |   ||
       \__________    |   |  |    ||   |_______     |   |  |   \|   ||   |   ||
               /|/    /   |  |    |    _______/     |   |  |   | \   ||  |   ||
              /|/    /    |  |   ||   |/            |   |  |   |  \   ||_|   ||
      _______/|/    /     |  |   |   ||             |   |  |   |   \   |||   ||
     |             /      |  |   |   |_______       |   |  |   |    \        ||
     |____________/       |__|  /___________/       |   | /____|     \_______||
      _______________________________________________________________________
    <|Stein's Super Untrackable Autotyper.                                   |>
    <|Types up to 4 messages at a human pace.                                |>
    <|Setup lines 24-29 with ease!!!                                         |>
    <|_______________________________________________________________________|>
      \/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/\/
    }

    program typer;
    {.include srl/srl.scar}

    const
    messages=2; {number of messages}

    Message1='buy 162 iron-usa';  //first message to be typed
    Message2='buy coal-usa';      //second message to be typed, will be excluded if "messages<2"
    Message3='enter message here';   //third message to be typed, will be excluded if "messages<3"
    Message4='enter message here';   //fourth message to be typed, will be excluded if "messages<4"


    var
    xco, yco:integer;
      frmDesign : TForm;
      Label1 : TLabel;
      Label2 : TLabel;
      Label3 : TLabel;
      Label4 : TLabel;
      Label5 : TLabel;
      startbut : TButton;
      message1edit : TEdit;
      message2edit : TEdit;
      message3edit : TEdit;
      message4edit : TEdit;
      Edit5 : TEdit;
    //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
    procedure hide;
    begin
    SetupSRL
    disguisescar('AOL Instant Messanger')
    end;
    //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
    procedure buttonclick(sender: TObject);
    begin
    Writeln('Button pressed!');
    frmDesign.Caption:= frmDesign.Caption + '.';
    end;
    //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
    procedure InitForm;
    begin
    frmDesign := CreateForm;
    frmDesign.Left := 312;
    frmDesign.Top := 120;
    frmDesign.Width := 242;
    frmDesign.Height := 258;
    frmDesign.Caption := 'frmDesign';
    frmDesign.Color := clBtnFace;
    frmDesign.Font.Color := clWindowText;
    frmDesign.Font.Height := -11;
    frmDesign.Font.Name := 'MS Sans Serif';
    frmDesign.Font.Style := [];
    frmDesign.ShowHint := True;
    frmDesign.Visible := false;
    frmDesign.PixelsPerInch := 96;
    Label1 := TLabel.Create(frmDesign);
    Label1.Parent := frmDesign;
    Label1.Left := 5;
    Label1.Top := 60;
    Label1.Width := 67;
    Label1.Height := 16;
    Label1.Caption := 'Message 1';
    Label1.Font.Color := clWindowText;
    Label1.Font.Height := -13;
    Label1.Font.Name := 'MS Sans Serif';
    Label1.Font.Style := [];
    Label1.ParentFont := False;
    Label2 := TLabel.Create(frmDesign);
    Label2.Parent := frmDesign;
    Label2.Left := 5;
    Label2.Top := 89;
    Label2.Width := 67;
    Label2.Height := 16;
    Label2.Caption := 'Message 2';
    Label2.Font.Color := clWindowText;
    Label2.Font.Height := -13;
    Label2.Font.Name := 'MS Sans Serif';
    Label2.Font.Style := [];
    Label2.ParentFont := False;
    Label3 := TLabel.Create(frmDesign);
    Label3.Parent := frmDesign;
    Label3.Left := 5;
    Label3.Top := 122;
    Label3.Width := 67;
    Label3.Height := 16;
    Label3.Caption := 'Message 3';
    Label3.Font.Color := clWindowText;
    Label3.Font.Height := -13;
    Label3.Font.Name := 'MS Sans Serif';
    Label3.Font.Style := [];
    Label3.ParentFont := False;
    Label4 := TLabel.Create(frmDesign);
    Label4.Parent := frmDesign;
    Label4.Left := 5;
    Label4.Top := 149;
    Label4.Width := 67;
    Label4.Height := 16;
    Label4.Caption := 'Message 4';
    Label4.Font.Color := clWindowText;
    Label4.Font.Height := -13;
    Label4.Font.Name := 'MS Sans Serif';
    Label4.Font.Style := [];
    Label4.ParentFont := False;
    Label5 := TLabel.Create(frmDesign);
    Label5.Parent := frmDesign;
    Label5.Left := 4;
    Label5.Top := 23;
    Label5.Width := 132;
    Label5.Height := 16;
    Label5.Caption := 'Number of Messages:';
    Label5.Font.Color := clWindowText;
    Label5.Font.Height := -13;
    Label5.Font.Name := 'MS Sans Serif';
    Label5.Font.Style := [];
    Label5.ParentFont := False;
    startbut := TButton.Create(frmDesign);
    startbut.OnClick:= @buttonclick;
    startbut.Parent := frmDesign;
    startbut.Left := 83;
    startbut.Top := 184;
    startbut.Width := 75;
    startbut.Height := 25;
    startbut.Hint := 'starts script';
    startbut.Caption := 'Start';
    startbut.ParentShowHint := False;
    startbut.ShowHint := True;
    startbut.TabOrder := 8;
    message1edit := TEdit.Create(frmDesign);
    message1edit.Parent := frmDesign;
    message1edit.Left := 80;
    message1edit.Top := 57;
    message1edit.Width := 121;
    message1edit.Height := 21;
    message1edit.Hint := 'enter message';
    message1edit.ParentShowHint := False;
    message1edit.ShowHint := True;
    message1edit.TabOrder := 9;
    message1edit.Text := 'message1edit';
    message2edit := TEdit.Create(frmDesign);
    message2edit.Parent := frmDesign;
    message2edit.Left := 80;
    message2edit.Top := 87;
    message2edit.Width := 121;
    message2edit.Height := 21;
    message2edit.Hint := 'enter message';
    message2edit.ParentShowHint := False;
    message2edit.ShowHint := True;
    message2edit.TabOrder := 10;
    message2edit.Text := 'message2edit';
    message3edit := TEdit.Create(frmDesign);
    message3edit.Parent := frmDesign;
    message3edit.Left := 80;
    message3edit.Top := 117;
    message3edit.Width := 121;
    message3edit.Height := 21;
    message3edit.Hint := 'enter message';
    message3edit.ParentShowHint := False;
    message3edit.ShowHint := True;
    message3edit.TabOrder := 11;
    message3edit.Text := 'message3edit';
    message4edit := TEdit.Create(frmDesign);
    message4edit.Parent := frmDesign;
    message4edit.Left := 80;
    message4edit.Top := 147;
    message4edit.Width := 121;
    message4edit.Height := 21;
    message4edit.TabOrder := 12;
    message4edit.Text := 'message4edit';
    Edit5 := TEdit.Create(frmDesign);
    Edit5.Parent := frmDesign;
    Edit5.Left := 141;
    Edit5.Top := 21;
    Edit5.Width := 35;
    Edit5.Height := 21;
    Edit5.Hint := '#';
    Edit5.ParentShowHint := False;
    Edit5.ShowHint := True;
    Edit5.TabOrder := 13;
    Edit5.Text := 'Edit5';
    end;
    //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
    procedure SafeInitForm;
    var
    v: TVariantArray;
    begin
    setarraylength(V, 0);
    ThreadSafeCall('InitForm', v);
    end;
    //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
    procedure ShowFormModal;
    begin
    frmDesign.ShowModal;
    end;
    //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
    procedure SafeShowFormModal;
    var
    v: TVariantArray;
    begin
    setarraylength(V, 0);
    ThreadSafeCall('ShowFormModal', v);
    end;
    //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
    procedure type1;
    begin
          if messages>0 then
             begin
             cleardebug
             writeln('typing message 1');
             typesend(Message1);
             wait(100+random(100));
             end;
    end;
    //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
    procedure type2;
    begin
         if messages>1 then
            begin
            cleardebug
                 writeln('typing message 2');
                 typesend(Message2);
                 wait(100+random(100));
                 end;
    end;
    //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
    procedure type3;
    begin
         if messages>2 then
                    begin
                    cleardebug
                    writeln('typing message 3');
                    typesend(Message3);
                    wait(100+random(100));
                    end;
    end;
    //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
    Procedure type4;
    begin
         if messages>3 then
                       begin
                       cleardebug
                       writeln('typing message 4');
                       typesend(Message4);
                       wait(100+random(100));
                       end;
    end;
    //MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM
    procedure trade;
    begin
         if findcolor(xco,yco,8388736,18,415,236,431) then
            begin
            cleardebug
              writeln('found trade')
              MMouse(xco,yco,0,0);
              wait(100+random(50))
              Mouse(xco,yco,0,0,true);
              writeln('accepted trade')
              exit;
            end;
    end;




    begin
    hide;
    safeinitform;
    SafeShowFormModal;
    repeat
    type1;
    trade;
    type2;
    trade;
    type3;
    trade;
    type4;
    trade;
    until(IsFKeyDown(12));
    end.

  2. #2
    Join Date
    Mar 2007
    Posts
    79
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Do something like

    SCAR Code:
    repeat
       wait(100);
    until(buttonPressed);

    I dont know forms, and Im learning SCAR at the moment ... but, just figured Id give you what I thought would be the solution.

    Hope it helps.
    GL.

  3. #3
    Join Date
    Oct 2006
    Posts
    334
    Mentioned
    0 Post(s)
    Quoted
    18 Post(s)

    Default

    thanks. how do i set the buttonpressed to a form button?

  4. #4
    Join Date
    Mar 2007
    Posts
    79
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    http://www.villavu.com/forum/showthread.php?t=1616

    Check that out. Otherwise, wait until someone else responds... Forms > Me.

  5. #5
    Join Date
    Jun 2006
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    SCAR Code:
    procedure buttonclick(sender: TObject);
    begin
    Writeln('Button pressed!');
    frmDesign.Caption:= frmDesign.Caption + '.';
    frm.Design.ShowModal := mrOk; //add this line!
    end;

    In this procedure, add frm.Design.ShowModal := mrOk;

    Also, for your second request, you must change message1 - 4 into variables (so they can be edited once the script starts). then put in this procedure after the form ends.

    SCAR Code:
    procedure DeclareVar;
    begin
      Message1 := message1edit.text;
      Message2 := message2edit.text;
      Message3 := message3edit.text;
      Message4 := message4edit.text;
    end;

    If you have any questions about what i did, feel free to ask!

  6. #6
    Join Date
    Oct 2006
    Posts
    334
    Mentioned
    0 Post(s)
    Quoted
    18 Post(s)

    Default

    k... I don't get the first one...
    what does that do?

  7. #7
    Join Date
    Jun 2006
    Posts
    1,492
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ends the form when the button is clicked. then, it will go into that loop after safeshowformmodal

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Need Someone To Make Script With
    By skilld u in forum RS3 Outdated / Broken Scripts
    Replies: 0
    Last Post: 10-06-2007, 10:21 PM
  2. What script to make
    By steth1010 in forum RS3 Outdated / Broken Scripts
    Replies: 9
    Last Post: 05-11-2007, 09:44 PM
  3. [Help] How do i make a fighter wait?
    By Hey321 in forum OSR Help
    Replies: 5
    Last Post: 11-11-2006, 07:59 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
  •