SRL Archive - OSR Help

is ('=') expected at line 6 Compiling failed.


Simbarules

2013-03-14 01:53:36

Hey everyone,

I'm a new member learning my place here on the SRL forums. I've never been one to go around crying and posting tons of threads because I'm stuck. Always tried my best to figure it out even if it took me hours. I really don't want things handed to me on a silver platter, I do really enjoy learning Pascal and everything to do with SRL.

Now this one has got me stumped…
[Error] C:\Simba\Scripts\RandFletcherv1.1.2.simba(7:10): is ('=') expected at line 6
Compiling failed.

Here's line 6:
const x, y, bankcolour,inventoryCounter, LogCounter: Integer;

ANY help even the slightest tip is GREATLY appreciated. Thanks for taking the time out of your day to look at my thread.

Le Jingle

2013-03-14 02:12:13

The keyword, const, refers to constant, by which declares something that remains constant throughout the script.

You can only declare a single constant at a time, meaning:

const
// wrong b/c you can only declare one constant at a time to equal 1.
a, b, c = 1;

// wrong b/c this doesn't define anything, and a constant has to be defined so it may remain constant
d: Integer; //wrong

// correct - we define e to be constant with a value of 2.7
e = 2.7;

the var keyword, referring to Variables, are types that can be define like:

var
i, x, y : Integer;
e: Extended;
arr: TIntegerArray;
.. and be manipulated within their type constraints during the script/at a later time. Variables do not remain constant like the const keyword.

Simbarules

2013-03-14 02:16:45

From: Le Jingle
The keyword, const, refers to constant, by which delclares something that remains constant throughout the script.

You can only declare a single constant at a time, meaning:

const
// wrong b/c you can only declare one constant at a time to equal 1.
a, b, c = 1;

// wrong b/c this doesn't define anything, and a constant has to be defined so it may remain constant
d: Integer; //wrong

// correct - we define e to be constant with a value of 2.7
e = 2.7;

the var keyword, referring to Variables, are types that can be define like:

var
i, x, y : Integer;
e: Extended;
arr: TIntegerArray;
.. and be manipulated within their type constraints during the script/at a later time. Variables do not remain constant like the const keyword.


Thanks for the fast reply man.

So it needs to be a variable. Whenever I do change it from const to var, it gives me an error:
[Error] C:\Simba\Scripts\RandFletcherv1.1.2.simba(13:13): colon (':') expected at line 12
Compiling failed.


heres line 12:
TComboBox4. TComboBox5: TComboBox;


Whenever I add the colon it just completely ruins the entire thing. Am I missing something after my variable or that line of code?

Neodymium

2013-03-14 02:20:23

I told you how to fix this in your last thread?

Le Jingle

2013-03-14 02:20:37

From: Simbarules
Thanks for the fast reply man.

So it needs to be a variable. Whenever I do this it gives me an error:


heres line 12:


Whenever I add the colon it just completely ruins the entire thing.


When you declare variables, or multiple variables for a similar type, you separate each variable of the type with a comma.
Thus, if I were to declare several integers, I might do something like;

var
number1, number2: Integer;

or for other types too, not just Integer type, I could do the same for the TBox type, as shown below;

var
b, box2, coolBox: TBox;

Notice the commas that separate each declared variable of the same type.

Simbarules

2013-03-14 02:43:24

From: Le Jingle
When you declare variables, or multiple variables for a similar type, you separate each variable of the type with a comma.
Thus, if I were to declare several integers, I might do something like;

var
number1, number2: Integer;

or for other types too, not just Integer type, I could do the same for the TBox type, as shown below;

var
b, box2, coolBox: TBox;

Notice the commas that separate each declared variable of the same type.


I honestly cannot thank you enough. You've taught me a lot.

Thanks for helping out man.

Brid Mayhem

2013-03-14 02:54:18

From: Le Jingle
When you declare variables, or multiple variables for a similar type, you separate each variable of the type with a comma.
Thus, if I were to declare several integers, I might do something like;

var
number1, number2: Integer;

or for other types too, not just Integer type, I could do the same for the TBox type, as shown below;

var
b, box2, coolBox: TBox;

Notice the commas that separate each declared variable of the same type.


You shouldn't hand out answers to anti leeches.

Teaching is one thing but straight telling is another..