600 - 700 ADV diet!! T

Is there an easier way to find the {} [] () openings and closings, than to just do it manually???
It is perfectly reasonable to do it manually. The secret is to indent your code to make it clearer. For example:
PHP:
boolean shrugsong() {
int[effect] all_songs = all_songs();
effect minsong;
int mineffect=0;
foreach e in all_songs {
if(e.have_effect() > 0) {
if ((mineffect == 0) || (e.have_effect() < mineffect)) {
mineffect = e.have_effect();
minsong = e;
}
}
}
print("shrugging: "+to_string(minsong) );
if (minsong.have_effect () > 0)
cli_execute("try; shrug "+to_string(minsong) );
if (minsong.have_effect () > 0)
Return FALSE;
Return TRUE;
}
is much clearer like this:
PHP:
boolean shrugsong()
{
	int [ effect ] all_songs = all_songs();
	effect minsong;
	int mineffect = 0;

	foreach e in all_songs
	{
		if( e.have_effect() > 0 )
		{
			if ( ( mineffect == 0 ) || ( e.have_effect() < mineffect ) )
			{
				mineffect = e.have_effect();
				minsong = e;
			}
		}
	}

	print( "shrugging: "+to_string( minsong ) );

	if ( minsong.have_effect () > 0 )
		cli_execute( "try; shrug " + to_string( minsong ) );

	if ( minsong.have_effect () > 0 )
		Return FALSE;

	Return TRUE;
}

You can also use editors like notepad++, with which matching ) ] } turn red when you select a ( [ {.

There's even a way to write mafia code prettily with notepad++.
 
Last edited:
Back
Top