There are three tutes that will help you:
macguba's guide to mission editing for beginners
Johan Gustafsson's editing guide
snYpir's friendly intro to code snippets
Johan Gustafsson's scripting guide
You can use lines of script (or code) in triggers, waypoints and init fields. However a "script" is a seperate file which you create in Notepad or some other text editor. You need a line of code in a trigger or waypoint to make the script start when you want it to.
The scripted waypoint is a special waypoint: use the forum search function, there is a very good thread on. But read this tutes first.