I would give you a hook straight into the internal data for it, except mafia's actually not sensitive at all, and it will return TRUE provided some suffix portion of whatever you give it matches an item name. For example, if you gave it "hello my name is cherry pie", it would tell you TRUE in later builds which have cherry pie, because it knows there's an item ID for cherry pie, and that long old string might have been a plural. Instead:
boolean is_valid_item_name( string substring )
{
for id from 1 to 2010
if ( contains_text( item_to_string( int_to_item( id ) ), substring ) )
return true;
return false;
}
Edit: Although I guess I could use the other internal method which is actually used when you do an item name lookup for things entered via the CLI (which is what the ASH uses, which is slightly different from what the rest of mafia uses, and which might result in equally strange things happening, for example "$item[200 668 scroll]" would give you the item representing 668 scrolls, whether or not you wanted it that way). What's the code you want to use look like?