zepperik Posted September 18, 2018 Share Posted September 18, 2018 I created my first very basic script, and I have been struggling to figure out what to do it now that its written and compiled... ScriptName TimerTest extends Quest Event OnInit() RegisterForSingleUpdate(10) EndEvent Event OnUpdate() Debug.MessageBox("yep") RegisterForSingleUpdate(10) EndEvent Really, really basic. Every ten seconds show the word "yep". But every tutorial on CreationKit shows attaching script to a specific object, which I guess makes sense for most modding. But I just want my script to run when I start playing. I ultimately want to use PapyusUtil to constantly write a json file with the player's location. What do I attach basic, universal, repeating task to? There's a similar basic global script here: https://www.creationkit.com/index.php?title=Complete_Example_Scripts#Maintenance.2Fupdate_code_which_runs_once_per_save_load_and_shows_a_message_when_a_mod_is_updated_or_first_loaded...print a message whenever a mod is loaded. But it doesn't say what to do with the script. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 18, 2018 Share Posted September 18, 2018 You made your script extend quest. Therefore you want to attach it to a quest. Since you want it to start running when you start playing, you will need to set that quest to 'start game enabled'. Link to comment Share on other sites More sharing options...
zepperik Posted September 18, 2018 Author Share Posted September 18, 2018 (edited) You made your script extend quest. Therefore you want to attach it to a quest. Since you want it to start running when you start playing, you will need to set that quest to 'start game enabled'.Thanks, IsharaMeradin! I just picked quest because it didn't seem extending any object other than the Player was appropriate and I heard to avoid that. If there's a better thing to extend, I'll take it. Can I just make a new empty quest that has no goals and never completes and attach the script to that (with 'start game enabled')? I've only ever coded regular software so I'm not used to having to setup dummy items to just print a message. Edited September 18, 2018 by zepperik Link to comment Share on other sites More sharing options...
IsharaMeradin Posted September 18, 2018 Share Posted September 18, 2018 That's the way to do it. Create a new quest, flag it as start game enabled and add your script. Nothing else need to be done. One thing to note, the script will run the first time the mod is loaded. If you make changes after that, they won't take. You'll have to test such changes on a new game. Link to comment Share on other sites More sharing options...
Recommended Posts