set .@reward,671,1;
The problem your mapserv described is a simple bad setting of the .@reward variable. It gives error because it doesn't expect a second argument (,1) on that command.
Are you trying to set a variable or an array? Because later on you read .@reward as an array .
In that case, an array is set like
setarray .@reward[0],1;
Where [0] is the position and 1 the value and so on.
It seems the array is used like this in your script : Item id, amount so try this
setarray .@reward[0],671,1;