AmstradHero wrote...
JackFuzz wrote...
Let's just say if you ever need two different scripts to access a global variable let me know and I'll point you to the right thread.
But "globals are evil", so I'd use plot flag instead. And provided the scripts are being run in the same area (or maybe in the same AreaList?), then surely you should just be able to store it on an object anyway?
Alternatively, is it possible to use SetLocalX on GetHero()?
Globals are not evil. You've just been tainted by bad programming instructors who don't want you to think for yourself. Globals
can be evil (and will probably cause you to break things accidentally), but it depends on your application. Depending on the simplicity of your program, you don't even need the complexity of an object-oriented programming language.
I still have to write some assembly code. PUSHing and POPing aren't bad as long as you know what you're doing.
Parameter passing is great and all, but if you think about it, the save game files are "global variables" themselves.
I've known far too many programmers who are more concerned with how "pretty" their code is than what it actually
does.
Modifié par EJ42, 10 janvier 2010 - 08:42 .