How to create a start-game enabled Quest and attach a script that just runs...
I'm sure you've seen this in many mods for FO3 (and in all probability Oblivion, but I've never played that so I'll stick to referencing fo3/geck). Ok. In the Geck, to have a script that just runs and does stuff, we created a Quest, checked the Start Game Enabled Box and attached a script.
A script might look something like:
scriptname myScriptbegin GameModeshowmessage myAwesomeMessageend
But, as I'm sure many have discovered, things are just a little bit different in the CK...
Now, all this might be totally inefficient coding and go about things the wrong way (or not, I don't know at this stage). But the resulting script compiles without error and does what I wanted it to do. So, bear with me. Here we go...
So, in the CK, we create a new Quest:
- In the Object Window, open the Character node (the "+" symbol) and click on Quest.
- Right-Click in the right-hand pane, and select New.
- This will open the Quest window.
- Click in the ID box and give it an ID. For eg, aaTestQuest.
- Do the same in the Quest Name box.
- Ensure the Start Game Enabled box is ticked.
- This Quest will now start when you start the game.
- Hit OK to close the Quest window. Then reopen the Quest by double clicking it in the Object Window. If we don't do this now, we'll crash the CK later on after creating our script. Which is baaad... !
- Click the "Scripts" button/tab.
- Click Add.
- After a brief pause a new window will pop up. Double click on [New Script].
- An Add New Script window will pop up.
- Give the script a name. For eg, aaTestQuestScript and hit OK.
- Now we need to edit the script.
- In our Scripts tab, we should now have an entry for the script we just created (aaTestQuestScript)
- Right click on that and select Edit Source.
- This brings up the Editing script window.
Scriptname aaTestQuestScript extends Quest
Since the Quest we've created this script with is Start Game enabled, the script will run straight away. But to get things going for real, we need some initilization:
EVENT onInit() registerForUpdate(3) gotoState ("stuff")endEVENT
onInit (http://www.creationkit.com/OnInit) is the Event called when the script has been created (and when "properties are initialized" - whatever that means... - for now, don't worry about it).
registerForUpdate (http://www.creationkit.com/RegisterForUpdate_-_Form) lets us declare how often we want the script to run (in seconds). registerForUpdate(3) then, means the script will run every 3 seconds.
gotoState http://www.creationkit.com/States_%28Papyrus%29 appears to be a form of "goto" command. The script, when it gets to this line, will goto the State as defined in the brackets.
So we need to make a state called "stuff" and put stuff in it.

STATE stuff EVENT onUpdate() Debug.MessageBox("Hello, World!") endEVENTendSTATE
So, here have a state called "stuff". Within that we have an onUpdate Event, which is executed as defined by our earlier registerForUpdate command. So, according to our script so far, every 3 seconds the code within EVENT onUpdate() will execute. http://www.creationkit.com/OnUpdate_%28Papyrus%29
Altogether, our code will look like this:
Scriptname aaTestQuestScript extends QuestEVENT onInit() ; This event will run once, when the script is initialized registerForUpdate(3) gotoState ("stuff")endEVENTSTATE stuff EVENT onUpdate() Debug.MessageBox("Hello, World!") endEVENTendSTATE
Which you'll see when you get in game displays "Hello, World!" in a message box.
- Anyway, from the Build menu of the Script Editor, select Compile (or hit Ctrl+f7).
- The script compiles without error.
- Goto the File menu and select Save (or hit Ctrl+S).
- Close the Script Editor (File>Exit or hit the top-right corner close button).
- Then hit OK on the Quest window.
- From the Creation Kit menu, do File>Save.
- Give the file a name "myAwesomeTestMod" or something, and hit Save.
Close the Creation Kit.- Then, Launch Skyrim.
- Click Data Files in the Launcher and ensure "myAwesomeTestMod" (or whatever you called) has a tick next to it, and hit OK.
- Click Play to launch the game.
This will continue until you quit the game, so do that before it drives you mad (hit Ok then press Escape before it pops up again).

And we're done.
Hopefully, that made some kind of sense. But don't take this as written in stone. There may be other (better) ways to achieve the same thing. But at least it's a start.
~Xeph'