TinTin++ Mud Client Scripts  
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
space
space
This is a script that will enable a promptbar and automapping for any MSDP enabled MUD supporting the ROOM, HEALTH, MANA, MOVEMENT, EXPERIENCE, MONEY, and ROOM_EXITS variables.

space
#format IAC  %a 255
#format DONT %a 254
#format DO   %a 253
#format WONT %a 252
#format WILL %a 251
#format SB   %a 250
#format SE   %a 240

#format MSDP %a  69

#format VAR  %a  01
#format VAL  %a  02

#event {SESSION CONNECTED}
{
	#split 16 1;
	#map create 50000;
	#map flag nofollow;
	#map flag vtmap;
	#map flag static;
	#map read msdp.map
}

#event {SESSION DISCONNECTED}
{
	#map write msdp.map
}

#var {MSDP_REPORTABLE_VARIABLES}
{
	{ROOM};
	{ROOM_EXITS};
	{ALIGNMENT};
	{EXPERIENCE};
	{EXPERIENCE_MAX};
	{HEALTH};
	{HEALTH_MAX};
	{LEVEL};
	{MANA};
	{MANA_MAX};
	{MONEY};
	{MOVEMENT};
	{MOVEMENT_MAX};
	{ROOM_EXITS};
}

#nop Translation table to handle implementation differences.

#var {DIR_NAME}
{
	{n} {N}
	{e} {E}
	{s} {S}
	{w} {W}
	{u} {U}
	{d} {D}
	{north} {N}
	{east} {E}
	{south} {S}
	{west} {W}
	{up} {U}
	{down} {D}
}

#nop Turn debug telnet on to see telnet events.

#config {debug telnet} {off}

#nop Utility function to generate color gradients, requires 256 color terminal.

#function {colscale}
{
	#switch {10 * %1 / %2}
	{
		#case {0} {#return };
		#case {1} {#return };
		#case {2} {#return };
		#case {3} {#return };
		#case {4} {#return };
		#case {5} {#return };
		#case {6} {#return };
		#case {7} {#return };
		#case {8} {#return };
		#case {9} {#return };
		#default  {#return }
	}
}

#event {IAC WILL MSDP}
{
        #send {$IAC$DO$MSDP\};

	msdp_report
}

#event {IAC SB MSDP}
{
	#var {MSDP_%0} {%1};
}

#nop Places status information on the split line, this will only work properly if all used variables are reported by the server.

#event {IAC SB MSDP IAC SE}
{
	#if {&MSDP_ROOM_EXITS == 0}
	{
		#return
	};

	#format {prompt} {};

	#format {prompt} {$prompt<038> Hp: @colscale{$MSDP_HEALTH;$MSDP_HEALTH_MAX}%+4s<238>/<138>%-4s } {$MSDP_HEALTH} {$MSDP_HEALTH_MAX};
	#format {prompt} {$prompt<238> Mn: @colscale{$MSDP_MANA;$MSDP_MANA_MAX}%+4s<238>/<138>%-4s } {$MSDP_MANA} {$MSDP_MANA_MAX};
	#format {prompt} {$prompt<238> Mv: @colscale{$MSDP_MOVEMENT;$MSDP_MOVEMENT_MAX}%+4s<238>/<138>%-4s } {$MSDP_MOVEMENT} {$MSDP_MOVEMENT_MAX};
	#format {prompt} {$prompt<238> Xp: @colscale{$MSDP_EXPERIENCE;$MSDP_EXPERIENCE_MAX}%-3m } {100 * $MSDP_EXPERIENCE / $MSDP_EXPERIENCE_MAX};
	#format {prompt} {$prompt<238> Gd: %-8s } {$MSDP_MONEY};

	#var exits {};

	#foreach {n;north;e;east;s;south;w;west;u;up;d;down} {exit}
	{
		#if {&MSDP_ROOM_EXITS[$exit] == 0}
		{
			#continue
		};

		#if {"$MSDP_ROOM_EXITS[$exit]" == "{O|OPEN}"}
		{
			#var {exits} {$exits<138>$DIR_NAME[$exit]}
		};
		#else
		{
			#var {exits} {$exits<168>$DIR_NAME[$exit]}
		}
	};
	#format {prompt} {$prompt <238>Ex: %-6s} {$exits   <088>};

	#line ignore #showme {$prompt} {1}
}

#nop Automapping support for the ROOM variable.
	
#event {IAC SB MSDP ROOM}
{
	#var {MSDP_ROOM} {%1};

	#map goto {$MSDP_ROOM[VNUM]} {dig};

	#map set roomarea $MSDP_ROOM[AREA];
	#map set roomname $MSDP_ROOM[NAME];
	#map set roomterrain $MSDP_ROOM[TERRAIN];
	#map set roomcolor <178>;

	#nop Create unmapped exits and color unexplored rooms red.;

	#foreach {$MSDP_ROOM[EXITS][]} {EXIT}
	{
		#map get {roomexit} {EXIT_LIST};

		#if {&EXIT_LIST[$EXIT] == 0}
		{
			#map get {roomvnum} {EXIT_VNUM} {$MSDP_ROOM[EXITS][$EXIT]};

			#map dig {$EXIT} {$MSDP_ROOM[EXITS][$EXIT]};

			#if {$EXIT_VNUM == 0}
			{
				#map set {roomcolor} {<118>} {$MSDP_ROOM[EXITS][$EXIT]}
			}
		}
	}
}

#nop Ask the server to report all keys inside MSDP_REPORTABLE_VARIABLES

#alias {msdp_report}
{
        #var result {$IAC$SB$MSDP${VAR}REPORT};

        #foreach {$MSDP_REPORTABLE_VARIABLES[]} {tmp}
        {
                #var result {$result${VAL}$tmp}
        };

        #send {$result$IAC$SE\}
}

#alias {msdp_send}
{
	#send {$IAC$SB$MSDP${VAR}SEND${VAL}%0$IAC$SE\}
}

#alias {msdp_list}
{
	#send {$IAC$SB$MSDP${VAR}LIST${VAL}%0$IAC$SE\}
}