Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

How much can #include handle?


Synectics
 Share

Recommended Posts

I've been using #include in my Main.txt.

Okay… I've been using it a LOT.

At the moment, nearly every spell used in my project has its own .txt file. Many NPCs will get their own .txt file. A lot of systems (such as the ScriptedMenu sub) not only have their own .txt, but are broken up even further into more .txt.

I'm at 27 .txt files #include'd at the bottom of my Main.txt. There will probably be nearly 300 by the time I'm done.

Will the engine be able to handle this sort of design, or should I be reworking it right now before I get any further?
Link to comment
Share on other sites

Yup, I'd heard the same, that it was more efficient than having longer .txt files. I just wasn't sure if it would _eventually_ be inefficient, having so many files referenced.

I'm sure there is no set "limit" to how much you use #include, but I wasn't sure if it had a, "You know, you should probably stop doing that now" limit. XD
Link to comment
Share on other sites

Well, i'm no expert in sad script. But when i was doing c++, my instructors always wanted us to use #includes to break up the code which would make the program more efficient. I dunno if its the same in sadscript, i guess wait for a reply from someone in the adminstration.
Link to comment
Share on other sites

#include is a preprocessor directive originating from C and just like in C and C++ it's recommended to use #include for efficiency. The way #include works is that the whole file gets read and then added at the spot of the #include directive. After the preprocessing the code gets compiled (and executed in Sadscript). The #include directive allows you to keep your code separated for clarity.

Regards,
  Godlord.
Link to comment
Share on other sites

@Godlord:

> #include is a preprocessor directive originating from C and just like in C and C++ and it's recommended to use #include for efficiency. The way #include works is that the whole file gets read and then added at the spot of the #include directive. After the preprocessing the code gets compiled (and executed in Sadscript). The #include directive allows you to keep your code separated for clarity.
>
> Regards,
>   Godlord.

*Checks Profile* Your definitely not 15 years old. lol
You pretty much said it all, like always. Props :)
Link to comment
Share on other sites

@Godlord:

> #include is a preprocessor directive originating from C and just like in C and C++ and it's recommended to use #include for efficiency. The way #include works is that the whole file gets read and then added at the spot of the #include directive. After the preprocessing the code gets compiled (and executed in Sadscript). The #include directive allows you to keep your code separated for clarity.
>
> Regards,
>   Godlord.

BAM!

hah… yeah. I couldnt remember off the top of my head how #include processed over in compilation.
Its like making another sub... but you dont risk ducking everything else up!
Link to comment
Share on other sites

yeah. I tend to write the whole system… then pray...
Larger add ons I will make the basics.. like setting up the .ini file... then ill do the reading from it... then thewriting to it... then the special stuff...

Biggest update was seriously like 250 lines of code... but alot of it was copy paste then edit for next special situation... tried to use variables to shorten it but it was impossible.
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...