Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;/ Decompiled by Champollion V1.0.1
- Source : SHESON_DynDOLOD_Master.psc
- Modified : 2016-10-28 21:38:26
- Compiled : 2016-10-28 21:39:03
- User : Submit_
- Computer : Firstborn_
- /;
- scriptName SHESON_DynDOLOD_Master extends ObjectReference
- ;-- Properties --------------------------------------
- Int property MyCurrentMinionList = 0 auto
- ObjectReference property MyCurrentFirstborn auto
- Int property MyCurrentFirstbornList = 0 auto
- ;-- Variables ---------------------------------------
- Int Index = 0
- Bool MyCurrentAttach
- ObjectReference CurrentRef
- Int MyOldFirstbornList = 0
- Int MaxOld = 0
- Int ThrottleThreshold = 100
- String MyImportFileName = "None"
- Int ThrottleCount = 0
- Int MaxCurrent = 0
- String MyWorld = "None"
- ObjectReference MyOldFirstborn
- Int MyOldMinionList = 0
- Int MyCurrent = 0
- ;-- Functions ---------------------------------------
- ; Skipped compiler generated GotoState
- ; Skipped compiler generated GetState
- function IBowToTheev2(ObjectReference MyFirstborn, Int FirstbornList, Int MinionList, Bool MyAttach, Bool MyActivateAll)
- self.GotoState("Updating")
- utility.Wait(3 as Float)
- MyWorld = stringutil.Substring(self.GetWorldspace() as String, 13, stringutil.Find(self.GetWorldspace() as String, "(", 0) - 14)
- MyImportFileName = "DynDOLOD_" + jsonutil.GetStringValue("DynDOLOD_Worlds", MyWorld, MyWorld)
- if jsonutil.GetStringValue("DynDOLOD_Worlds", "bunchofnumbers", "x") != (game.GetFormFromFile(2320, "DynDOLOD.esp") as keyword).GetString()
- debug.Notification("DynDOLOD_Worlds.json" + " does not belong to this " + "DynDOLOD.esp")
- debug.Trace("DynDOLOD error: DynDOLOD_Worlds.json=" + jsonutil.GetStringValue("DynDOLOD_Worlds", "bunchofnumbers", "x") + " DynDOLOD.esp=" + (game.GetFormFromFile(2320, "DynDOLOD.esp") as keyword).GetString(), 0)
- storageutil.SetStringValue(none, "DynDOLOD_Last_Message", "DynDOLOD_Worlds.json" + " does not belong to this " + "DynDOLOD.esp")
- self.GotoState("Missing")
- elseIf !jsonutil.Load(MyImportFileName)
- debug.Notification(MyImportFileName + " file not found")
- storageutil.SetStringValue(none, "DynDOLOD_Last_Message", MyImportFileName + " file not found")
- self.GotoState("Missing")
- else
- MaxCurrent = jsonutil.IntListCount(MyImportFileName, "f" + FirstbornList as String)
- if MaxCurrent == 0
- debug.Notification("DynDOLOD missing data for cell id " + FirstbornList as String)
- storageutil.SetStringValue(none, "DynDOLOD_Last_Message", "Missing data for cell id " + FirstbornList as String)
- self.GotoState("EmptyState")
- utility.Wait(3 as Float)
- else
- MyImportFileName = "DynDOLOD_" + jsonutil.GetStringValue("DynDOLOD_Worlds", MyWorld, MyWorld) + "_Objects"
- if jsonutil.GetStringValue(MyImportFileName, "bunchofnumbers", "x") != (game.GetFormFromFile(2320, "DynDOLOD.esp") as keyword).GetString()
- self.GotoState("Missing")
- if jsonutil.GetStringValue(MyImportFileName, "bunchofnumbers", "x") == "x"
- debug.Notification("DynDOLOD can not read data from " + MyImportFileName + ".json")
- storageutil.SetStringValue(none, "DynDOLOD_Last_Message", "Can not read data from " + MyImportFileName + ".json")
- else
- debug.Notification(MyImportFileName + ".json does not belong to this " + "DynDOLOD.esp")
- debug.Trace("DynDOLOD error: " + MyImportFileName + ".json=" + jsonutil.GetStringValue(MyImportFileName, "bunchofnumbers", "x") + " DynDOLOD.esp=" + (game.GetFormFromFile(2320, "DynDOLOD.esp") as keyword).GetString(), 0)
- storageutil.SetStringValue(none, "DynDOLOD_Last_Message", MyImportFileName + ".json does not belong to this " + "DynDOLOD.esp")
- endIf
- else
- self.GotoState("Updating")
- Index = jsonutil.StringListCount(MyImportFileName, "reset")
- while Index
- Index -= 1
- CurrentRef = game.GetFormFromFile(stringutil.Substring(jsonutil.StringListGet(MyImportFileName, "reset", Index), stringutil.Find(jsonutil.StringListGet(MyImportFileName, "reset", Index), ";", 0) + 1, 0) as Int, stringutil.Substring(jsonutil.StringListGet(MyImportFileName, "reset", Index), 0, stringutil.Find(jsonutil.StringListGet(MyImportFileName, "reset", Index), ";", 0))) as ObjectReference
- if CurrentRef as Bool && !CurrentRef.IsDisabled()
- CurrentRef.reset(none)
- endIf
- endWhile
- CurrentRef = none
- MyImportFileName = "DynDOLOD_" + jsonutil.GetStringValue("DynDOLOD_Worlds", MyWorld, MyWorld)
- self.GotoState("Running")
- storageutil.SetIntValue(none, "DynDOLOD_Active", 1)
- self.IBowToTheev2(MyFirstborn, FirstbornList, MinionList, MyAttach, MyActivateAll)
- if MyWorld == "Tamriel" && game.GetModByName("Merged Stuff 15.esp") != 255
- leveleditem Notes = game.GetFormFromFile(36705, "Merged Stuff 15.esp") as leveleditem
- if Notes
- form MyNote = game.GetFormFromFile(2316, "DynDOLOD.esp")
- if MyNote
- Notes.AddForm(MyNote, 1, 1)
- MyNote = none
- endIf
- Notes = none
- endIf
- endIf
- debug.Notification("DynDOLOD successfully initialized")
- storageutil.SetStringValue(none, "DynDOLOD_Last_Message", "Successfully initialized")
- endIf
- endIf
- endIf
- endFunction
- ;-- State -------------------------------------------
- state Running
- function IBowToTheev2(ObjectReference MyFirstborn, Int FirstbornList, Int MinionList, Bool MyAttach, Bool MyActivateAll)
- self.GotoState("Updating")
- MyCurrentFirstborn = MyFirstborn
- MyCurrentAttach = MyAttach
- MyCurrentFirstbornList = FirstbornList
- MyCurrentMinionList = MinionList
- if MyImportFileName == "None"
- MyWorld = stringutil.Substring(self.GetWorldspace() as String, 13, stringutil.Find(self.GetWorldspace() as String, "(", 0) - 14)
- MyImportFileName = "DynDOLOD_" + jsonutil.GetStringValue("DynDOLOD_Worlds", MyWorld, MyWorld)
- endIf
- if MyCurrentAttach
- storageutil.SetFormValue(self as form, "DynDOLOD_MyActiveFirstborn", MyCurrentFirstborn as form)
- MyOldFirstborn = MyCurrentFirstborn
- if MyCurrentMinionList != MyOldMinionList || MyActivateAll
- if MyActivateAll
- self.Activate(self as ObjectReference, false)
- endIf
- MaxCurrent = jsonutil.IntListCount(MyImportFileName, "m" + MyCurrentMinionList as String)
- if MyOldMinionList as String != "None"
- MaxOld = jsonutil.IntListCount(MyImportFileName, "m" + MyOldMinionList as String)
- else
- MaxOld = 0
- endIf
- if MaxCurrent > MaxOld
- Index = MaxCurrent
- else
- Index = MaxOld
- endIf
- ThrottleCount = 0
- while Index
- Index -= 1
- if Index < MaxCurrent
- MyCurrent = jsonutil.IntListGet(MyImportFileName, "m" + MyCurrentMinionList as String, Index)
- CurrentRef = game.GetFormFromFile(MyCurrent, "DynDOLOD.esp") as ObjectReference
- if CurrentRef
- if MyActivateAll
- CurrentRef.Activate(self as ObjectReference, false)
- elseIf storageutil.GetIntValue(CurrentRef as form, "GridState", 0) == 0 && (!jsonutil.IntListHas(MyImportFileName, "m" + MyOldMinionList as String, MyCurrent) || MyOldMinionList == 0)
- storageutil.SetIntValue(CurrentRef as form, "GridState", 1)
- CurrentRef.Activate(self as ObjectReference, false)
- endIf
- endIf
- endIf
- if Index < MaxOld && !MyActivateAll
- MyCurrent = jsonutil.IntListGet(MyImportFileName, "m" + MyOldMinionList as String, Index)
- CurrentRef = game.GetFormFromFile(MyCurrent, "DynDOLOD.esp") as ObjectReference
- if CurrentRef
- if storageutil.GetIntValue(CurrentRef as form, "GridState", 0) > 0 && (!jsonutil.IntListHas(MyImportFileName, "m" + MyCurrentMinionList as String, MyCurrent) || MyCurrentMinionList == 0)
- storageutil.UnsetIntValue(CurrentRef as form, "GridState")
- storageutil.UnsetIntValue(CurrentRef as form, "CellState")
- CurrentRef.Activate(self as ObjectReference, false)
- ThrottleCount += 1
- endIf
- endIf
- endIf
- if ThrottleCount > ThrottleThreshold
- utility.Wait(1 as Float)
- ThrottleCount = 0
- endIf
- endWhile
- CurrentRef = none
- MyOldMinionList = MyCurrentMinionList
- endIf
- if MyCurrentFirstbornList != MyOldFirstbornList || MyActivateAll
- MaxCurrent = jsonutil.IntListCount(MyImportFileName, "f" + MyCurrentFirstbornList as String)
- if MyOldFirstbornList != 0
- MaxOld = jsonutil.IntListCount(MyImportFileName, "f" + MyOldFirstbornList as String)
- else
- MaxOld = 0
- endIf
- if MaxCurrent > MaxOld
- Index = MaxCurrent
- else
- Index = MaxOld
- endIf
- ThrottleCount = 0
- while Index
- Index -= 1
- if Index < MaxCurrent
- MyCurrent = jsonutil.IntListGet(MyImportFileName, "f" + MyCurrentFirstbornList as String, Index)
- CurrentRef = game.GetFormFromFile(MyCurrent, "DynDOLOD.esp") as ObjectReference
- if MyActivateAll
- CurrentRef.Activate(self as ObjectReference, false)
- elseIf CurrentRef
- if storageutil.GetIntValue(CurrentRef as form, "GridState", 0) == 0 && (!jsonutil.IntListHas(MyImportFileName, "f" + MyOldFirstbornList as String, MyCurrent) || MyOldFirstbornList == 0)
- storageutil.SetIntValue(CurrentRef as form, "GridState", 1)
- CurrentRef.Activate(self as ObjectReference, false)
- endIf
- endIf
- endIf
- if Index < MaxOld && !MyActivateAll
- MyCurrent = jsonutil.IntListGet(MyImportFileName, "f" + MyOldFirstbornList as String, Index)
- CurrentRef = game.GetFormFromFile(MyCurrent, "DynDOLOD.esp") as ObjectReference
- if CurrentRef
- if storageutil.GetIntValue(CurrentRef as form, "GridState", 0) > 0 && (!jsonutil.IntListHas(MyImportFileName, "f" + MyCurrentFirstbornList as String, MyCurrent) || MyCurrentFirstbornList == 0)
- storageutil.UnsetIntValue(CurrentRef as form, "GridState")
- storageutil.UnsetIntValue(CurrentRef as form, "CellState")
- CurrentRef.Activate(self as ObjectReference, false)
- ThrottleCount += 1
- endIf
- endIf
- endIf
- if ThrottleCount > ThrottleThreshold
- utility.Wait(1 as Float)
- ThrottleCount = 0
- endIf
- endWhile
- CurrentRef = none
- MyOldFirstbornList = MyCurrentFirstbornList
- endIf
- elseIf MyCurrentFirstborn == MyOldFirstborn
- storageutil.UnsetFormValue(self as form, "DynDOLOD_MyActiveFirstborn")
- Index = jsonutil.IntListCount(MyImportFileName, "m" + MyOldMinionList as String)
- ThrottleCount = 0
- while Index
- Index -= 1
- MyCurrent = jsonutil.IntListGet(MyImportFileName, "m" + MyOldMinionList as String, Index)
- CurrentRef = game.GetFormFromFile(MyCurrent, "DynDOLOD.esp") as ObjectReference
- if CurrentRef as Bool && storageutil.GetIntValue(CurrentRef as form, "GridState", 0) > 0
- storageutil.UnsetIntValue(CurrentRef as form, "GridState")
- storageutil.UnsetIntValue(CurrentRef as form, "CellState")
- CurrentRef.Activate(self as ObjectReference, false)
- ThrottleCount += 1
- endIf
- if ThrottleCount > ThrottleThreshold
- utility.Wait(1 as Float)
- ThrottleCount = 0
- endIf
- endWhile
- Index = jsonutil.IntListCount(MyImportFileName, "f" + MyOldFirstbornList as String)
- ThrottleCount = 0
- while Index
- Index -= 1
- MyCurrent = jsonutil.IntListGet(MyImportFileName, "f" + MyOldFirstbornList as String, Index)
- CurrentRef = game.GetFormFromFile(MyCurrent, "DynDOLOD.esp") as ObjectReference
- if CurrentRef as Bool && storageutil.GetIntValue(CurrentRef as form, "GridState", 0) > 0
- storageutil.UnsetIntValue(CurrentRef as form, "GridState")
- storageutil.UnsetIntValue(CurrentRef as form, "CellState")
- CurrentRef.Activate(self as ObjectReference, false)
- ThrottleCount += 1
- endIf
- if ThrottleCount > ThrottleThreshold
- utility.Wait(1 as Float)
- ThrottleCount = 0
- endIf
- endWhile
- MyOldFirstbornList = 0
- MyOldMinionList = 0
- MyOldFirstborn = none
- CurrentRef = none
- endIf
- self.GotoState("Running")
- endFunction
- endState
- ;-- State -------------------------------------------
- state Missing
- function IBowToTheev2(ObjectReference MyFirstborn, Int FirstbornList, Int MinionList, Bool MyAttach, Bool MyActivateAll)
- ; Empty function
- endFunction
- endState
- ;-- State -------------------------------------------
- state Updating
- function IBowToTheev2(ObjectReference MyFirstborn, Int FirstbornList, Int MinionList, Bool MyAttach, Bool MyActivateAll)
- if MyAttach
- storageutil.SetFormValue(self as form, "DynDOLOD_MyActiveFirstborn", MyFirstborn as form)
- else
- storageutil.UnsetFormValue(self as form, "DynDOLOD_MyActiveFirstborn")
- endIf
- endFunction
- endState
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement