Wiki

Clone wiki

xjdhdr-random-code / Plugin-Resources:-Version-Control

What is version control?

  • Version control is a set of records in Plugin Resources (PR) that are all centered around the global variable XJPRaVersionVar. This system allows modders to query the variable to check what version a mod user is running and then take an action based on what the value of that variable is.

What records are used for version control?

  • Global Variables: XJPRaVersionVar
  • Quests: zzzzXJPRVersionQuest and zzzzXJPRVersionQuestRunningQuest
  • Scripts: zzzzXJPRVersionFunction, zzzzXJPRVersionScript and zzzzXJPRVersionQuestRunningScript

What are those scripts and quests for?

  • When a person starts a new game in Oblivion, global variables are set to the values defined by your mod load order. In PR's case, it's value will be set to whatever version of the mod the user has installed at the time. When the player saves their game, the value of those global variables are stored in the save game. These values do not change if the mod user installs a different version of the mod that has a different value set for that global variable then loads that save.
  • The purpose of those scripts and quests is to change the value of the global variable to be equal to the version of PR that is currently installed. Unlike global variables, scripts are not attached to a save game and so do get updated with new version of a mod. Before every release, I will update the scripts to set that variable to whatever version I am about to release.

I am a modder. How can I use version control in my mod?

  • Just query the value of the XJPRaVersionVar. It is a float variable that is equal to whatever version of PR the mod user has installed. For example, if the mod user has PR v1.001 installed, the variable will be equal to "1.001". The exception to this is version 1.000 where this global variable is equal to 0.0 but there is really no need to test if the player has this specific version installed. The obvious place to use this would be a script. Here is an example snippet of code:
    ; This code will test if Plugin Resources is older than v1.001
    If XJPRaVersionVar < 1.001
       ; Plugin Resources is too old
       ; Do something
    EndIf
    
  • This can be used in a quest stage or dialogue script as well. I recommend that you use a greater than or less than test rather than testing if the version is equal or not equal to a specific number. You could also use this variable in other places such as a dialogue topic, AI package, etc.

Can't I just use the GetPluginVersion function to find this info?

  • Possibly, use whichever method works for you.

How can I find out what version of PR I require?

  • First, I don't plan to release any updates that will create compatibility problems so there is no need to test if the version number is equal to a specific number or within a specific range. Besides that, there is a version number next to every blank record. Just figure out what record you are using that has the highest version number and you can just use that.

I am a mod user. What does all of this mean for me?

  • Not much really. Just try to ensure that you are always running the latest version of PR. There is no reason to stick with an older version. If you fail to keep PR updated, you might see a message from a mod which will ask you to update.

Can I modify any record associated with version control in my mod?

  • No

Can I release a modified version of PR?

  • Not without my permission, which will most likely not be granted.

Can I use my scripts to change the value of the XJPRaVersionVar variable?

  • No, that variable must remain set to the value I set. Besides, there is no point in modifying that variable as my scripts will reset it back to the correct value.

But that variable is reporting the wrong version!

  • I do check this stuff before I release a new version. However, if a mistake does creep in, please report it or any other bug you notice to me and I will fix it.

I have a suggestion that will improve your version control.

  • Excellent! If you have any suggestions or requests, please do send me a message.

Updated