Adding Scripts

Hello Please help! I am trying to make a pacman game in Mz and I found a script:

class Game_Player < Game_Character
attr_accessor :lock

def update_scroll(last_real_x, last_real_y)
if $lock!=1
ax1 = $game_map.adjust_x(last_real_x)
ay2 = $game_map.adjust_y(last_real_y)
ax2 = $game_map.adjust_x(@real_x)
ay2 = $game_map.adjust_y(@real_y)
$game_map.scroll_down (ay2 - ay1) if ay2 > ay1 && ay2 > center_y
$game_map.scroll_left (ax1 - ax2) if ax2 < ax1 && ax2 < center_x
$game_map.scroll_right (ax2 - ax1) if ax2 > ax1 && ax2 > center_x
$game_map.scroll_up (ay1 - ay2) if ay2 > ay1 && ay2 > center_y
end
end
end

to move the character from the left side to the right side of the screen just have no idea how to add it!

Thanks!
If you're making something like the original Pacman games where you have specific entry points, you don't need a script. You can simply use event transfers set to player touch and select "none" for fade.
Also, that is not JavaScript. Scripts for earlier editors before MV are in Ruby, and can't be used in MV or MZ.

Any time you come across something, such as in a forum thread, you should see what maker it's written for. Failing that, anything calling itself a "script" is probably wrong, as in MV/MZ they're called plugins.

(You will see references to "a script call," but that will be a single code statement, not multiple lines)
Thanks! i changed the trigger to : player touch and not it works. Problem is I dont know how to turn the enemies into kill-able once u eat a certain object.
Problem is I dont know how to turn the enemies into kill-able once u eat a certain object.
basically give them multiple pages, one where they are attackign and one where they are running and killable. Control the second page by a switch, and have your item turn on the switch and a timer to turn it off.

But I strongly suggest you go through several tutorials on eventing and how to use the maker before you continue. All the solutions mentioned to you so far are considered basic for the makers, and trying to make complex minigames before you have the basics down is always a bad idea.

Original thread: https://forums.rpgmakerweb.com/threads/adding-scripts.145372/