Jump to content


Erik Leppen

Member Since 25 Jan 2007
Offline Last Active Yesterday, 04:26 PM

Posts I've Made

In Topic: How Do You Do Documentations For Your Gm Projects?

Yesterday, 04:19 PM

For large projects, I keep a list of scripts, all their arguments and a description of what they do or return, a list of all constants, all globalvars, all global variables, all instance variables of all objects, and the inheritance tree. Example of a script description:

savedialog_button_add(p, x, y, ascii_upper, ascii_lower, key) put a button with a size of 32 x 32 pixels on the screen centered at panel-relative position (x, y) on panel p where (0, 0) is the top-left of the panel, and that represents the character with ASCII value ascii_upper when shift is used, ascii_lower otherwise, and that is activated when the key with keycode key is pressed.

When it matters I also put the datatype, range and unit of each variable and the datatype of the return value. E.g.


int ix(int i 1..world_width cells) 0..room_width pixels Returns the room x-coordinate of the left hand side of the ith cell.

Edit: although I have to say, I usually keep script names so descriptive that this sometimes feels superfluous. It's more to have a list of all scripts. Also, the above explanation is always at the start of the script itself, in the code. /edit

 

I also keep to-do lists, but usualy not right from teh start. I also use the "done" list for the same purpose as Smarty - to remind myself that while a lot needs to be done, a lot is already finished as well! My to-do list looks like my code: like a rainbow, with tasks categorized into e.g. "graphics", "audio", "coding", "design", "balancing" etc.

In Topic: How Do You Indent?

20 May 2013 - 11:53 AM

I used Allman in the past, but I soon got rid of that habit when writing code that looks like this:
 
///Release: select nearest guy or give selected guy assignment
if not instance_exists(builder_platforms) {
  if not instance_exists(builder) {
    if not mouse.used {
      if mouse.released {
        if not mouse.drags {
          if not instance_exists(panel_at(mouse.x, mouse.y)) {
            //if guy near mouse, select him, otherwise, if someone selected, order him
            if instance_exists(selection()) {
              if guy_exists(selection()) {
                with selection() {
                  if guy_assignable() {
                    guy_assign(xi(mouse.x), yj(mouse.y))
                  }
                }
              }
              select_deselect()
            }
            else { //no selection, select near mouse
              select_at(mouse.x, mouse.y)
            }
          }
        }
      }
    }
  }
}
Also notice the else statement on a new line because I consider it equivalent to the if statement, so it's on the same column as the if statement.

In Topic: Variables Created Before Declaration?

17 May 2013 - 11:42 AM

Yes, i complained about this change for a good while on Mantis a while ago because I think it's a significant paradigm shift that local variables are now event-local instead of piece-of-code local. It has caught me as well.

They said it was an automatic consequence of the fact that all pieces of code in an event are joined together at compile-time to increase performance. While I understand that, I still think this is a design problem in GM:Studio that needs to be addressed in some way, and I even suggested things like color-coding all var-variables (of course, recognizing the var-variables from other pieces-of-code within the same event) or silently renaming var-variables at compile time to prevent name collisions, or silently add the self prefix on any non-var-variables at compile-time.

In Topic: Favorite Quotes

15 May 2013 - 08:30 PM

I would watch out with quotes like that before someone of the forum staff decides to change your name anyway :P

After all, they fiddle with people's reputations and user titles. The idea that they touch your name is not that far-fetched :D

 

-One of my all time favorite basketball players, Erik Leppen

How do you know I play basketball?


Oh, by the way, did I mention

You don't stop playing when you grow old, you grow old when you stop playing

before?

In Topic: GMC Review Workshop

15 May 2013 - 03:27 PM

Aren't people making this too difficult? Why not just make a system where people write reviews, and enter these reviews into a competition, and then some system is used to judge the reviews (be it a jury, voting, something else, or a combination). I think all you have to do is set a deadline, find judges and make it known.

That's all we need, right?