SRL Archive - OSR Help

Unknown Identifier


Diddy Kong

2010-02-20 01:50:03

SCAR will not call this procedure even though I am using the include statements at the top of the script.

Note: This is to be my first script. :spongebob:

Sex

2010-02-20 02:13:18

It would really help if you posted the script :).

NCDS

2010-02-20 10:23:26

Unknown Identifier is an error quite frequently given when you forget to declare a Variable, or don't include a function your attempting to use.

However, like Sex said, post the script and we can tell you normally exactly what's wrong with it.

Diddy Kong

2010-02-20 12:48:23

Sorry for deleting the attachment you guys (Sorry I wasted your time! :redface:)

Well, here is the attachment. I may not be working on this project for much longer. :duh:
I don't know if this script will be any good.

Sex

2010-02-20 13:03:34

Have you programmed in Java before :p?
It is because you have $ in the include names. It is an invalid character so just rename all the includes and it will work fine :).

Diddy Kong

2010-02-20 13:09:26

I'm still getting unknown identifiers. I guess it's not possible to make a huge script into multiples for simplicity/readability?

I thought of the include statement as exactly what it says; I thought it would put that chunk of code from one scar file into another, and ultimately in the end compile that 'one huge script'.

YoHoJo

2010-02-20 14:53:41

Why not just combine them all into one? Who cares how long the script it, maybe that will fix the problem too. I'm stumped on why its happening:/.

Runescapian321

2010-02-20 15:12:39

From: GreenText
I'm still getting unknown identifiers. I guess it's not possible to make a huge script into multiples for simplicity/readability?

I thought of the include statement as exactly what it says; I thought it would put that chunk of code from one scar file into another, and ultimately in the end compile that 'one huge script'.


I've never worked with making my own includes, but what Sex said seems to work. After removing all of the $ (from both the script names and when you include them in another script), you get

Line 23: [Error] (31:5): Unknown identifier 'ComboBox1' in script C:\Program Files\SCAR\includes\RiverWranglerFormsCallbacks.scar


You do not have a ComboBox1 (or any other of the variables used in the Start function) in that particular include nor does that include make use of other includes, meaning it cannot compile without knowing what ComboBox1 is.

Same goes for your other include with forms: RiverWranglerFormsSplash. You cannot set the variable to a bitmap because SCAR does not know where that variable came from.

And then, you're trying to set variables (such as the boolean Bank which is declared in your actual script) in the include. As far as I know, you cannot do that. To me, it seems that the easiest and best solution would be to merge these into one script. OR you can change your include's functions to return values instead of set values, though, if this is your first script, you might want to start off simpler (using one big script) ;)

EDIT: If you really want to continue with this, what I mean by return is using a function that returns the value you're looking for.

Instead of this:

procedure InitSplashBitmap;
begin
bmpSplash := [superlongbitmap];
end;

Do

function InitSplashBitmap: integer;
begin
result := [superlongbitmap];
end;

So if you want to set a variable to the bitmap you have there


bmpsplash := InitSplashBitmap;

If you need to set several things, do this

procedure ChangeValues(var Bank: boolean; var AmtFish: integer);
begin
Bank := true;
AmtFish := 5;
end;

That will also change the values of the variables that you put in when calling the function. So if you do


DoBank := false;
HowManyFish := 0;
ChangeValues(DoBank, AmtFish);
writeln(booltostr(DoBank)+' '+inttostr(AmtFish));

The output will be

true 5




Correct me if I'm wrong on any of this, haven't scripted Scar in a while

Diddy Kong

2010-02-20 15:53:25

From: YoHoJo
Why not just combine them all into one? Who cares how long the script it, maybe that will fix the problem too. I'm stumped on why its happening:/.


I made multiple files so it would be easier on me to develop the whole script.