LIGHT_SP.C

LIB3/STD/LANGUAGE/LIGHT_SP.C · 1.5 KB

From the archive nm4dos.zip

Download the archive   « Back to the archive contents


string long()
{
    return "The gentle language spoken by 'good' creatures.\n";
}

int     mod( int i )
{
    return i - 4 * (i / 4);
}

string  lang( string str )
{
/* This should sound like phonetic hawaiian */
    switch( strlen( str ) )
    {
	case 1:
	    return({ "a", "h", "l", "o" })[ mod( str[ 0 ] ) ];
	case 2:
	    return({ "oh", "al", "co", "la" })[ mod( str[ 0 ] ) ];
	case 3:
	    return({ "ahl", "col", "cal", "loh" })[ mod( str[ 0 ] ) ];
	case 4:
	    return({ "ohha", "caal", "cohl", "loca" })[ mod( str[ 0 ] ) ];
	case 5:
	    return({ "ahhol", "hocal", "looha", "ohalo" })[ mod( str[ 0 ] ) ];
	case 6:
	    return({ "cohhol", "alocoh", "cocaho", "lalola" })[ mod( str[ 0 ] ) ];
	case 7:
	    return({ "ahhaloh", "holacol", "cohocal", "ocohoha" })[ mod( str[ 0 ] ) ];
	case 8:
	    return({ "ohhocola", "allocahh", "coalocla", "lalahaho" })[ mod( str[ 0 ] ) ];
	default:
	    return({ "aa", "cc", "hh", "ll" })[ mod( str[ 0 ] ) ];
    }
}

string  standard_garble( string mess )
{
    string  ret, str;

    ret = "";
    while( sscanf( mess, "%s %s", str, mess ) == 2 )
	ret += lang( str ) + " ";
    return ret + lang( mess );
}

mixed   garble_tell( string start, string mess )
{
    return({ start, standard_garble( mess ) });
}

mixed   garble_shout( string start, string mess )
{
    return({ start, standard_garble( mess ) });
}

mixed   garble_say( string start, string mess )
{
    return({ start, standard_garble( mess ) });
}

mixed   garble_written( string start, string mess )
{
    return({ start, standard_garble( mess ) });
}

Site Stats

Snippets: 1791
Codebases: 571