SRL Archive - OSR Advanced Scripting Tutorials

How to use forms in SCAR effectively


mr. pali

2006-04-06 00:11:20

I WILL FINISH THIS TOMORROW! Too tired and still have home-work. Make comments on how I'm doing so far.

This is a tutorial on how to use Forms in SCAR, and make them good and useful!

Forms can look like these: (Autofighter made by me and realrune in the old days of kaitnieks)


-First off, what is a form?
Well, your internet browser is a type of Form, so is Microsft Word

Most forms we use in XP are written in a program called Visual Basic. Visual Basic is a program that makes complex forms, SCAR can make "simple" ones.

-Have I seen forms in SCAR before?
Most likely. You can recognize a form as somthing that pops up when you start a script in SCAR. Forms are a way to get input from users easier.

An important thing to know in scar is that with forms, the script is paused. So no, the script can not be executing whilst a form is open.

Now that we've got the basic idea of what a form is, we can learn to make some.

Now with forms, there are four major procedures

InitForm : This holds the data for the form to display.

SafeInitForm : Safely calls the form

ShowFormModal : Shows the form

SafeShowFormModal: Shows the form safely

With all of these procedures in your script, you can properly show a form.

Now, how to create a form using the form editor
The form editor can be accessed by going into scar, on the top bar:
Tools –> Form editor

This is what the form editor looks like:

The panel named form design is where you build your form. It is your canvas. The top bar named Form Designer is where you pick objects to put onto your Form Design. And the object inspector is where you change the object on the form design. Its how you make buttons say different things on them, and make your form a different color.

Now, we create a form! Drag a button (The icon with the [ ok ] on it) onto your Form Design. Save this and exit out of the form editor windows.


Now it's time to enter those procedures.

Put these four procedures into your script:

//Procedure 1:
procedure InitForm;
begin;
end;

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

//Procedure 3:
procedure ShowFormModal;
begin
frmDesign.ShowModal;
end;

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




And put this as your main loop:

begin
SafeInitForm;
SafeShowFormModal;
end.

Once we have this, we can continue.

Now go back in to the main SCAR window, click:
Tools –> Load DFM Form
Open the form you saved.


-I'll keep going just wanna see how it looks so far-

WhiteShadow

2006-04-06 00:24:28

Maybe you should of waited until you were completely done? Kind of disapponting. :p

Anyways looking foward to it. I know little about making forms. I only know how to name it and make simple buttons.

mr. pali

2006-04-06 00:44:45

Yea don't worry I'm making it now = )

phantombmx

2006-04-06 00:48:11

im lookin forward to this.. ive been wondering how to use forms and make em.. it'd be cool to know how to :D hurry please!! :rolleyes:

EDIT: ah ok you are writing it!!

doing good so far! HURRY mr. pali!!!

The Un-Named

2006-04-08 08:22:40

Go into scar, press f1 and go to the last paragraph. :)

WhiteShadow

2006-04-09 02:34:07

From: The Un-Named
Go into scar, press f1 and go to the last paragraph. :)


Meh, that gives basic stuff. Like making one button and clicking it. Hopefully Mr. Pali will include in his tutorial how to save values etc.

Jagex_Fagex

2006-04-09 02:57:21

also add how to get the picture as your background… I know that has a lot of people baffled :confused: :eek:

timmyboy

2006-04-11 17:28:04

When are you going to finish the tut? I"m really looking forward to it, right now it looks very good.

Avaphi

2006-05-07 19:00:59

Wow this is really nice, This could make pay to use scripts more user friendly.

devils elbow

2006-05-07 19:14:50

If anyone needs a question answered about forms, I could probably answer it. Just pm me. This topic doesn't seem to be getting updated :S

Avaphi

2006-05-07 19:50:52

well why dont you beat him to it. If you post a tut on forms(finished) before he does, ill give you +rep

devils elbow

2006-05-07 21:41:55

Well, the thing about that is, I'm a lazy bastard.

Bebe

2006-05-07 21:46:04

Yea, I thought myself forms :)

devils elbow

2006-05-07 21:50:33

From: Bebemycat2
Yea, I thought myself forms :)

If you understand delphi they're easy as hell.

Keen

2006-05-08 20:41:43

Nice tutorial. Good job. ;)

Although you only covered the basics.
Can't wait for the next parts though.

weaselforce

2006-05-23 10:35:08

Pali your breaking my ballz! you left out the best parts

Wool

2006-12-16 22:34:36

Are you ever going to finish this TUT, cause I really want to now how to use these :confused:
And if your not does someone have a link to somewhere that does have one :D

Yakman

2006-12-17 05:27:44

use mad cows tutorial on moparisthebest
i learnt them from there, its a good tutorial

Buckleyindahouse

2007-01-02 18:08:07

Come on please finish this. I need to learn this.

Avaphi

2007-01-12 09:21:02

From: Buckleyindahouse
Come on please finish this. I need to learn this.


Quit gravedigging… Come on, he said he would finish over 5 months ago :duh:

Ejjman

2007-01-12 18:08:32

Lawl I'm trying to learn them also but where is he rofl

bbri06

2007-01-13 00:02:34

for all the people who wanted to learn forms mopar has some good form tuts