Just use $itemid, it's exported when EVENT_DISCOVER_ITEM gets called.
http://code.google.com/p/projecteqem.../embparser.cpp will tell you what gets exported for each event.
Set up something like
Code:
$linkid=quest::varlink($itemid);
if you want to have it spit out a link for the item, then throw that variable into the shout.