Results 1 to 3 of 3

Thread: Type Mismatch Error?

  1. #1
    Join Date
    Jun 2007
    Location
    Kentucky, United States of America
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Type Mismatch Error?

    I've never encountered this error before, so I'm not sure what I'm doing wrong. I searched the forums and the SRL manual for it and couldn't find anything about it.

    It says there is a Type Mismatch error in line 253.

    Here's the script.

    SCAR Code:
    {====================================================================|
    |      CrossBack7's Autotalker 0.1 - First Script                    |
    |       -Can Enter Up to Four Messages.                              |
    |       -If No Message Is Entered, It Will Not Type Anything for It. |
    |       -Just Fill In Form and Press Start.                          |
    |       -Hold the F10 Key Down to Stop the Script.                   |
    | Suggestions are appreciated.  This is basically a little of a      |
    |variation on Bebemycat2's tut.  Thanks to her for her help.         |
    |I'd like to add more to this.                                       |
    |                                                                    |
    |                                 Updates                            |
    |                 V1.0 - First Release                               |
    |                 V1.1 - Added F10 to Stop Script                    |
    |                 V1.2 - Added Wait Time and Auto Accept             |
    |                        Trade Options                               |
    |====================================================================|
    }



    program Gab;

    {.include srl/srl.scar}
    {.include srl/srl/misc/trade.scar}
    var
      Autotalker : TForm;
      FirstMessage : TLabel;
      SecondMessage : TLabel;
      ThirdMessage : TLabel;
      FourthMessage : TLabel;
      Label1 : TLabel;
      Trade : TLabel;
      WaitTime : TLabel;
      Button1 : TButton;
      Edit1 : TEdit;
      Edit2 : TEdit;
      Edit3 : TEdit;
      Edit4 : TEdit;
      CheckBox1 : TCheckBox;
      Edit5 : TEdit;
      AutoTrade : Boolean;
      Message1, Message2, Message3, Message4 : string;
      WaitTimes : Integer;

    procedure ButtonClick(Sender: TObject);
    begin
      Writeln('Time to Spam A Bit')
      Autotalker.ModalResult:=MrOk;
    end;

    procedure InitForm;

    begin

    Autotalker := CreateForm;
    Autotalker.Left := 250;
    Autotalker.Top := 114;
    Autotalker.Width := 696;
    Autotalker.Height := 480;
    Autotalker.Caption := 'Autotalker';
    Autotalker.Color := cl3DLight;
    Autotalker.Font.Color := clWindowText;
    Autotalker.Font.Height := -11;
    Autotalker.Font.Name := 'MS Sans Serif';
    Autotalker.Font.Style := [];
    Autotalker.ShowHint := True;
    Autotalker.Visible := False;
    Autotalker.PixelsPerInch := 96;
    FirstMessage := TLabel.Create(Autotalker);
    FirstMessage.Parent := Autotalker;
    FirstMessage.Left := 82;
    FirstMessage.Top := 29;
    FirstMessage.Width := 80;
    FirstMessage.Height := 18;
    FirstMessage.Caption := 'First Message';
    FirstMessage.Font.Color := clMaroon;
    FirstMessage.Font.Height := -16;
    FirstMessage.Font.Name := 'Perpetua';
    FirstMessage.Font.Style := [];
    FirstMessage.ParentFont := False;
    SecondMessage := TLabel.Create(Autotalker);
    SecondMessage.Parent := Autotalker;
    SecondMessage.Left := 82;
    SecondMessage.Top := 105;
    SecondMessage.Width := 94;
    SecondMessage.Height := 18;
    SecondMessage.Caption := 'Second Message';
    SecondMessage.Font.Color := clNavy;
    SecondMessage.Font.Height := -16;
    SecondMessage.Font.Name := 'Perpetua';
    SecondMessage.Font.Style := [];
    SecondMessage.ParentFont := False;
    ThirdMessage := TLabel.Create(Autotalker);
    ThirdMessage.Parent := Autotalker;
    ThirdMessage.Left := 82;
    ThirdMessage.Top := 171;
    ThirdMessage.Width := 86;
    ThirdMessage.Height := 18;
    ThirdMessage.Caption := 'Third Message';
    ThirdMessage.Font.Color := clPurple;
    ThirdMessage.Font.Height := -16;
    ThirdMessage.Font.Name := 'Perpetua';
    ThirdMessage.Font.Style := [];
    ThirdMessage.ParentFont := False;
    FourthMessage := TLabel.Create(Autotalker);
    FourthMessage.Parent := Autotalker;
    FourthMessage.Left := 82;
    FourthMessage.Top := 241;
    FourthMessage.Width := 92;
    FourthMessage.Height := 18;
    FourthMessage.Caption := 'Fourth Message';
    FourthMessage.Font.Color := clAqua;
    FourthMessage.Font.Height := -16;
    FourthMessage.Font.Name := 'Perpetua';
    FourthMessage.Font.Style := [];
    FourthMessage.ParentFont := False;
    Label1 := TLabel.Create(Autotalker);
    Label1.Parent := Autotalker;
    Label1.Left := 205;
    Label1.Top := 11;
    Label1.Width := 219;
    Label1.Height := 28;
    Label1.Caption := 'Crossback7'#39's Autotalker!';
    Label1.Font.Color := clRed;
    Label1.Font.Height := -24;
    Label1.Font.Name := 'Perpetua';
    Label1.Font.Style := [fsUnderline];
    Label1.ParentFont := False;
    Trade := TLabel.Create(Autotalker);
    Trade.Parent := Autotalker;
    Trade.Left := 99;
    Trade.Top := 325;
    Trade.Width := 118;
    Trade.Height := 18;
    Trade.Caption := 'Auto Accept Trade?';
    Trade.Font.Color := clGreen;
    Trade.Font.Height := -16;
    Trade.Font.Name := 'Perpetua';
    Trade.Font.Style := [];
    Trade.ParentFont := False;
    WaitTime := TLabel.Create(Autotalker);
    WaitTime.Parent := Autotalker;
    WaitTime.Left := 467;
    WaitTime.Top := 334;
    WaitTime.Width := 152;
    WaitTime.Height := 18;
    WaitTime.Caption := 'Wait Time (Milliseconds)';
    WaitTime.Font.Color := clTeal;
    WaitTime.Font.Height := -16;
    WaitTime.Font.Name := 'Perpetua';
    WaitTime.Font.Style := [];
    WaitTime.ParentFont := False;
    Button1 := TButton.Create(Autotalker);
    Button1.OnClick := @ButtonClick;
    Button1.Parent := Autotalker;
    Button1.Left := 310;
    Button1.Top := 372;
    Button1.Width := 75;
    Button1.Height := 25;
    Button1.Cursor := crHandPoint;
    Button1.Caption := 'Start';
    Button1.Font.Color := clRed;
    Button1.Font.Height := -16;
    Button1.Font.Name := 'Papyrus';
    Button1.Font.Style := [fsBold];
    Button1.ParentFont := False;
    Button1.TabOrder := 8;
    Edit1 := TEdit.Create(Autotalker);
    Edit1.Parent := Autotalker;
    Edit1.Left := 77;
    Edit1.Top := 55;
    Edit1.Width := 480;
    Edit1.Height := 21;
    Edit1.TabOrder := 9;
    Edit2 := TEdit.Create(Autotalker);
    Edit2.Parent := Autotalker;
    Edit2.Left := 77;
    Edit2.Top := 129;
    Edit2.Width := 480;
    Edit2.Height := 21;
    Edit2.TabOrder := 10;
    Edit3 := TEdit.Create(Autotalker);
    Edit3.Parent := Autotalker;
    Edit3.Left := 77;
    Edit3.Top := 196;
    Edit3.Width := 480;
    Edit3.Height := 21;
    Edit3.TabOrder := 11;
    Edit4 := TEdit.Create(Autotalker);
    Edit4.Parent := Autotalker;
    Edit4.Left := 77;
    Edit4.Top := 267;
    Edit4.Width := 480;
    Edit4.Height := 21;
    Edit4.TabOrder := 12;
    CheckBox1 := TCheckBox.Create(Autotalker);
    CheckBox1.Parent := Autotalker;
    CheckBox1.Left := 100;
    CheckBox1.Top := 351;
    CheckBox1.Width := 97;
    CheckBox1.Height := 17;
    CheckBox1.TabOrder := 13;
    Edit5 := TEdit.Create(Autotalker);
    Edit5.Parent := Autotalker;
    Edit5.Left := 461;
    Edit5.Top := 360;
    Edit5.Width := 121;
    Edit5.Height := 21;
    Edit5.TabOrder := 14;
    end;

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

    procedure ShowFormModal;
    begin
      AutoTalker.ShowModal;
    end;

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

    procedure AutoTrader; //Took a look at Extreme's for a guideline to this

    begin
     if(CheckBox1.Checked) then
       AutoTrade := True;
     begin
      if(SomeoneTrades) and (AutoTrade = true) then
      Writeln('Trading - Script Stopped');
      AcceptTrade;
      TerminateScript;
     end;
    end;

    procedure DefineTalkAndWait;

    begin
      Message1:=Edit1.Text;
      Message2:=Edit2.Text;
      Message3:=Edit3.Text;
      Message4:=Edit4.Text;
      WaitTimes:=Edit5.Text;
    end;


    procedure Speak; //Talking Procedure
    begin
    TypeSend(Message1);
    Wait(WaitTimes + random(200));
    TypeSend(Message2);
    Wait(WaitTimes + random(200));
    TypeSend(Message3);
    Wait(WaitTimes + random(200));
    TypeSend(Message4);
    Wait(WaitTimes + random(200));
    end;

                             {Main Loop}

    begin
     ClearDebug;
     SetupSRL;
     ActivateClient;
     SafeInitForm;
     SafeShowFormModal;
     DefineTalkAndWait;
      repeat
        Speak;
        AutoTrader;
      until(IsFKeyDown(10)) //Hold down the F10 key to stop the script.
    end.

                            {Main Loop}

  2. #2
    Join Date
    Feb 2006
    Posts
    406
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    waittimes is an integer, and the text boxes return strings, so just change line 252 to

    WaitTimes:=strtoint(Edit5.Text);

    not a bad form btw

  3. #3
    Join Date
    Jun 2007
    Location
    Kentucky, United States of America
    Posts
    409
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ah I thought that WaitTimes should've been an integer. . .Alright thanks for your help and the compliment.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Type Mismatch Error, Help!
    By Ultra in forum OSR Help
    Replies: 4
    Last Post: 01-21-2009, 10:24 PM
  2. ERROR type mismatch
    By shaman in forum OSR Help
    Replies: 5
    Last Post: 12-17-2008, 01:02 AM
  3. Type mismatch error...
    By Hobbit in forum OSR Help
    Replies: 8
    Last Post: 02-13-2007, 04:45 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
  •