Suggestion... #include

Started by Ishmael, Sat 18/10/2003 20:53:23

Previous topic - Next topic

Ishmael

I tried, and noticed I cannot use #include in AGS. This would make the room etc. naming lot easier, like, I have a file called roomnames.txt in my game directory. Then, in the script header, I add the line

#include "roomnames.txt"

and, if I want to add a new room name to the list, I don't need to add it to both the header and my track file (I keep record of my #defines in a file so I don't need to keep opening the script header if I want to check a room name or number).

The text file could be like


// Room names

// Intro
#define rINTRO1 1
#define rINTRO2 2
#define rINTRO3 3
#define rINTRO4 4

// Home
#define rBEDROOM 5
#define rLIVINGROOM 6
#define rBATHROOM 7
#define rKITCHEN 8
#define rHALLWAY 9
#define rCLOSET 10

etc.



So, it would be the same wheather I put the defines into the header, or put 'em in a filen and #include them.

Or?
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.

edmundito

I think this suggestion is in the future.txt file already... I don't know what the status on it is, tho... you could just define the rooms in the global script header :P

juncmodule

#2
Hmmm...that's funny, I just about started a topic with the same title...

Although I think your suggestion is almost exactly the same I have a suggestion which may appeal to more people...sort of:

Using #include as a way to clean up the global script.

Basically having the #include add several text files to the global script right before the game start function.

This way I could do something like #include "myfunctions.txt"

This may be the same EXACT thing this post is about...or maybe not, I don't really understand #defines and all that...so, sorry if this is redundant.

Also, a kick-butt bonus would be if you could edit and save your personal included files from the AGS Script Editor...

later,
-junc

EDIT: Oh, yeah, if there is already a way to do this could someone tell me how ;D

Ishmael

Quoteyou could just define the rooms in the global script header

That's what I now need to do.

I mean, like, now I must, and if I add a new room def, I need to put it into both, the header and the track file. If I could #include my track file, I only needed to add the #include into that fine, and that way, I would be better on track of my room names. Also, with the functions, like I write them down on a file, and include it, it's much easier to modify, if I for example need a Wait(1); in a function of mine, and I am editing room scripts, I would just need to edit the text file in my game folder. This would save coding times, IMHO.
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.

Pumaman

Adding #include support would be quite tricky as the script system does not make any provisions for it at the moment, but it is something I'll consider.

As for rooms, how about if I added a "Script name" setting to the room list, much like how characters and GUIs can have one - that way it would all be handled automatically for you.

Ishmael

I did suggest that earlier, aswell, and I was adviced to use #define :P But however, that could be usefull :)
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