I got stickied too. :)
Yes - by cloaking you will serve robots and 'normal users' a different version of each page (i.e. the page you serve to robots should contain no affiliate links). The cloaking can be done by 'ip range' or useragent either using .htaccess or from within your actual php/perl code.
It should be noted that cloaking is possibly overkill in this situation. A safer solution (and the one I would recommend) is to use a combination of robots.txt and 301 redirects. For example, replace all your affiliate links with links of the form [yourdomain.com...] where 'x' identifies the affiliate link. Your out.php script should then do the mapping from 'id' to affiliate URL and then perform a 301 redirect to this URL. All you need to do then is exclude out.php in robots.txt.
Hope this helps.