Event movement and turning

so i was trying my hand on scripting (noob alert) and i did this

if ($game_map.events[1].x == 8 &&
$game_map.events[1].y == 5)
move_route = RPG::MoveRoute.new
move_route.repeat = false
m = RPG::MoveCommand.new
m.code = 11
m.parameters = ["Wait"]
move_route.list.insert(0,m.clone)
$game_map.events[1].force_move_route(
move_route)
$game_map.events[1].set_direction(2) end

i want to the event to move away from the player when interacted with at a specific position on the map, and while everything works, the last line of turning the event to change its direction to down somehow doesn't.

P.S why is the script box only limited to 11 lines, what if i need a script that spans more than that
'Scripts' is where people who have written a complete script that they want to share with others can post them.

Moved to: Learning Ruby and RGSSx
P.S why is the script box only limited to 11 lines, what if i need a script that spans more than that
place the script in the script editor (requires correct headers etc) and just call it as a function from the script box.

Original thread: https://forums.rpgmakerweb.com/threads/event-movement-and-turning.114662/