Script Arrays

Started by Superman95, Sun 23/11/2003 00:53:33

Previous topic - Next topic

Superman95

Is it possible to create an Array in the script system.  I realize the "character" is an array, but it seems to be a special object in the system.  If I can define arrays, what's the syntax?

Scorpiorus

Yep, you can declare an array this way:

int array[10];

declares array of 10 integers (Note: indexes go 0 through 9, so 9 is the last index)

writing data:

array[5] = 3;

reading:

int value = array[5];


PS. It's unofficial feature though

~Cheers

Superman95

#2
Thanks.

I'm beginning to think there's lots of stuff the script can do that's not documented.  Like #define.

Wonder if I can #include "filename" to include an external script file?


Hey, Chris,
That would be a cool feature.  Imagine: you write a script that has a lot of basic general functionality, then you could just copy the file into anyother project, use and #include statement, and reuse the code.

Scorpiorus

Would be very handy indeed. Something like this is in his to-do list I believe.

~Cheers

Ishmael

I already suggested the #include, I just couldn't find the goddam thead, and Chris reacted a bit negatively, if I remeber right... but as I can't find the thead, I cannot say for sure...
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Scorpiorus

Quote from: TK on Sun 23/11/2003 13:53:46
I already suggested the #include, I just couldn't find the goddam thead, and Chris reacted a bit negatively, if I remeber right... but as I can't find the thead, I cannot say for sure...
I think the #include thing itself is rather easy to implement, but as I remember what Chris was referring to is a problem when you have to watch you haven't identical function names or such thing as forward referencing (that is the function is called before being defined) as AGS can't handle that at the moment.

I realy hope we'll se some sort of a modul support system in 2.6xx series.

~Cheers

Ishmael

Yeah... It would theoretically (sp?) be like, the scripts are included from the files, then, the whole script would be run through... but how to make it?
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Scorpiorus

Yep, it would be similar to the script header but you can include the file withing the whole script. So, if compiling error occures the editor should open the right file on the right line instead of telling that there is a error in the global script line number 978 whereas the global script itself is only about 100 lines of code. :P

Ishmael

Yeah... "Error: blah blah blah in external script file "blah.txt" line blah." etc.
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

SMF spam blocked by CleanTalk