alarm = os.setAlarm(17)
os.setAlarm, starts an alarm that will trigger an event when the time (the minecraft time) reaches the one you give it as a parameter (in the example above, the 17).
Now we need to catch that event, so we use os.pullEvent:
local evt, arg = os.pullEvent("alarm") -- wait for the alarm to trigger
os.pullEvent gets the next event in the queue. There's different events that can be queued, like when you press a key it queues a "key" event, when there's a change in redstone a "redstone" event is queued, etc.
Events also have some parameters, like the key code in case of a "key" event, so we need to store them to use them, that's what the "local evt, arg =" part is, it gets the event type and the first argument/parameter and stores them in those variables.
Using "os.pullEvent("alarm")" we make sure that the event we receive is an "alarm" event, so we don't need to check that. The only thing left is to check if the alarm is the one we set before:
if arg == alarm then -- check if it's our alarm
the argument of the alarm event is the value returned by os.setAlarm, so we compare with that to see if it's our alarm.
Ok, I'm not really good explaining things, so I hope you understand all that :P/>/>. If you have any other question, just ask, we'll try to help you.