Since this appears to be a tile script and you're experiencing freezing issues, make sure your script tile has a 'Var number' attached. As for the script itself, here are a few errors/ issues that I found:
if 0x0 goto @movement
release // The game automatically locks when you step on a script so you need to release the player
lock Not needed
applymovement 0x6 @m1
msgbox @t1 0x6
waitkeypress // Not needed as it is already included in msgbox type 0x6
msgbox @t2 0x6 // Should be @t4
showpokepic 0x188 0x0A 0x03 // Convert Ralts' ID into hexadecimal
givepokemon 0x188 0x5 0x0 0x0 0x0 0x0 // Convert Ralts' ID into hexadecimal
msgbox @t2 0x4
closeonkeypress // Not needed
msgbox @t3 0x5
compare 0x800D 0x1
if 0x1 call @name
setvar 0x4011 0x1
setflag 0x201 // Unnecessary, you're already setting flag 0x828 so its unlikely you need to use this one as well. Just set OW 0x6's ID to 828 and they'll disappear for good
#org @m1 // The majority of these movements don't make any sense in either FR or Emerald
= [blue_fr]It is dangerous out there without\la Pok\h1Bmon! Good thing I have an\lextra to spare. Here take this\l[red_fr]Ralts[blue_fr].
= [blue_fr][player] recieved a [red_fr]Ralts[blue_fr]!
= [blue_fr]Would you like to name that\n[red_fr]Ralts[blue_fr]?
While the above script should work for what you want to do right now, you should consider running the script based upon a variable rather than a flag. Tile scripts that check for flags instead of variables have issues such as interrupting the town/ route name in the top-left corner if they're near the entrance of a map and grinding the player's speed down to zero (this is very noticeable when you're at full speed on a bike). You'll avoid those glitches and even be able to remove the '@start' segment of your script, saving you more space. Check out this thread if you want to learn more about how to have scripts activate based upon a variable~