i hate defines.txt!!

brian corr because if you change it u have to recompile EVERY logiC!!

so im doin sumthin bout it. im gonna remake the template game so that it doesnt use a text file it uses a logic.

so there
AGI1122 Hey thats a great idea I think I might do that with my templates on my web site. Do you mind if I use this idea in my templates?
Nailhead That [I]is[/I] a pretty cool idea.
brian corr sorry guys, it wont work - defines cant be called in a separate logic because hey only work for the logic theey are defined in. thats the point of the txt file ,it puts them in every logic...so having a new logic with them in wont help.

*sniff*

doesnt really bug me though cos i dont use those defines anyway, in fact i dont use any defines, i think its easier that way


but feel free to try and et it working if you want
Chad Goulding I think if you change the defines.txt file you don't have to recompile every logic manually since you can just rebuild all the vol files (which should only take a few seconds). I presume doing that recompiles every logic in the game and saves a *lot* of hassle.
AGI1122 That is the problem I ran into when trying it. So I just decided not to bother with the defines.txt in the templates
Joel You only have to recompile all the logics if you change the var numbers around.

For example, if your defines.txt looks like this:

#define fSomeFlag f100

And your logic 2 looks like this:

set(fSomeFlag);

If you change the defines.txt file to:

#define fSomeFlag f101

then you will have to recompile logic 2 because fSomeFlag now refers to f101 -- if you use fSomeFlag in logic 3 without recompiling logic 2, then logics 3 and 2 will be working with different flags (100 for logic 2 and 101 for logic 3), but if you change the defines.txt file to:

#define fSomeFlag f100
#define fSomeOtherFlag f101

then you do not have to recompile logic 2 because fSomeFlag is still defined as f100. If you add logic 3 that says:

reset(fSomeFlag);
set(fSomeOtherFlag);

then your code will work fine without recompiling logic 2.

Personally, I don't see how anybody can stand working without defines.txt, but I guess if you can work without symbolic names good for you.
Joel To state that a little more simply: you have to recompile the logics if you CHANGE the value of a #define that was already in defines.txt. You do NOT have to recompile all the logics if you simply ADD a new #define.
AGI1122 There is a way to not use defines.txt try defining names in the logic you want to use it in. Example:

Logic 2:

#define door o1
#define door_open F100
#define door_not_open F101

if (new_room) {
 new room stuff here
 set(door_not_open);
}

if (said("open", "door") && door_not_open) {
 end.of.loop(door,door_open);
 reset(door_not_open
}

if (said("close", "door") && door_open) {
 end.of.loop(door,door_not_open);
 reset(door_open);
}

return();

Who needs defines.txt when you can do it like this.
Joel That's fine for local variables but if you wanted to change the value of a global define then it would be even more inconvenient than recompiling all the logics.
sonneveld I think the whole point is, if it's a GLOBAL define then you'll have to compile it all anyway to make sure a variable isn't defined as something else

separate your defines into sections like global.txt, ego.txt, act1.txt, act2.txt, island.txt, debug.txt, intro.txt, endgame.txt, door.txt

depending on how your game is laid out.  For logic in certain sections of a game, just include act1.txt or something like that.  If you want to use some door code, include door.txt. Only put in real global definitions into global.txt (ie, the system vars/flags)

That way, if you change or add a variable to just the intro section.. you'll only have to recompile all the logics that have included intro.txt

- Nick
brian corr i dont understand how anyone CAN work with defines.txt

maybe sum1 should write a new one, with SHORTER defines.

i mean, "ego_touching_signal_line"?
peter kelly, what were you thinking.

i reckon its easier to remember "f3" than "ego_touching_signal_line", dont you?

and if youre unsure, check the help file



brian
AGI1122 I already knew about the define being a local thing. I was just giving an example of it.

i dont understand how anyone CAN work with defines.txt

maybe sum1 should write a new one, with SHORTER defines.

i mean, "ego_touching_signal_line"?
peter kelly, what were you thinking.

i reckon its easier to remember "f3" than "ego_touching_signal_line", dont you?

and if youre unsure, check the help file


I can update my templates and the help file so that it could be shorter. But is it just you wanting this or does other people want this
brian corr i dont particularly want it cos i dont use defines neway but i think having mega-long defines defeats the purpose of the define - i used to use it and they were so long i had to check whta they were all the time.

so, the question.... WHO WANTS A NEW DEFINES.TXT???
Joel I agree with you that some of the define names are ridiculously long. I also hate underscores in my variable names and I prefer prefixing my variable names with an abbreviation of their data type.

It's also fine to use f3 in place of ego_touching_signal_line...I do it sometimes myself. However, in a full scale game where you've got hundreds of variables and flags to keep track of, I find symbolic names much easier than keeping some kind of look-up table. That way I can come back to my code later and simply look at it and realize what it's doing. Otherwise I have to go into detail reading my comments or going to a look-up table.

As for recompiling...I would not at all recommend placing "local" type variables in defines.txt. I sure don't do it. But in any case, you do not AT ALL have to recompile all your logics if you go into defines.txt and add a new define name. You only have to recompile all your logics if you change an existing one. How often do you really do that? I hope it's not often, or you need to organize yourself better before starting the programming portion of your project.

There's only been one time I've had to recompile all my logics -- when I re-organized myself and set everything up so that all the vars and flags numbered below 200 were for global use and everything 200 and above was for local use. If I go in and add a new flag called fPlayerHasCompletedPuzzleX then I don't need to recompile all the logics.

If you're worried about name conflicts then just prefix all your global variables with "g_" or something.

There are ways to have defines.txt and keep things simple, too. Believe me, simplicity is my greatest concern when I program. Regardless, as updates to AGI Studio are made, there will be Recompile All functionality that will save the hassle of recompiling all the logics when you change (not add) a define to defines.txt. The Windows Linux AGI Studio already has this function, I think.

Nick's suggestions are good, too. Breaking code up into chunks and not putting it all in one place makes it even easier to handle.
Joel About the whole global/local thing: what I meant was that putting the actual text of your global defines at the beginning of all your logics instead of a #include directive would make it very hard to change the value of a global define. Recompiling all the logics would be fun by comparison.
AGI1122 I have no problems keeping track of variables and flags. What I do it when I use a flag or variable I write down which one I used in a txt file then before I assign a new flag or variable I check to see which flags and variables are used and make sure I don't use them.
sonneveld
I have no problems keeping track of variables and flags. What I do it when I use a flag or variable I write down which one I used in a txt file then before I assign a new flag or variable I check to see which flags and variables are used and make sure I don't use them.


Why don't you call this file defines.txt and include it with all your logic source :)

Seriously though.. I think the AGI Studio compiler needs some sort of way of automatically assigned variables/flags for your logics.  Maybe logics should get compiled to some sort of abstract object format and only get variables assigned when getting linked.

- Nick
Chris(AGISCI) The reason I don't use it as defines.txt is because I just write the flag or variable number. The only thing I ever change in defines.txt would be the about message and the version message.