Or better yet, everytime you gain a new item, it goes to an array like so:
$items.push(item_id) if not $items.include?(item_id)
That'll make sure that every item you've ever gained is in the array $items, which can be accessed by the encyclopedia to tell if you've ever gained it.