Display new mod version to user

Post » Thu Jun 21, 2012 2:26 pm

Does anyone have suggestions on how to track a mod version so when it is upgraded, I can display a message to the user?

I found I can easily get notification the fist time my mod is activated by using a Quest Stage with the "Start Up Stage" checkbox checked, but I don't get this notification when upgrading.

I've tried every combination I can think of...
1. Using a global variable to track the version number
2. Checking the version number in the stage Condition
Extending the Quest script.
1. The OnInit seems to only fire the first time the mod is activated.
2. The OnLoad doesn't ever seem to fire

Thanks for any pointers!
User avatar
Siidney
 
Posts: 3378
Joined: Fri Mar 23, 2007 11:54 pm

Post » Thu Jun 21, 2012 9:37 am

I know FOSE had version detection commands, so I would assume that SKSE does as well. Though I don't know what they are, or if you're using SKSE. :shrug:
User avatar
Annick Charron
 
Posts: 3367
Joined: Fri Dec 29, 2006 3:03 pm

Post » Thu Jun 21, 2012 2:35 pm

The 1.6 patch is going to add a new "player game loaded" event that should make this easier. Right now you need hacks like having an upgrade quest that checks a "current version" property in another quest or global, or have code that checks your version number property/variable every few seconds via registerforupdate calls.
User avatar
Laura
 
Posts: 3456
Joined: Sun Sep 10, 2006 7:11 am

Post » Thu Jun 21, 2012 10:41 am

Alexander thanks for the response. I'm not using SKSE and really don't want to have that dependency on my mod, unless I absolutely have to.

Dreamking, that "Player Game Loaded" event will be great! I didn't realize that was coming! The thing is, I don't see how it will help me solve this problem?

>Right now you need hacks like having an upgrade quest that checks a "current version" property in another quest or global, or have code that checks your version number property
>/variable every few seconds via registerforupdate calls.

What is the solution using a quest and global variable? I want to use the quset because I like the notification it gives... so that's not a problem. (I haven't seen anything in Papyrus to give that type of notification, am I missing something there?)

My problem when using the quest is that it doesn't fire after the first time the mod is loaded, so I never get an event to check a global. Any insight/suggestions there?

Thanks!
User avatar
Charity Hughes
 
Posts: 3408
Joined: Sat Mar 17, 2007 3:22 pm

Post » Thu Jun 21, 2012 7:35 am

Well, what I do now--and I make no claim that this is best practice--is that in a quest that is constantly running, I have a property that holds the version of the mod. Each time I update my mod, I increment the default value of that property; e.g.,

Int Property iModVersionNum = 12 Auto

Then I have a second quest to do upgrades. That quest is run once, start game enabled. Attached to that quest is a script, and in the script's OnInit event I check the version property in the first quest. If the mod is not the current version, I do whatever upgrades are required, update the version property to the latest version, and then stop the upgrade quest. (This is where you could put a message.) Each time I release a new version of the mod, I copy that upgrade quest and delete the old copy--so there is always a new version of the upgrade quest that is run only the first time the upgraded mod is installed.

The game loaded event will help in that I won't need to keep deleting old upgrade quests and adding new copies in order for them to trigger when an upgrade is first installed--I should be able to just check on game loaded whether the version number property is set to the current version.
User avatar
*Chloe*
 
Posts: 3538
Joined: Fri Jul 07, 2006 4:34 am

Post » Thu Jun 21, 2012 2:07 pm

Well, what I do now--and I make no claim that this is best practice--is that in a quest that is constantly running, I have a property that holds the version of the mod. Each time I update my mod, I increment the default value of that property; e.g.,

Int Property iModVersionNum = 12 Auto

Then I have a second quest to do upgrades. That quest is run once, start game enabled. Attached to that quest is a script, and in the script's OnInit event I check the version property in the first quest. If the mod is not the current version, I do whatever upgrades are required, update the version property to the latest version, and then stop the upgrade quest. (This is where you could put a message.) Each time I release a new version of the mod, I copy that upgrade quest and delete the old copy--so there is always a new version of the upgrade quest that is run only the first time the upgraded mod is installed.

The game loaded event will help in that I won't need to keep deleting old upgrade quests and adding new copies in order for them to trigger when an upgrade is first installed--I should be able to just check on game loaded whether the version number property is set to the current version.

Ahh, now I get you!! Yes, I understand why you said you wouldn't need a hack. I already had two different quests in my mod, but until now, I didn't realise that the one I used for initializing the variables was only being called once! I thought the OnInit() meant every time it loaded. I should have known, given the other problems I had with my carriages and horses not working after the user loaded a save game. I couldn't believe that Bethesda didn't give any notification. Oh well... okay, now this makes sense. Yeah, I too am looking forward to 1.6 even more! (I was pretty excited it will fix the navmesh bug, but now this! ;))

Thanks DreamKing.
User avatar
bonita mathews
 
Posts: 3405
Joined: Sun Aug 06, 2006 5:04 am

Post » Thu Jun 21, 2012 10:14 am

So far, I've used two setups for this sort of thing and both have worked well.

With 1.6+: All event based, so no polling necessary
Spoiler
ScriptName YourQuestScript extends QuestFloat fVersionEvent OnInit()	Maintenance() ; OnPlayerLoadGame will not fire the first timeEndEventFunction Maintenance()	If fVersion < 1.01 ; <--- Edit this value when updating		fVersion = 1.01 ; and this		Debug.Notification("Now running YourModName version: " + fVersion)		;Update Code	EndIf	;Other maintenance code that only needs to run once per save loadEndFunction
ScriptName YourPlayerAliasScript extends ReferenceAliasYourQuestScript Property QuestScript AutoEvent OnPlayerLoadGame()	QuestScript.Maintenance()EndEvent

Not using 1.6+: Has to poll, but will work reliably
Spoiler
ScriptName YourQuestScript extends QuestFloat fVersionActor Property ActorFromYourMod AutoEvent OnInit()	RegisterForUpdate(10)EndEventEvent OnUpdate()	If bGetGameLoaded(ActorFromYourMod, "BrainCondition")		If fVersion < 1.01			fVersion = 1.01                	Debug.Notification("Now running YourModName version: " + fVersion)			;Update Code		EndIf		;Maintenance code	EndIfEndEventBool Function bGetGameLoaded(Actor akActor, String asActorValuehttp://forums.bethsoft.com/topic/1377683-display-new-mod-version-to-user/= "")	If akActor.GetActorValue(asActorValue)		akActor.SetActorValue(asActorValue, 0)		Return True	Else		Return False	EndIfEndFunction
User avatar
Lucie H
 
Posts: 3276
Joined: Tue Mar 13, 2007 11:46 pm

Post » Thu Jun 21, 2012 2:22 pm

So far, I've used two setups for this sort of thing and both have worked well.

Would you stop giving out these pearls one at a time and only when helping people with a specific problem, please? Take a break from modding for a week and build up a wiki with all of your snippets.

Now.

Thanks! :nod:
User avatar
El Goose
 
Posts: 3368
Joined: Sun Dec 02, 2007 12:02 am

Post » Thu Jun 21, 2012 3:55 pm

Guess I could add those to the complete example scripts page. *http://www.creationkit.com/Complete_Example_Scripts#Maintenance.2Fupdate_code_which_runs_once_per_save_load_and_shows_a_message_when_a_mod_is_updated_or_first_loaded*
User avatar
Laura Richards
 
Posts: 3468
Joined: Mon Aug 28, 2006 4:42 am

Post » Thu Jun 21, 2012 2:32 pm

Guess I could add those to the complete example scripts page. *http://www.creationkit.com/Complete_Example_Scripts#Maintenance.2Fupdate_code_which_runs_once_per_save_load_and_shows_a_message_when_a_mod_is_updated_or_first_loaded*

Yes! This one is a great addition. But what others are there, lurking in the multi-hued, mood-lit shadows? Stop holding out on us. :ermm:

*snicker*

TBH I forgot all about that page. The Wiki to me is just a reference. I come here for the real info and inspiration. And to hassle you. :tongue:
User avatar
Ludivine Poussineau
 
Posts: 3353
Joined: Fri Mar 30, 2007 2:49 pm


Return to V - Skyrim