TB RPGs Are Slightly Difficult

Posted by Taizen Chisou on March 28, 2012, 8:35 a.m.

> wake up

> "oh i know maybe i can retool the ricerca strano engine today"

oh yeah that's right i hate modifying this game

Comments

firestormx 12 years, 9 months ago

*puts on my nerdy nasaly voice* I hope that was sarcasm.

I do a LOT of single lines after if statements all the time, like this:

if (colour == red)

{print red;}

else

{print blue;}

And I'm not one of those tards who doesn't put curly braces around single statements.

Defending the lack of curly braces in python, is like defending the lack of differentiating setting a value vs comparing a value (using = to compare values in an if statement). If that's how you learn, you're going to have to change your coding ways to use any other language.

Curly braces make it easier to visually identify, but also makes it easier to problematically identify, which if you happen to be a text editor, makes it much easier for you to do things like allow a developer to jump to-and-from the opening and closing curly brace if there is a lot of statements between them.

The notion of literally relying on whitespace is ridiculous, and annoying.

sirxemic 12 years, 9 months ago

Note that I am not saying indentation instead of curly brackets is better, I am saying that it makes perfect sense.

Quote:
if (colour == red)

{print red;}

else

{print blue;}
MY EYES

The point of curly brackets is mainly to create blocks of code. While I agree on visually identification and that it's a good argument, using them on the same line as the code makes very little sense in almost all ways. First of all, it's kind of inconsistent. Second of all, once you add code to the block, you most likely do something like:

{
    print red;
    print 'is awesome';
}

Wouldn't you at that point think something like "why didn't I do it like so in the first place-"

{
    print red;
}

leemcd56 12 years, 9 months ago

I'm with sXc on this; I understand in-line and coding with no spacing to prevent others from editing your code when you're distributing it as a finished product, but while you're editing it, it's best to keep as much clutter out of the way as possible.

firestormx 12 years, 9 months ago

As long as you're not saying indentation should replace curly braces, it's all good. =D

If I were to add more lines of code, I would break it into a 4+ line of code, instead of 1, but do still prefer to write most of my single line blocks as a single line.

Rob 12 years, 9 months ago

Then why not just do it like

if (conditional)
       statement;

If you want it to be one line only anyways. What purpose does {statement;} achieve?

I understand

if (conditional)
{
      statement;
}

because it makes adding more stuff in there easy, but {statement} doesn't really do that at all. It just looks retarded. At least to me.

firestormx 12 years, 9 months ago

I…Er…

stfu Rob, no one likes you. My argument still stands.

(to the first half of your comment)

Alert Games 12 years, 9 months ago

What do I see here:

1) The number of consistent IF statements suggests that you may want to make another script to handle particular conditions, or use an orderly 2D-array.

2) Use semicolons for this situation as good practice: variable = x; variable2 = x[10];

Functions you can, but are not required. If you try and obfuscate that code, it will not work without semicolons after assigning values.

3) Indent your code, and dont listen to FSX. Listen to Rob's comment [#45]. Easy to read and is what most people agree on.

Your naming style is good. other scripts seem reasonable. Doesnt seem to bad to work with

Castypher 12 years, 9 months ago

The code's not as bad as people say. Nobody here knows code that's so far from standards unless they've seen stuff Serprex coded.

firestormx 12 years, 9 months ago

I AM NOT SAYING NOT TO INDENT CODE. I'M SAYING I HATE PYTHON.

Rob 12 years, 9 months ago

Quote:
I AM NOT SAYING NOT TO INDENT CODE. I'M SAYING I HATE PYTHON.

Weren't you advocating the following code?

if (conditional)
{statement;}