TinTin++ Mud Client Manual
Case
space
Syntax: #case {conditional} {arguments}
space
The case command must be used within the switch command. When the conditional argument of the case command matches the conditional argument of the switch command the body of the case is executed.
space
When comparing strings both the switch and case arguments must be surrounded in quotes.
space
Example:
#function {bar_color}
{
	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 ;
		#case 10 #return 
	}
}
space
If the max health is 100 and the current health is 44 you would use @bar_color{44;100} which would return <fea>
space
Example:
#function {reverse_direction}
{
     #switch {"%1"}
     {
          #case {"north"} {#return south};
          #case {"east"}  {#return west};
          #case {"south"} {#return north};
          #case {"west"}  {#return east};
          #case {"up"}    {#return down};
          #case {"down"}  {#return up}
     }
}
space
This function returns the reverse direction. @reverse_direction{north} would return south.
space
See also: Default, Else, Elseif, If, Switch and Regex.
space