Results 1 to 16 of 16

Thread: ending scar

  1. #1
    Join Date
    Aug 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default ending scar

    In my script I have a exit button on the form but how do I make it end the script I have the button4.onclick := @exit1;
    but I tried exit and I had to redo a 2 hour form any ideas?

  2. #2
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    Quote Originally Posted by boredGamer View Post
    In my script I have a exit button on the form but how do I make it end the script I have the button4.onclick := @exit1;
    but I tried exit and I had to redo a 2 hour form any ideas?
    "exit" leaves the procedure or function you're in.

    Try: "TerminateScript".

    ~caused

  3. #3
    Join Date
    Aug 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok also umm wehn I did exit my scar is running a script wont respond to any click on the stop button or anything ): wtf do i do?

  4. #4
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    Quote Originally Posted by boredGamer View Post
    ok also umm wehn I did exit my scar is running a script wont respond to any click on the stop button or anything ): wtf do i do?
    Post your script here

  5. #5
    Join Date
    Aug 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    nvm I got an error and it stoped responding fixed it in my new form though

    Thanks for all your help too (:

  6. #6
    Join Date
    Aug 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok terminatescript did not work so I tried freeform and that had the same effect as exit

  7. #7
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    Again.

    Post the script.

  8. #8
    Join Date
    Aug 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    ok heres what i have going so far not finished yet though:

    program New;
    var
    frmDesign : TForm;
    Image1 : TImage;
    b, w, h : integer;
    Label1 : TLabel;
    Memo1 : Tmemo;
    Memo2 : TMemo;
    Button1 : TButton;
    Button2 : TButton;
    Button3 : TButton;
    Button4 : TButton;
    Button5 : Tbutton;
    Label2 : TLabel;

    procedure ends(Sender: tobject);
    begin
    // I have used exit, freeform(frmDesign), terminatescript. terminatescript fails with error, others cause scar to stop responding//
    end;

    procedure initform;
    begin
    frmDesign := CreateForm;
    frmDesign.Left := 356;
    frmDesign.Top := 113;
    frmDesign.borderstyle := bsnone;
    frmDesign.Width := 552;
    frmDesign.Height := 448;
    frmDesign.Caption := 'Bored Gamer - Setup';
    frmDesign.Color := clBtnFace;
    frmDesign.Font.Color := clWindowText;
    frmDesign.Font.Height := -11;
    frmDesign.Font.Name := 'MS Sans Serif';
    frmDesign.Font.Style := [];
    frmDesign.Visible := false;
    frmDesign.PixelsPerInch := 96;
    Image1 := TImage.Create(frmDesign);
    Image1.Parent := frmDesign;
    Image1.Left := 0;
    Image1.Top := 0;
    Image1.Width := 553;
    Image1.Height := 449;
    b := loadbitmap('C:\Program Files\Scar 3.21\test\test.bmp');
    getbitmapsize(b, w, h);
    copycanvas(getbitmapcanvas(b), Image1.canvas, 0, 0, w, h, 0, 0, w, h);
    Label1 := TLabel.Create(frmDesign);
    Label1.visible := false;
    Label1.Parent := frmDesign;
    Label1.Left := 8;
    Label1.Top := 304;
    Label1.Width := 60;
    Label1.Height := 29;
    Label1.Caption := ' Ready!!';
    Label1.Font.Color := clLime;
    Label1.Font.Height := -29;
    Label1.Font.Name := '@BatangChe';
    Label1.Font.Style := [];
    Label1.ParentFont := False;
    Memo1 := Tmemo.Create(frmDesign);
    memo1.readonly := true;
    Memo1.Parent := frmDesign;
    memo1.color := 10666963;
    Memo1.Left := 7;
    Memo1.Top := 348;
    Memo1.Width := 537;
    Memo1.Height := 93;
    Memo1.Alignment := taCenter;
    Memo1.Enabled := true;
    Memo1.Lines.Add('Update Log and future updates:');
    Memo1.lines.add('');
    Memo1.lines.add('Beta Version: 0.1:');
    Memo1.lines.add('No bug fixes or additions');
    Memo1.TabOrder := 8;
    Memo2 := TMemo.Create(frmDesign);
    Memo2.color := 10666963;
    Memo2.Parent := frmDesign;
    Memo2.Left := 153;
    Memo2.Top := 86;
    Memo2.Width := 300;
    Memo2.Height := 255;
    Memo2.Alignment := taCenter;
    Memo2.Lines.Add('Welcome to Bored Gamer - Miner Setup');
    Memo2.ReadOnly := True;
    Memo2.ScrollBars := ssVertical;
    Memo2.TabOrder := 9;
    Button1 := TButton.Create(frmDesign);
    Button1.Parent := frmDesign;
    Button1.Left := 451;
    Button1.Top := 142;
    Button1.Width := 95;
    Button1.Height := 49;
    Button1.Caption := 'Mining Setup';
    Button1.TabOrder := 8;
    Button2 := TButton.Create(frmDesign);
    Button2.Parent := frmDesign;
    Button2.Left := 451;
    Button2.Top := 192;
    Button2.Width := 95;
    Button2.Height := 49;
    Button2.Caption := 'Update';
    Button2.TabOrder := 9;
    Button3 := TButton.Create(frmDesign);
    Button3.Parent := frmDesign;
    Button3.Left := 451;
    Button3.Top := 242;
    Button3.Width := 95;
    Button3.Height := 49;
    Button3.Caption := 'Start Mining';
    Button3.TabOrder := 10;
    Button4 := TButton.Create(frmDesign);
    Button4.OnClick := @ends;
    Button4.Parent := frmDesign;
    Button4.Left := 451;
    Button4.Top := 293;
    Button4.Width := 95;
    Button4.Height := 49;
    Button4.Caption := 'Exit';
    Button4.TabOrder := 11;
    Button5 := TButton.Create(frmDesign);
    Button5.Parent := frmDesign;
    Button5.Left := 451;
    Button5.Top := 93;
    Button5.Width := 95;
    Button5.Height := 49;
    Button5.Caption := 'Player setup';
    Button5.TabOrder := 8;
    Label2 := TLabel.Create(frmDesign);
    Label2.visible := true;
    Label2.Parent := frmDesign;
    Label2.Left := 8;
    Label2.Top := 323;
    Label2.Width := 60;
    Label2.Height := 29;
    Label2.Caption := ' InComplete';
    Label2.Font.Color := clred;
    Label2.Font.Height := -20;
    Label2.Font.Name := '@BatangChe';
    Label2.Font.Style := [];
    Label2.ParentFont := False;
    end;


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

    procedure ShowFormModal;
    begin
    frmDesign.ShowModal;
    end;

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

    begin
    SafeInitForm;
    SafeShowFormModal;
    end.
    Last edited by boredGamer; 08-24-2009 at 07:10 AM.

  9. #9
    Join Date
    Feb 2007
    Posts
    3,616
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I don't see the onclicks for all of those buttons?

    Try:

    SCAR Code:
    button4.onclick := @DoTerminate;

    and then have:
    SCAR Code:
    procedure DoTerminate;
    begin
      TerminateScript;
    end;

    If button4 is clicked, it should then stop the script.
    Last edited by JAD; 08-24-2009 at 07:07 AM.

  10. #10
    Join Date
    Aug 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    I know I am making them right now because my scar keeps breaking when I use exit or freeform; editing right now
    Last edited by boredGamer; 08-24-2009 at 07:10 AM.

  11. #11
    Join Date
    Aug 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    well i could use:
    frmDesign.ModalResult:= mrOk;
    but i dont know if that will end the script
    Last edited by boredGamer; 08-24-2009 at 07:30 AM.

  12. #12
    Join Date
    Aug 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    didnt work :

    [Runtime Error] : Out of Global Vars range in line 153 in script
    Last edited by boredGamer; 08-24-2009 at 07:23 AM.

  13. #13
    Join Date
    May 2009
    Posts
    799
    Mentioned
    2 Post(s)
    Quoted
    16 Post(s)

    Default

    Quote Originally Posted by boredGamer View Post
    didnt work :
    You should really edit your posts. Dont make double and tripple posts.

    Again :'D.. If there are problems, post your full script.

    ~caused

  14. #14
    Join Date
    Aug 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    oops yes I see I got a few post mixed up hehe ill umm edit them see my last 2 are switched -_- terminate didint work but I think the mrOk; will and sorry for the post in a row.

    so yeah thanks

  15. #15
    Join Date
    Jan 2009
    Location
    Turlock/LA, California
    Posts
    1,494
    Mentioned
    3 Post(s)
    Quoted
    66 Post(s)

    Default

    the mrOk; segment should work. i am using that line in my form and it works perfectly.

  16. #16
    Join Date
    Aug 2009
    Posts
    34
    Mentioned
    0 Post(s)
    Quoted
    0 Post(s)

    Default

    Ok thanks everyone for the help, I am now working on my other two forms.

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
  •