You need to manually track your sprites frame, like with an array. Say you had 256 characters, I'd dimension an array like : DIM Dude_frame(256).
Then, inside your function you can check the frame number array, add one to it, change it however you like, then assign the currect frame to the sprite.
However...
Using a function to do that is pretty strange (and slow), you'd be better off using a subroutine to handle your sprites animation and positioning, like:
Update_Dudes:
For n=0 to 256
dude_frame(n)=dude_frame(n)+1
if dude_frame(n)=9 then dude_frame(n)=2
sprite n+100,dude_x(n),dude_y(n),dude_frame(n)
Next n
Return
Note the dude_x and dude_y arrays, basically these make life easier, always try to keep track of positions through arrays or types, especially with an RTS which relies on this data heavily for the AI.
Also - Telling you this for your own good, drop the sprites idea and go 3D. A while ago I was experimenting with a 2D engine, and was able to go from 40 characters on screen to about 300 by replacing the paste image/sprites with 3D plains, which you texture with the relevant image. This method is packed with benefits, like not having to worry so much about z-depth problems, being able to ghost objects to make cool particle effects, and you'd be able to run your game at whatever resolution you liked without having to code around user resolution problems.
Van-B

The nature of Monkey was irrepressible!.