use this:
[rgss]
var = 0 # declares a new local variable, to hold how many times the player has moved right
loop do # begins a loop
$game_player.move_right # moves the player
var += 1 # adds one to our movement variable
break if var >= 4 # stop looping if player has moved 4 times
end # where loop repeats from
[/rgss]
Mess around with that and see what happens.