-
Notifications
You must be signed in to change notification settings - Fork 37
Getting Started obsolete
SilverIce edited this page Jan 7, 2015
·
1 revision
- Install SKSE
- Install JContainers.
- 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 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:
- Create a new JMap container and store its identifier in the variable
playerData. - Get a
Formobject that you want to store. - Store that
FormintoplayerDatawith the key "actor". - Store an integer into
playerDatawith the key "level". - Write out your
JMapto file in .../my games\skyrim\JCUser\ so that it can be accessed the next time the game starts.
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 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:
- Get a
Formyou want to store - Store that
FormintoJDB - Store an integer into
JDB. The last parameter, which is settruehere, is necessary when you're adding new values. It tellsJDBto create the path".JDBTest.level"if it doesn't already exist. - Write out the contents of
JDBto file.
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.
Sign into GitHub and press Edit at the top to add any missing information or fix typos and errors. Thanks!