The easy way to set @ERROR to any value is:
 Code:
$=Execute("Exit ErrorValueHere")


Here is a very useful script I keep to hand to search for error codes that I might want to use in my own functions:
 Code:
BREAK ON
"Enter a string to search the error messages for:" 
Gets $a
for $i = 0 to 9999
 $=Execute("Exit "+$i)
 If InStr(@SERROR,$a) @ERROR " " @SERROR ? Endif
next