Results 1 to 4 of 4

Thread: Forum Issues

  1. #1
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default Forum Issues

    hey im wanting to make a forum that will alow you to world switch at the press of a button, and to talk to people without actualy having to disable SMART. this would be pretty useful cause i donno about you guys but for me i have to actualy stop the script and then wait a little while before SMART will take any keyboard commands. idk maby its just something with my computer but if other people have the same problem then this would be a useful little tool

    this is kinda what im going for:

    or maby try this link if the picture isnt working: http://img17.imageshack.us/img17/6973/forumexample.jpg

    Here is my script: (i was using MasterKiller's forum tutorial to make this http://www.villavu.com/forum/showthr...forum+tutorial)

    SCAR Code:
    program New;
    {.Include SRL/SRL/Misc/SMART.SCAR}
    {.include SRL\SRL.scar}

    var
      frmAnna : TForm;
      Background : TImage;
      TalkBox : TEdit;
      ExitButton, TypeItButton : TButton;
      b, w, h : Integer;
      Text : String;

    procedure ExitClick(Sender: TObject);
    begin
      Writeln('closing form');
      frmAnna.ModalResult := mrOk;
    end;

    procedure TypeIt(Sender: TObject);
    begin
      Text := TalkBox.Text
      TypeSend(Text);
      WriteLn(Text);
    end;

    procedure InitForm;
    begin
      frmAnna := CreateForm;
      frmAnna.Left := 100
      frmAnna. Top := 100
      frmAnna.Width := 500
      frmAnna.Height := 228
      frmAnna.Caption := 'Anna - Default Script';
      frmAnna.Color := ClWhite;
      frmAnna.BorderStyle := bsNone;
     
      Background := TImage.Create(frmAnna);
      Background.Parent := frmAnna;
      Background.Left := 0;
      Background.Top := 0;
      Background.Width := 500;
      Background.Height := 228;
      b := loadbitmap('C:\Users\Lance\Desktop\My Scripting Projects\Varrok Yew Choper and Banker\Forum Images\background.jpg');
      getbitmapsize(b, w, h);
      copycanvas(GetBitmapCanvas(b),Background.canvas, 0, 0, w, h, 0, 0, w, h);
     
      TalkBox := TEdit.Create(frmAnna);
      TalkBox.Parent := frmAnna;
      TalkBox.Top := 30;
      TalkBox.Left := 10;
      TalkBox.Width := 350;
      TalkBox.Height := 20;
      TalkBox.Text := Text;
     
      ExitButton := TButton.Create(frmAnna);
      ExitButton.Parent := frmAnna;
      ExitButton.Left := 480;
      ExitButton.Top := 0;
      ExitButton.Height := 20;
      ExitButton.Width := 20;
      ExitButton.Caption := 'x';
      ExitButton.OnClick := @ExitClick;
     
      TypeItButton := TButton.Create(frmAnna);
      TypeItButton.Parent := frmAnna;
      TypeItButton.Left := 50;
      TypeItButton.Top := 70;
      TypeItButton.Height := 30;
      TypeItButton.Width := 100;
      TypeItButton.Caption := 'Type It';
      TypeItButton.OnClick := @TypeIt;
    end;
                                            {500, 228}
    procedure SafeInitForm;
    var
      v : TVariantArray;

    begin
      SetArrayLength(V, 0);
      ThreadSafeCall('InitForm', v);
    end;

    procedure ShowFormModal;
    begin
      frmAnna.ShowModal;
    end;

    procedure SafeShowFormModal;
    var
      v: TVariantArray;

    begin
      setarraylength(V, 0);
      ThreadSafeCall('ShowFormModal', v);
    end;

    procedure SetupSmart;
    begin
    SMARTSetupEx(88, False, True, False);
      Wait(5000);
      SetTargetDC(SmartGetDC);
      repeat
        wait(100);
      until(SmartGetColor(253, 233)<>1118604);
    end;

    begin
      SetupSRL;
      SetupSmart;
      SafeInitForm;// those 2 function are the action form setup. Thise one creates your form
      SafeShowFormModal;  // and this one makes it visible
    end.

    ok yes i named my form Anna. she is my child. dont make fun =]

    and ok so im having an error, when i press the Type It button, it tries to preform the SendKeys and crashes SCAR. I realy cant figure out why its doing that.

    pluss, would it be posible for me to put a function that would check weather the button was pressed? maby i could make a variable like...

    SCAR Code:
    var
      ButtonPressed : Boolean;

    function TalkCheck : Boolean;
    begin
      if(ButtonPressed) then
      begin
        SendKeys(Text);
        ButtonPressed := false;
        Result := true;
        Exit;
      end else Exit;
    end;

    begin
      //script
      TalkCheck;
      //more script
      TalkCheck;
      //more script
      TalkCheck;
    end;

    so yeah... just pretty much make a function like that and call it tonz through out the script. I donno, i am pretty sure other people have tried to do something like this before me, so if anyone knows a better way please enlighten me


    thankkss!
    Lance. Da. Pants.

  2. #2
    Join Date
    May 2007
    Location
    Netherlands, Amersfoort
    Posts
    2,701
    Mentioned
    1 Post(s)
    Quoted
    0 Post(s)

    Default

    It's possible, if you want to keep your script running, while displaying the form, change:

    SCAR Code:
    procedure ShowFormModal;
    begin
      frmDesign.ShowModal;
    end;

    to:

    SCAR Code:
    procedure ShowFormModal;
    begin
      frmDesign.Show;
    end;

    But note: You can't use stuff like ShowMessage(); while running the form and the script at the same time, and you cant move your mouse twice at the same time.

    Just make it like, when you press "send text" a boolean goest true, and holds the text

    when you click the button:
    SCAR Code:
    Procedure Onclick({bla});
    Begin
      {your send text button}.Enabled := False;
      sendubbtonclicked := True;
      TextInBox := {your text box}.Text;
    End;

    and this should be in your randoms loop for example:
    SCAR Code:
    if sendbuttonclicked then
    Begin
      TypeSend(TextInBox);
      sendbuttonclicked := False;
      {your send text button}.Enabled := True;
    End;

    I hope this helps 0.0

  3. #3
    Join Date
    Dec 2006
    Location
    Canada, BC
    Posts
    728
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    hey yeah that actualy works! thanks man
    Lance. Da. Pants.

  4. #4
    Join Date
    Jul 2008
    Location
    Canada
    Posts
    1,612
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Lance, did you make that picture or is that your real form? o.O

    So, your making an auto=talker??

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
  •