tin:mume.tin

mume.tin

MUME Discord Sheep — Feedback appreciated. I'd recommend doing #session whatever localhost 4242 mume.tt to load it as a part of connecting to mmaper/MUME instead of connecting and then doing #read mume.tt but either works if you read the instructions that pop up.

mume.tin
#config charset utf-8;
#split 10
#class mume kill
#class mume open
#var leader Nobody
#nop initialize empty group
#list group create {};
#showme Welcome to the MUME scripts for TinTin++!;
#showme Use the 'gmcp' command to control/debug GMCP messaging.;
#showme Use the 'session' command to reset session earned XP and TP.;
#showme If things aren't displaying properly, try 'gmcp reset yes' and 'gmcp channels reset';
#showme NOTE: xp/moves/mana only update when game sends updates, which is sporadically;
#showme (to keep parity with people who spam 'score' or whatever).;
#format testvar {%L} {\u00fb};
#if {$testvar != 1} {#showme Unicode characters may cause issues until you type #CONFIG CHARSET UTF-8;};
#unvar testvar
#var TPTNL 0;
#var XPTNL 0;
 
#ACTION {^You begin to feel hungry.$} {#var HUNGRY 1; dovitals;};
#ACTION {^You begin to feel thirsty.$} {#var THIRSTY 1; dovitals;};
#ACTION {^You are too full to eat more!$} {#var HUNGRY 0; dovitals;};
#ACTION {^Your stomach can't contain anymore!$} {#var THIRSTY 0; dovitals};
#ACTION {^You are thirsty.$} {#var THIRSTY 1; dovitals};
#ACTION {^You are hungry.$} {#var HUNGRY 1; dovitals;};
#ACTION {^You do not feel thirsty anymore.$} {#var THIRSTY 0; dovitals;};
#ACTION {^You are full.$} {#var HUNGRY 0; dovitals;};
 
#ACTION {^{\*|!|o|\)}{\#|\.|f|\(|\<|\%|\~|\+|W|U|\:|\-|O|\[|\=}{\~|\'|\"|\*|}{\s|}{C|c|}{R|}{S|s|}{W|}{\s|}{XP:\d+\.?\d+?k?M?|}{\s|}{TP:\d+|}}
{
	#nop Light: %1, Terrain: %2, Weather: %3, Climbing: %5, Riding: %6, Sneak %7, Swimming: %8, TNL: %10, TPTNL: %12;
	#if {"%10" == "XP:%d" || "%10" == "XP:%dk" || "%10" == "XP:%dm" || "%10" == "XP:%dM" } #var XPTNL @slice{{4}{%10}};
	#else	#var XPTNL {};
	#if {"%12" == "TP:%d"} #var TPTNL @slice{{4}{%12}};
	#else #var TPTNL {};
}
 
#nop Just lmao that this is necessary because string indices aren't a thing;
#FUNCTION slice
{
	#local newlist {};
	#list newlist create;
	#local temp %2;
	#local len %1;
	#format temp {%w} {{%2}{1}};
	#foreach {$temp[+$len..]} {i} {#list newlist add $i;};
	#list newlist collapse;
	#var result $newlist;
};
 
#HIGHLIGHT {HP:Hurt} {yellow}
#HIGHLIGHT {HP:Wounded} {orange}
#HIGHLIGHT {HP:Bad} {bold red}
#HIGHLIGHT {HP:Awful} {blink bold red}
 
#ALIAS {commwindow}
{
    #list window del 1;
    #list window ins -1 {%0};
    #draw white unicode rounded box 1 1 10 80 $window[-10..-1]
}
 
#class mume close
 
#class window open;
#VARIABLE {window}
{
    {1} {}
    {2} {}
    {3} {}
    {4} {}
    {5} {}
    {6} {}
    {7} {}
    {8} {}
    {9} {}
    {10} {} 
    {11} {}
}
#class window close;
 
#class gmcp kill;
#class gmcp open;
#var DEBUGCHANNELS 0;
#var DEBUGVITALS 0;
#var DEBUGROOM 0;
#var DEBUGSTATUSVARS 0;
#var ROOMCONTENTS {};
#var VITALS {};
#var sessionxp 0;
#var sessiontp 0;
#var TPTNL {};
#var XPTNL {};
#var ROOMINFO {};
 
#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 GMCP %a 201
#var {CLIENT_NAME} {Tintin++}
#var {CLIENT_VERSION} {0.00.1}
 
#EVENT {IAC SB GMCP Char.StatusVars IAC SE}
{
	#if {$DEBUGSTATUSVARS == 1}	#showme {%0};
	#local TEMPVARS {%0};
	#foreach *TEMPVARS[%*] {a}
		{
		#if {"*TEMPVARS[$a]" == "next-level-xp"} 
			{
			#if {"$TEMPVARS[$a]" == "%d"} #var nextlevelxp $TEMPVARS[$a];
			#else #var nextlevelxp 0;
			};
		#if {"*TEMPVARS[$a]" == "next-level-tp"} 
			{
			#if {"$TEMPVARS[$a]" == "%d"} #var nextleveltp $TEMPVARS[$a];
			#else #var nextleveltp 0;
			};
		};
}
 
#EVENT {IAC SB GMCP Char.Vitals IAC SE}
{
	#local TEMPVITALS {%0};
	#nop Show full return of updated Char.Vitals from server;
	#if {$DEBUGVITALS == 1} { #showme %1 };
   #foreach *TEMPVITALS[%*] {a}
		{
		#if {$DEBUGVITALS == 1} #showme updating $VITALS[$a] with $TEMPVITALS[$a];
		#if {"*TEMPVITALS[$a]" == "xp"} 
			{
				#local gainedxp 0;
				#var currentxp $VITALS[$a];
				#math gainedxp {$TEMPVITALS[$a] - $currentxp};
				#math sessionxp {$sessionxp + $gainedxp};
				#showme {\r\n** XP Gain: $gainedxp ($sessionxp total)};
			};
		#if {"*TEMPVITALS[$a]" == "tp"}
			{
			#local gainedtp 0; 
			#math gainedtp {$TEMPVITALS[$a] - $VITALS[$a]};
			#showme {\r\n** TP Gain: $gainedtp};
			#math sessiontp {$sessiontp + $gainedtp};
			};
		#nop Why do this here\? Because we are mangling VITALS[a] below, not above;
		#var VITALS[$a] $TEMPVITALS[$a];
		#if {"*TEMPVITALS[$a]" == "weather"}
			{
			#switch {"$TEMPVITALS[$a]"}
				{
				#case "\~" #var VITALS[weather] {clouds};
				#case "\'" #var VITALS[weather] {rain};
				#case "\"" #var VITALS[weather] {heavy rain};
				#case "\*" #var VITALS[weather] {snow};
				#default #var VITALS[weather] {clear};
				};
			};
		#if {"*TEMPVITALS[$a]" == "light"}
			{
			#switch {"$TEMPVITALS[$a]"}
				{
				#case "!" #var VITALS[light] {light};
				#case "*" #var VITALS[light] {outdoor light};
				#case "o" #var VITALS[light] {dark};
				#case ")" #var VITALS[light] {moonlight};
				#default #var VITALS[light] {light broken?};
				};
			};
		#if {"*TEMPVITALS[$a]" == "fog"}
			{
			#switch {"$TEMPVITALS[$a]"}
				{
				#case "-" #var VITALS[fog] {light fog};
				#case "=" #var VITALS[fog] {heavy fog};
				#default #var VITALS[fog] {};
				};
			};
		#if {! &VITALS[weather] } {#var VITALS[weather] {clear}};
		#if {! &VITALS[fog] } {#var VITALS[fog] {}};
		};
	dovitals;
}
 
#EVENT {IAC SB GMCP Comm.Channel.List IAC SE}
{
	#local channellist {%0};
	#local chan {};
	#list channellist size csize;
	#if {$DEBUGCHANNELS == 1} showme %1;
	#foreach {*channellist[%*]} {chan}
		{
		#if {$DEBUGCHANNELS == 1}	#showme Channel received: $channellist[$chan][caption]\; Attempting to enable.;
		#send {$IAC$SB${GMCP}Comm.Channel.Enable "$channellist[$chan][name]" $IAC$SE\};
		};
	#showme GMCP Communication channels added.;
};
 
#ALIAS session
{
	#switch {"%1"}
		{
		#case "reset"
			{
			#var sessionxp 0;
			#var sessiontp 0;
			#showme Reset session XP and TP earned.;
			dovitals;
			};
		#showme Earned this session: $sessionxp XP, $sessiontp TP.;
		#default #showme Syntax is 'session reset' to reset session earned XP and TP.;
		};
};
 
#ALIAS gmcp
{
	#switch  {"%1"}
		{
		#case "channels"
			{
			#switch {"%2"}
				{
				#case "reset"
					{
					#showme Enabling GMCP Communication Channels.;
					#send {$IAC$SB${GMCP}Core.Supports.Remove [ "Comm.Channel" ] $IAC$SE\};
					#send {$IAC$SB${GMCP}Core.Supports.Add [ "Comm.Channel 1" ] $IAC$SE\};
					};
				#default 
					{
					#local temp {};
					#foreach $channellist[%*] {entry} {#local temp {$temp $entry[caption]}};
					#if {"$temp" != ""} #showme Currently enabled GMCP Communication Channels: $temp;
					#else #showme No GMCP Communication Channels enabled.;
					#showme Use \'gmcp channels reset' to reenable GMCP Communication Channels.;
					};
				};
			};
		#case "room"
			{
			#switch {%2}
				{
				#case "reset"
					{
               #showme Resetting GMCP Room.;
               #send {$IAC$SB${GMCP}Core.Supports.Remove [ "Room" ] $IAC$SE\};
               #send {$IAC$SB${GMCP}Core.Supports.Add [ "Room 1" ] $IAC$SE\};
					};
				#default 
					{
					#if {&ROOMINFO} #showme $ROOMINFO;
					#else #showme No room information set via GMCP yet.;
					};
				};
			};
		#case "char"
			{
			#switch {"%2"}
				{
				#case "reset"
					{
					#showme Resetting GMCP Char.;
               #send {$IAC$SB${GMCP}Core.Supports.Remove [ "Char" ] $IAC$SE\};
               #send {$IAC$SB${GMCP}Core.Supports.Add [ "Char 1" ] $IAC$SE\};
					};
				#default
					{
					#var $ROOMCONTENTS;
					#showme Syntax: gmcp char reset;
					};
				};
			};
		#case "reset"
			{
			#switch {"%2"}
				{
				#case "yes"
					{
    				#send {$IAC$DO$GMCP\};
				   #send {$IAC$SB${GMCP}Core.Hello { "client": "$CLIENT_NAME", "version": "$CLIENT_VERSION" } $IAC$SE\};
				   #send {$IAC$SB${GMCP}Core.Supports.Remove [ "Comm.Channel", "Char", "Room", "Room.Chars" ] $IAC$SE\};
				   #send {$IAC$SB${GMCP}Core.Supports.Add [ "Comm.Channel 1", "Char 1", "Room 1", "Room.Chars 1" ] $IAC$SE\};
				   #send {$IAC$SB${GMCP}Core.Supports.Set [ "Comm.Channel 1", "Char 1", "Room 1", "Room.Chars 1" ] $IAC$SE\};
					};
				#default
					{
					#showme Use \'gmcp reset yes\' to confirm you'd like to reinitialize GMCP communication;
					};
				};
			};
		#case "debug"
			{
			#switch {"%2"}
				{
				#case "room"
					{
					#if {$DEBUGROOM == 1} {#var DEBUGROOM 0; #showme GMCP Room debugging disabled.;};
					#else {#var DEBUGROOM 1; #showme GMCP Room debugging enabled.;};
					};
				#case "vitals"
					{
					#if {$DEBUGVITALS == 1} {#var DEBUGVITALS 0; #showme GMCP Vitals debugging disabled.;};
					#else {#var DEBUGVITALS 1; #showme GMCP Vitals debugging enabled.;};
					};
				#case "channels"
					{
					#if {$DEBUGCHANNELS == 1} {#var DEBUGCHANNELS 0; #showme GMCP Channels debugging disabled.;};
					#else {#var DEBUGCHANNELS 1; #showme GMCP Channels debugging enabled.;};
					};
				#case "chars"
					{
					#if {$DEBUGCHARS == 1} {#var DEBUGCHARS 0; #showme GMCP Chars debugging disabled.;};
					#else {#var DEBUGCHARS 1; #showme GMCP Chars debugging enabled.;};
					};
				#case "statusvars"
					{
					#if {$DEBUGSTATUSVARS == 1} {#var DEBUGSTATUSVARS 0; #showme GMCP Char.StatusVars debugging disabled.;};
					#else {#var DEBUGSTATUSVARS 1; #showme GMCP Char.StatusVars debugging enabled.;};
					};
				#default #showme Valid options are room, statusvars, vitals, channels or chars.;
				};
			};
		#default #showme Valid arguments are: channels, debug, room\r\nDebug status: Channel[$DEBUGCHANNELS], Room[$DEBUGROOM], Vitals[$DEBUGVITALS] StatusVars[$DEBUGSTATUSVARS];
		};
};
 
#EVENT {IAC SB GMCP Room.Info IAC SE}
{
	#variable ROOMINFO {%0};
	#if {$DEBUGROOM == 1} #showme %1;
   dovitals;
}
 
#EVENT {IAC SB GMCP Room.Chars.Add IAC SE}
{
	#local found 0;
	#if {$DEBUGCHARS == 1} #showme %1;
	#local member {%0};
	#foreach $ROOMCONTENTS[%*] {a} {#if {$a[id] == $member[id]} #local found 1;};
	#if {$found != 1}
		{
		#if {$DEBUGCHARS == 1} #showme Adding member $member[id] to room contents.;
		#list ROOMCONTENTS add {{$member}};
		};
};
 
#EVENT {IAC SB GMCP Comm.Channel.Text IAC SE}
{
	#local output {%0};
	#if {$DEBUGCHANNELS == 1} #showme %1;
	#format {time} {%t} {%H:%M};
	commwindow $time $output[text];
};
 
#alias dovitals 
{
	#nop TODO make this better;
	#if {$THIRSTY == 1} {#local thirst Thirsty};
	#else {#local thirst {}};
	#if {$HUNGRY == 1} {#local hunger Hungry};
	#else {#local hunger {}};
	#local needs {};
	#format needs {%s%s} {$hunger } {$thirst};
	#format needs {%p} {$needs};
 
	#local tnls {};
	#if {"$XPTNL" != {}} #format tnls {%s} { $XPTNL xp};
	#if {"$TPTNL" != {}} #format tnls {%s%s} {$tnls}{ $TPTNL tp};
 
	#draw white unicode rounded box 1 80 10 150 {$VITALS[hp] hp, $VITALS[mp] v, $VITALS[mana] mana}{$VITALS[xp] xp, $VITALS[tp] tp, TNL:$tnls}{Session: $sessionxp xp, $sessiontp tp}{Carry: $VITALS[carrying]}{Room: $ROOMINFO[name]}{Area: $ROOMINFO[area]}{Env: $ROOMINFO[environment], $VITALS[light], $VITALS[weather] $VITALS[fog]}{$needs};
};
 
#EVENT {IAC WILL GMCP}
{
    #send {$IAC$DO$GMCP\};
    #send {$IAC$SB${GMCP}Core.Hello { "client": "$CLIENT_NAME", "version": "$CLIENT_VERSION" } $IAC$SE\};
    #send {$IAC$SB${GMCP}Core.Supports.Set [ "Comm.Channel 1", "Char 1", "Room 1", "Room.Chars 1" ] $IAC$SE\};
};
 
#ACTION {^{Last login|Reconnecting.$}} { gmcp channels reset; };
 
#class gmcp close;
  • tin/mume.tin.txt
  • Last modified: 2022-09-12 16:13
  • by Admin