Page 1 of 1

coding failure

PostPosted: Mon Dec 02, 2013 7:27 am
by barney12345
Ok, I am a failure at c coding. Python, java, etc, im ok with. But I just cant get my head completely around coding for game editor. I used to only make games with the simple codes that I could access on the forum. But now that I want harder games, I need to know how to do proper if/else statements, proper variables, proper loops, etc. I dont want someone to tell me what to do precisely, as for all other codes I know, I was self taught with a couple of online tutorials, so if someone could direct me to a good (preferably interactive) online learning webpage. I know that there is a thing called GOOGLE for finding this type of thing, but I have more trust in this forum than in googles order of choices. I will give points to best page.

Re: coding failure

PostPosted: Mon Dec 02, 2013 6:25 pm
by DarkParadox
It's a bit difficult to learn GE from online C tutorials, since the way we write code into GE is slightly different from writing plain C code (We don't use #include, printing functions, a main() function, etc). If you're going to learn from an online source, you'll need to be able to separate what's going to be useful to you in coding for GE and what's C basics. There's a lot of things in C which aren't needed for writing useful code in GE, and many tutorials for C are very wordy on these topics, while barely explaining things like structuring IF statements. It's probably a good idea to, yes, search on google for a source for your programming. There are lots and lots of places that try to teach you different programming languages, and any of them will work for the basic structure for IF's and FOR's and what-not. It's mostly up to your own brain about which tutorials way of explaining you prefer most.

Your best bet for finding out how all of Game-Editor's functions work and what the variables are are in its own Script Reference. I did a giant list of C keywords and how to use them in GE myself; it's not terribly well done and I made it when I wasn't as experienced as I am now, but may help you anyways.

A good thing to do is to get in closer contact (like instant messaging over Skype, for example) with someone who already can code C in GE fairly well (like myself, sky, etc) and ask them the questions you want answers to, since it's a lot easier to get things done when you can quickly respond.

Re: coding failure

PostPosted: Tue Dec 03, 2013 7:34 am
by barney12345
Ok, thank you for that, it was actually a lot more helpful than I thought it would :D . So I then tried to test what I had learnt, mainly with variables, but I don't seem to have something right still. Can you tell me whats wrong with my file plz

Re: coding failure

PostPosted: Tue Dec 03, 2013 9:31 am
by DarkParadox
The issue you have there is with your actor "add". On that actor's event, you have the code:
Code: Select all
int i=1;

The variable "i" was already declared in global code, and by declaring "i" again inside of that script using "int", you've made a new temporary variable with the same name that is only effective within that one script. The solution? Simply remove "int" and modify the global variable directly using:
Code: Select all
i=1;