Hey All! I'm stoked on the progresses everyones been making in learning the code. Especialy those just learning programming.
So I though I put something up to help people who are having a hard time finding where the code is located that we want to alter for our mods or the code that is causeing the bugs that we will be introducing.
A whole other tutorial on how to debug with game maker and in programming in general would be REALLY useful. To me as well as others I'm sure. I'll see if I can find one allready made... I found a tutorial on writing easy to maintain code: http://code-spot.co.za/2008/09/06/60-ways-to-make-game-maker-projects-more-maintainable/
if anyone else can find good resourses for learning debuging please post.
ANYWAY. TUTORIAL ON CODE SEARCHING
By being able to search for keywords in all the scripts and (umm..??) 'code chunks' imbedded in the objects, you will more easily be able to find the code you need to alter in order for your mods to work properly and without many bugs.
If you havn't found out yet (or if you happen to know better ways that I? please share!) searching for code in game maker has afew anoying hitches. I'll explain:
Usualy, to find a peice of code, you would use one of two methods.
1: Under the 'scripts' drop down menu (on the top) there is a option to 'Search in Scripts...'. If you use this, you can put a keyword, or few, and search all the *'scripts'* in the program and show you where that word apears in each case.
2: Much limited in scope but not in usefulness is the 'find and replace' option. If you open any script or 'code chunk' (inside objects -> events -> actions) you can click on a tiny magnifine glass icon in the middleish of the script box and bring up this magnificent tool. This lets you type any number of keywords and search though the currently open
script. It highlights, it scrolls, it EVEN lets you replace! All for a low low scope of ONE SCRIPT! too bad, eh?
The major drawback of both these tools... The scope.
(if you didn't know, scope is a geeky programmer term describing how 'far reaching' something is. If a variable can be referanced from anywhere in a program it's said to have a 'global' scope.)
The second option obviously lacks because it can only search in the one script.
The first option is ideal... but. It only searchs inside the 'scripts' and not the 'code chunks'!
This is a huge problem because a VAST magority of code, in spelunky, is held inside objects. Open any of the things on the left with a little 'o' in front ot the name and your likely to find all these things that read "Execute a peice of code"
It's these that most of the work happens and it's here that the code is hardest to search though.
I've only figured out two ways of dealing with this... and if you know better or even just more, please post them!!
One way is to pick the object you think is most likely to have the code your looking for. open it. There is a button that says 'Show information'. If you click this you get a text that writes every line of code embedded in the object. You can then copy the code into notepad or somthing and search though it from there.
Again, you have to guess where it will be when you pick the object to search though...
The other way is much much better.. BUT. again, I know!
This way will involve some very kind souls making it work for everyone else.. painstakingly.
If all the 'execute a peice of code' chunks were carefully
copied into actual scripts and then each 'execute a peice' was deleted (or comented out). Then replaced with 'execute script' actions. We would all be able to search though all that code to find what we needed. So long as nothing gets broken in the conversion.
there it is. It's not great. I feel like there must be a way to search though everything without all that work. Is there a way to copy all
the code to a text file? Someone must have some better advice?!