* Fixes #3612. * Separated the countitem-type script commands into their own functions. * Created a global count function to be used between them. Thanks to @kisuka, @Normynator and @Atemo!