Jump to content
  • Sky
  • Blueberry
  • Slate
  • Blackcurrant
  • Watermelon
  • Strawberry
  • Orange
  • Banana
  • Apple
  • Emerald
  • Chocolate
  • Charcoal
Ranqers

Script Layout [basic]

Recommended Posts

yooo,

whatsup guys. I'm just gonna give a couple tips on script layout and faster performance.

 

 

 

provided you've already learned what variables, constants, procedures and loops are..we will begin making a basic loop and then progress into a more intermediate loop.

 

this scripts' main purpose is to show you're coding "grammar."

see, the grammar is very important when learning how to script. it makes everything much easier to read, and if you do it right, makes you look good.

:D

[scar]program Grammar;

var x: Integer;

 

procedure a; //if procedure a is declaired, x will = 55.

begin

x := 55;

end;

 

begin

if x = 0 then //*

begin // simple if and then

a; // statement.

end; //*

WriteLn('#'+IntToStr(x)); //turns integer X into string X. (the function WriteLn requires a STRING, only.)

end.[/scar]

 

 

 

now a simple loop.

it's made up of two constants, (both are STRINGs but const "i" will be changed over into a INTEGER) one procedure, and one main loop.

[scar]program BasicLoop;

const i = '5'; //Mili-seconds (1000 = 1sec)

const x = 'bob'; //Text2Type

 

procedure talk;

begin

TypeText(x); //types what const x ='s to.

Wait(StrToInt(i)); //this time we're going to go from STRING to INTEGER. (function Wait(); requires an INTEGER.)

end;

 

begin

repeat //*

talk; // Main Loop (false = repeat until stopped)

until(false); //*

end.[/scar]

 

 

now for a more complex loop.

this script contains three constants, one variable, one main loop, and two procedures.

[scar]program inDepthLoop;

var x: Integer;

const i = '5'; //Mili-seconds (1000 = 1sec)

const a = 'hey'; //Text2Type

const b = 'bob'; //Text2Type

 

procedure scramble; //makes var X randomized between 0-10.

begin

x := 0+Random(10);

end;

 

procedure talk; //main FUNCTION of script

begin

if x > 5 then

begin

TypeText(a);

Wait(StrToInt(i));

end;

if x < 5 then

begin

TypeText(b);

Wait(StrToInt(i));

end;

end;

 

 

begin

repeat //*

scramble; // Main

talk; // Loop

until(false); //*

end.[/scar]

 

 

Dunno if it'll help, might:D Thnks.

Edited by Ranqers

Share this post


Link to post
Share on other sites

forum layout? You mean the layout of the script? xD

 

Looks great, I think if people started off learning Delphi, or even just SCAR. So have like 1 year in Delphi, then switch over to C++. I think this would make C++ less scary, and with the Delphi or SCAR you could teach most of the core programming concepts. Thing is SCAR doesn't really have classes and some things.

 

Like 1st year of programming you could learn HANDS on with delphi, not C++ and VB and all this microsoft crap. They just throw the book at you, and its a huge mess. The real way you will learn is if you experiment with it yourself too. Not just books. So delphi is best suited IMO.

 

1st year could be:

-Beginner programing concepts and hands on

-procedures, functions, how you can include more, and use your own or libraries.

-Then Do FORMS, and other things.

-Basically do the most simple crap you can do (LIKE WITH SCAR).

-Practice making programs to accomplish things. Become very knowledgeable with all the basic code

-Use Debugging, and Code hints, etc.

 

This would be the perfect introductory IMO. Less scary syntax to look at, and remember.

 

Also programs could probably be made faster, and you could try using functions from libraries. Do canvas drawing. I mean if the instructor had a degree and was very knowledgeable. You could do almost as much as anything C++ or Java can do. And without all that extra syntax, and craziness.

Edited by LordJashin

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


×
×
  • Create New...