Jump to content


Photo

GameMaker Interactive Online Help


  • Please log in to reply
31 replies to this topic

#21 OMGCarlos

OMGCarlos

    GMC Member

  • GMC Member
  • 329 posts
  • Version:GM:HTML5

Posted 07 October 2011 - 06:16 AM

@Schalk - Done! I didn't actually know about the "var = !var;" shorthand. I was going to keep it "var *= -1;" just because it actually is shorter but after considering it I realized that actually the ! shorthand is cleaner code - so I'm adopting it. Nice catch

Dark Matter - I noticed the same thing while I was converting the old format over. I'll go in and convert them all to double quotes after I post this. I'll also edit the funky code highlighting to match the one in GM8 because I personally hate the new IDE. I'll upload the css file for it in my other post incase anyone finds a need for it.

I didn't have work or school today, and I legitimately spent since 7am to right now (2am) working on cleaning up the format and working on some server code but I'm excited to say that all the hard part is done. To prevent myself from burning out, I'm restricting myself to writing 10 articles a day which is actually rather easy now that the format is set in stone. This allows me to meet my goal of having the entire GML library ported online by New Years.

[edit]
Schalk just saw your last post. Again, I didn't know that GameMaker supported the use of the c operators. I'll definitely switch over tomorrow. I'll keep the downloadable source code as is though, that's overkill, but I'll definitely adjust all the on-site code people see!

Edited by OMGCarlos, 07 October 2011 - 06:20 AM.

  • 0

#22 Schalk

Schalk

    GMC Member

  • GMC Member
  • 487 posts
  • Version:GM:HTML5

Posted 07 October 2011 - 06:27 AM

Good job with the work you are putting in. It's appreciated :)
  • 0

#23 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 07 October 2011 - 03:32 PM

I agree for the most part, but I think it's better to use and and or, etc. than && and ||.
Also, no use of then and true/false should be used instead of 1/0.
  • 0

#24 OMGCarlos

OMGCarlos

    GMC Member

  • GMC Member
  • 329 posts
  • Version:GM:HTML5

Posted 07 October 2011 - 04:54 PM

I've been doing some examples and I actually don't like the && || operators, here's why. The GMDN is designed to be used as a reference for beginners and a source for new ideas for experienced users. While experienced users may find the && || == second nature to read, I feel it may be a bit too cryptic for the newbies. I personally like it and will use it in my own work, but for readability - especially for the new guys - the literal operators (and, or) makes more sense.

I don't know if I agree with not using then. I feel it's clearer to read:
if (keyboard_check_pressed(vk_up)) then dir = 0;
if (keyboard_check_pressed(vk_right)) then dir = 1;
if (keyboard_check_pressed(vk_down)) then dir = 2;
if (keyboard_check_pressed(vk_left)) then dir = 3;
over:
if (keyboard_check_pressed(vk_up)) { dir = 0; }
if (keyboard_check_pressed(vk_right)) { dir = 1; }
if (keyboard_check_pressed(vk_down)) { dir = 2; }
if (keyboard_check_pressed(vk_left)) { dir = 3; }
or even any of these:
if (keyboard_check_pressed(vk_up)) {
     dir = 0;
}
if (keyboard_check_pressed(vk_right)) {
    dir = 1;
}
if (keyboard_check_pressed(vk_down))
{
    dir = 2;
}
if (keyboard_check_pressed(vk_left))
{
    dir = 3;
}
Problem is, usually people don't read an entire article. In fact, people will usually stay on a page for only a few seconds so it's important that the reader can just glance at the code and move on - if it wasn't what they were looking for. But I agree with using true/false as it helps reinforce that a variable is a boolean and not something that should operated on

Edited by OMGCarlos, 07 October 2011 - 04:59 PM.

  • 0

#25 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 07 October 2011 - 05:00 PM

then does absolutely nothing. It's simply for people who cannot learn how to switch from English to a programming language. You can do:
if (keyboard_check_pressed(vk_up)) dir = 0;
if (keyboard_check_pressed(vk_right)) dir = 1;
if (keyboard_check_pressed(vk_down)) dir = 2;
if (keyboard_check_pressed(vk_left)) dir = 3;
You don't need then at all.
The third example is best, simply because it's formatted much more nicely, although you can omit the curly brackets in this case, as it's only executing a single statement after the if.
  • 0

#26 OMGCarlos

OMGCarlos

    GMC Member

  • GMC Member
  • 329 posts
  • Version:GM:HTML5

Posted 07 October 2011 - 05:11 PM

Good point! Still I'll have to consider it and see what other people feel. To me 'then' separates the conditional statement from the execution statement - kind of like using punctuation. Sure you can read a run-on sentence, but the punctuations help separate one statement/thought from another.

Oh this is for if...then with only one statement after it. I never use 'then' in conjunction with {} , maybe I should change that?
  • 0

#27 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 07 October 2011 - 05:24 PM

Good point! Still I'll have to consider it and see what other people feel. To me 'then' separates the conditional statement from the execution statement - kind of like using punctuation. Sure you can read a run-on sentence, but the punctuations help separate one statement/thought from another.

Oh this is for if...then with only one statement after it. I never use 'then' in conjunction with {} , maybe I should change that?

Well, then is not used in any languages like C, so it seems rather pointless. If we're generally formatting things logically, so they'd potentially be easy to transfer to other languages (although I know that's not the point), it'd be better to leave it out.
  • 0

#28 OMGCarlos

OMGCarlos

    GMC Member

  • GMC Member
  • 329 posts
  • Version:GM:HTML5

Posted 07 October 2011 - 06:01 PM

Ok I'll definitely talk it over!

Also, I set up the article submission form on the first post if anyone is interested. That way you can do everything from right here instead of downloading something, then uploading it, etc much MUCH easier! As long as the mods don't have a problem with it otherwise I'll take down the help request on the first post no sweat.

Oh...and there is no pressure to write an article for anyone who's posted so far. None at all. My goal is to have the entire GMDN up and running by January 1st, which at a rate of 10 articles a day I could easily do. If you have an example, or want to add something to an existing article you can post it here or just leave a comment on the articles page (very easy to do, no email/etc required to comment).
  • 0

#29 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 07 October 2011 - 06:14 PM

I'd like to help. I did write one function, but didn't get around to uploading it. I'll do a few tomorrow. However, doesn't this mean you won't get examples if we just post here? Will you make them yourself or just leave them out?

Edited by Dark Matter, 07 October 2011 - 06:15 PM.

  • 0

#30 OMGCarlos

OMGCarlos

    GMC Member

  • GMC Member
  • 329 posts
  • Version:GM:HTML5

Posted 07 October 2011 - 09:10 PM

I had to take down my uploader because someone was abusing it this morning and honestly maintaining that is not a priority right now, so instead you can use a file service like http://easy-share.com/ - they don't even require an e-mail which is nice. You can then just PM/post the link to the example
  • 0

#31 Dark Matter

Dark Matter

    RPG Expert

  • GMC Member
  • 3196 posts
  • Version:GM:Studio

Posted 08 October 2011 - 09:30 AM

Right now, I'm documenting the .gmx format. It's quite large, so it'll take a while, but it'd be good to have on the GMDN when it's done.

I'm not sure how to format the data though, so it's easy to understand and use. Any ideas?

Edited by Dark Matter, 08 October 2011 - 11:59 AM.

  • 0

#32 OMGCarlos

OMGCarlos

    GMC Member

  • GMC Member
  • 329 posts
  • Version:GM:HTML5

Posted 08 October 2011 - 03:56 PM

That's an awesome idea, it doesn't have to be just commands! Since it's not a command the formatting will be different, I think I would have to see how you wrote it to figure out the best way to format it.
  • 0




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users