TinTin++ Mud Client Scripts  
Get TinTin++ Mud Client at SourceForge.net. Fast, secure and Free Open Source software downloads
space
space
This holds an alias that will print some items you have identified and stored in the correct format in your script file. Three example items are given, the itemfind alias allows you to display items based on their name (case senative) for example: itemfind dagger. The itemstat alias allows you to display items based on their stats, for example: itemstat str > 0 && dam > 5. Itemstat is limited to 11 arguments, though this can be easily increased.

space
#nop This script is written for v1.99.7 and higher

#class itemlist open

#variable {itemlist}
{
	{blue dagger} {{dice}{10}{str}{2}{hp}{10}}
	{green hat}   {{ac}{4}{con}{2}{wis}{2}}
	{leather cap} {{ac}{8}{con}{1}{str}{1}}
}

#class itemlist close


#nop Add items as following:

#var itemlist[red rose] {{ac}{1}{int}{2}}


#alias {saveitemlist}
{
	#class itemlist write itemlist.tin
}

#alias {readitemlist}
{
	#class itemlist read itemlist.tin
}


#nop Give the average of a dice, for example: dice 4d7

#alias {dice}
{
	#regexp {%0} {%dd%d}
	{
		#math result &1 + (&1 * &2 - &1) / 2.0;
	}
	{
		#math result 0
	};
	#showme Average of dice %0 is $result.
}


#nop List items with matching names, for example: itemlist dagger

#alias {itemfind}
{
	#echo {<ffb>%h} {};

	#foreach {$itemlist[]} {name}
	{
		#regexp {$name} {%0}
		{
			itemshow $name
		}
	};
	#echo {<ffb>%h} {}
}


#nop List items with matching stats, for example: itemstat str > 0 && dam > 3

#alias {itemstat}
{
	#echo {<ffb>%h} { ITEM LIST };

	#foreach {$itemlist[]} {item}
	{
		#math check 0;

		#if {"%1" != ""}
		{
			#math check $itemlist[$item][%1] %2 %3;

			#if {"%4" != ""}
			{
				#math check $check %4 $itemlist[$item][%5] %6 %7;

				#if {"%8" != ""}
				{
					#math check $check %8 $itemlist[$item][%9] %10 %11;
				}
			}
		};

		#if {$check}
		{
			itemshow $item
		}
	};
	#echo {<ffb>%h} {}
}

#alias {itemshow}
{
	#var tmp {};
	#foreach {$itemlist[%0][]} {item}
	{
		#format tmp {%s %+8s} {$tmp} {$item $itemlist[%0][$item]}
	};
	#echo {<128>%+30s<178>: %s} {%0} {$tmp}
}