31.07.2012, 03:27
Hi there,
I'm currently working on a custom script, from complete scratch, even color definitions, I'm only currently at 1,261 lines but before I go any further I'd like to get some opinions on the best way to script efficiently, so in a years time the script is still scriptable (unlike some messy godfather edits).
I'm using y_ini and y_commands, with Dini for some other commands that require certain things that y_ini can't do. I'm then using foreach, sscanf2 and streamer. So in my opinion, that's pretty efficient so far.
How ever it's the actual style/method of coding I'm worried about that's going to make it inefficient. One thing is, for dialogs, I use dialog defines so that I can keep track of what dialog numbers I'm at.
Example:
Then, for player related variables (not sure of the technical name), I use a define for them.
Example:
I then use this style of coding when I create a command:
Instead of:
So, how do you think I'm going with efficiency so far? Should I keep going the way I am or change things? Input your opinions below, and voice your opinion on anything else about scripting efficiently
I'm currently working on a custom script, from complete scratch, even color definitions, I'm only currently at 1,261 lines but before I go any further I'd like to get some opinions on the best way to script efficiently, so in a years time the script is still scriptable (unlike some messy godfather edits).
I'm using y_ini and y_commands, with Dini for some other commands that require certain things that y_ini can't do. I'm then using foreach, sscanf2 and streamer. So in my opinion, that's pretty efficient so far.
How ever it's the actual style/method of coding I'm worried about that's going to make it inefficient. One thing is, for dialogs, I use dialog defines so that I can keep track of what dialog numbers I'm at.
Example:
pawn Code:
#define DIALOG_LOGIN 1
Example:
pawn Code:
#define MAX_PLAYERS MP
new gIsPlayerLoggedIn[MP];
pawn Code:
CMD:connected(playerid, params[])
{
if(IsPlayerConnected(playerid)) return SendClientMessage(playerid, -1, "You are connected.");
else return SendClientMessage(playerid, -1, "For some reason, you are not connected.");
}
pawn Code:
CMD:connected(playerid, params[])
{
if(IsPlayerConnected(playerid))
{
SendClientMessage(playerid, -1, "You are connected.");
return 1;
}
else
{
SendClientMessage(playerid, -1, "For some reason, you are not connected.");
}
return 1;
}
So, how do you think I'm going with efficiency so far? Should I keep going the way I am or change things? Input your opinions below, and voice your opinion on anything else about scripting efficiently