Skip to content

Getting Started obsolete

SilverIce edited this page Jan 7, 2015 · 1 revision

JContainers Set-up

  1. Install SKSE
  2. Install JContainers.
  3. Now go into your Papyrus script where you'd like to store some information and try one of these examples. In each example we store both an actor and his level using various data structures included in JContainers:
JMap Quick Start

JMap stores information in {key, value} pairs.

int playerData = JMap.object()  
Form myForm = Game.GetForm(0x000F8117)
JMap.setForm(playerData, "actor", myForm) 
JMap.setInt(playerData, "level", 47)
JValue.writeToFile(playerData, JContainers.userDirectory() + "testMap.json")

Each line above:

  1. Create a new JMap container and store its identifier in the variable playerData.
  2. Get a Form object that you want to store.
  3. Store that Form into playerData with the key "actor".
  4. Store an integer into playerData with the key "level".
  5. Write out your JMap to file in .../my games\skyrim\JCUser\ so that it can be accessed the next time the game starts.
JFormMap Quick Start

JFormMap is the same as JMap, but the keys are Form objects rather than strings.

int playerData = JFormMap.object()
JFormMap.setInt(playerData, Game.GetForm(0x000F8117), 47)
JValue.writeToFile(playerData, JContainers.userDirectory() + "testFormMap.json")
JDB Quick Start

JDB is a global version of JMap. There is only one JDB, so you can access the same values from anywhere in any script.

Form myForm = Game.GetForm(0x000F8117)
JDB.solveFormSetter(".JDBTest.actor", myForm, true)
JDB.solveIntSetter(".JDBTest.level", 47, true)
JDB.writeToFile(JContainers.userDirectory() + "JDBTest.json")

Each line above:

  1. Get a Form you want to store
  2. Store that Form into JDB
  3. Store an integer into JDB. The last parameter, which is set true here, is necessary when you're adding new values. It tells JDB to create the path ".JDBTest.level" if it doesn't already exist.
  4. Write out the contents of JDB to file.
JFormDB Quick Start

JFormDB is a global version of JFormMap that can be accessed in any script without reading from file again.

JFormDB.setInt(Game.GetForm(0x000F8117), ".JFormDBTest.level", 47)
JDB.writeToFile(JContainers.userDirectory() + "JFormDBTest.json")

For more information on JMap, JFormMap, JDB, JFormDB, and other containers, see Container Types.

Clone this wiki locally