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
#variable {itemlist}
{
        {blue dagger} {{dice}{10}{str}{2}{hp}{10}{slot}{wield}}
        {green hat}   {{ac}{4}{con}{2}{wis}{2}{slot}{head}}    
        {leather cap} {{ac}{8}{con}{1}{str}{1}{slot}{head}}
}

#nop Add items as following:

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

#alias {saveitemlist}
{
        #system echo -n "" > items.tin;

        #foreach $itemlist[] item
        {
                #system echo "#var itemlist[$item] {$itemlist[$item]}" >> items.tin
        }
}

#alias {readitemlist}
{
        #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}
        {
                #regex {$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 @itemcheck{{$item}{%1}{%2}{%3}};

                        #if {"%4" != ""}
                        {
                                #math check $check %4 @itemcheck{{$item}{%5}{%6}{%7}};

                                #if {"%8" != ""}
                                {
                                        #math check $check %8 @itemcheck{{$item}{%9}{%10}{%11}}
                                }
                        }
                };

                #if {$check}
                {
                        itemshow $item
                }
        };
        #echo {<ffb>%h} {}
}
 
#function {itemcheck}
{
        #regex {$itemlist[%1][%2]} {^%d$}
        {
                #math result $itemlist[%1][%2] %3 %4
        };
        #else
        {
                #math result "$itemlist[%1][%2]" %3 "%4"
        }
}
 
#alias {itemshow}
{
        #var tmp {};
        #foreach {$itemlist[%0][]} {item}
        {
                #format tmp {%s %+8s} {$tmp} {$item $itemlist[%0][$item]}
        };
        #echo {<128>%+30s<178>: %s} {%0} {$tmp}
}