Synectics Posted August 20, 2009 Author Share Posted August 20, 2009 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 More sharing options...
Zamin Posted August 20, 2009 Share Posted August 20, 2009 As far as I know, doen't matter how many times you use #include. System will not have any problem jumping from one file to another. If fact, I read somewhere on this forum that it will increase the efficiency. Link to comment Share on other sites More sharing options...
Synectics Posted August 20, 2009 Author Share Posted August 20, 2009 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 More sharing options...
shadowwulf Posted August 20, 2009 Share Posted August 20, 2009 #include is just to indicate a reference to another file.I am positive you can use it to your hearts content.I would. I try and keep everything as seperate as possible. Link to comment Share on other sites More sharing options...
Zamin Posted August 20, 2009 Share Posted August 20, 2009 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 More sharing options...
shadowwulf Posted August 20, 2009 Share Posted August 20, 2009 oh i see how it is… dont take MY word... *cough*statuscheck*cough* Link to comment Share on other sites More sharing options...
Synectics Posted August 20, 2009 Author Share Posted August 20, 2009 Awesome. Thank you both for your prompt responses; I'd give you both 100 Internets if I had them.And ~SW~, I think you both just posted at the same time, so he didn't see you'd already posted. ;) Link to comment Share on other sites More sharing options...
Zamin Posted August 20, 2009 Share Posted August 20, 2009 @~SW~:> oh i see how it is… dont take MY word... *cough*statuscheck*cough*Sorry, i posted the same time you posted. So i didn't notice. Your word is final word :) lol Link to comment Share on other sites More sharing options...
Godlord Posted August 20, 2009 Share Posted August 20, 2009 #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 More sharing options...
Zamin Posted August 20, 2009 Share Posted August 20, 2009 @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. lolYou pretty much said it all, like always. Props :) Link to comment Share on other sites More sharing options...
shadowwulf Posted August 20, 2009 Share Posted August 20, 2009 @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 More sharing options...
Bobosk Posted August 20, 2009 Share Posted August 20, 2009 I prefer ducking everything up with a piece of ducked up code, then atleast i can tell when i've ducked something up…SINCE it's not a problem when you DON'T add 50~100 lines of code before testing Link to comment Share on other sites More sharing options...
shadowwulf Posted August 21, 2009 Share Posted August 21, 2009 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now