Your scripting Pet Peeves
#1

This thread is not to try and bash other people's scripting methods, but post here, What scripting things to you see that absolutely annoy you?

I would have to say mine is this
pawn Code:
CMD:mycommand(playerid, params[])
{
    #pragma unused params
    //rest of code
}
Reply
#2

Defining 9001 colors and only using 4.

pawn Code:
#define COLOR1 0x5515551FF
#define COLOR2 0x4545455FF
#define COLOR3 0x7757878FF
#define COLOR4 0x5959559FF
#define COLOR5 0x3434543FF
#define COLOR6 0x5646545FF
#define COLOR7 0x1234546FF
#define COLOR8 0x7964546FF
#define COLOR9 0x5484163FF
#define COLOR10 0x1244915FF
also, using 500 different saving engines.

pawn Code:
#include dini
#include Y_INI
#include SII
#include MySQL
And those HUGE 1,000+ line commands. JUST WHY.

EDIT: Got even more

pawn Code:
#define PID playerid
#define SCM SendClientMessage
Reply
#3

Hungarian notation annoys me to no end, especially when used by people that have no idea what it's supposed to represent. They're just putting 'sz' in front of everything.

To a lesser extent: code that is crammed together. Congratulations, you just saved yourself some kilobytes. Please use more whitespace. Within a command, I personally tend to insert blank lines to separate the different conditions.
Reply
#4

I hate the K&R indentation style. It looks so messy IMO.

K&R:


Allman:


These examples are a bit silly, but they show what I'm talking about; it's MUCH clearer to see which compound block is attached to which if()/switch()/case in allman. The allman code is slightly longer (as each opening bracket is on a new line), but I really do think it is 10x easier to read.

In addition to this, it's very annoying when people (or a team of people) don't stick to one indentation style.
Reply
#5

Quote:
Originally Posted by Vince
View Post
code that is crammed together. Congratulations, you just saved yourself some kilobytes. Please use more whitespace. Within a command, I personally tend to insert blank lines to separate the different conditions.
This, definitely. I space out my commands a LOT. I just find it easier to find issues or update the code later.
Reply
#6

God I cant stand K&R. I never new the name of scripting styles, but all my scripts have to be strictly Allman, no compression, no variation, otherwise my scripting OCD kicks in.
Reply
#7

Quote:
Originally Posted by Aerotactics
View Post
God I cant stand K&R. I never new the name of scripting styles, but all my scripts have to be strictly Allman, no compression, no variation, otherwise my scripting OCD kicks in.
yes, so true. ^
Reply
#8

Quote:
Originally Posted by MP2
View Post
I hate the K&R indentation style. It looks so messy IMO.
In your K&R image you could still remove the brackets of the case labels

But I think the most annoying thing here are the people who can't use search, debug the code, take criticism and so on, that isn't related to any age
Reply
#9

Quote:
Originally Posted by Mionee
View Post
Defining 9001 colors and only using 4.
also, using 500 different saving engines.

pawn Code:
#include dini
#include Y_INI
#include SII
#include MySQL
I actually use both INI and MySQL. INI for gamemode configuration. MySQL for player data and bans.

Something from me:

- HUUUUUGE variables when they are not needed:
pawn Code:
new name[MAX_PLAYER_NAME+1];
new str[256]; // -___-

GetPlayerName(playerid, name, MAX_PLAYER_NAME);
format(str, sizeof(str), "Your name is: %s", name);
SendClientMessage(playerid, -1, str);
-Code indentation... It's hard to press tab key?
-Using old stuff like dini, strcmp for commands etc.
-Doing this:
pawn Code:
new var;
new var1;
new var2;
new var3;
new var4;
new var5;
new var6;
Instead of:
pawn Code:
new var[7];
Reply
#10

Quote:
Originally Posted by Emmet_
View Post
enumerated arrays have a few extra assembly instructions. Both are identical in ... performance.
More instructions = more time to execute = slower.

Quote:
Originally Posted by Hiddos
View Post
People who use INI systems in general
I mean just learn the file functions ;__;
I MASSIVELY disagree with this! Abstractions are there for a reason, if you don't like them code everything in RAW assembly (and I don't mean memonics, those are too nice an abstraction). You could use raw file functions, but INI systems take away a lot of the complexity (and bugs - Godfather had bugs where users could get a higher admin level because of their use of raw files).
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)