Handle Replace3D in callback in trigger script

This commit is contained in:
2020-10-13 22:38:27 -04:00
parent fd89a8ee0d
commit 4c9ab4bef2
29 changed files with 19 additions and 21 deletions

View File

@@ -5,11 +5,11 @@ Quest Property BRQuest Auto
event OnMenuClose(string menuName)
if menuName == "ContainerMenu"
debug.Trace("Peddling container menu closed")
debug.Trace("BRMerchChestScript container menu closed")
BRQuestScript BRScript = BRQuest as BRQuestScript
int result = BRMerchandiseList.Create(BRScript.ApiUrl, BRScript.ApiKey, BRScript.ShopId, self)
if result == -2
Debug.Trace("No container changes to save to the server")
Debug.Trace("BRMerchChestScript no container changes to save to the server")
elseif result == -1
Debug.MessageBox("Failed to save shop merchandise. Please submit a bug on Nexus Mods with the contents of BazaarRealmPlugin.log and BazaarRealmClient.log usually located in C:\\Users\\<your user>\\Documents\\My Games\\Skyrim Special Edition\\SKSE.")
else
@@ -22,7 +22,7 @@ endEvent
event OnActivate(ObjectReference akActionRef)
if akActionRef == PlayerRef
debug.Trace("Peddling container was opened")
debug.Trace("BRMerchChestScript container was opened")
RegisterForMenu("ContainerMenu")
endif
endEvent

View File

@@ -16,12 +16,7 @@ Event OnActivate(ObjectReference akActionRef)
BRQuestScript BRScript = BRQuest as BRQuestScript
bool result = BRMerchandiseList.NextPage(BRScript.ApiUrl, BRScript.ApiKey, BRScript.MerchandiseListId, MerchantShelf, PlaceholderStatic, BRLinkMerchShelf, BRLinkMerchChest, BRLinkItemRef, BRLinkMerchToggle, BRLinkMerchNext, BRLinkMerchPrev)
debug.Trace("BRMerchandiseList.NextPage result: " + result)
if result
while !BRMerchandiseList.Replace3D(MerchantShelf, PlaceholderStatic, BRLinkMerchShelf, BRLinkItemRef)
Debug.Trace("BRMerchandiseList.Replace3D returned false, waiting and trying again")
Utility.Wait(0.05)
endWhile
else
if !result
Debug.MessageBox("Failed to load shop merchandise. Please submit a bug on Nexus Mods with the contents of BazaarRealmPlugin.log and BazaarRealmClient.log usually located in C:\\Users\\<your user>\\Documents\\My Games\\Skyrim Special Edition\\SKSE.")
endif
endif

View File

@@ -16,12 +16,7 @@ Event OnActivate(ObjectReference akActionRef)
BRQuestScript BRScript = BRQuest as BRQuestScript
bool result = BRMerchandiseList.PrevPage(BRScript.ApiUrl, BRScript.ApiKey, BRScript.MerchandiseListId, MerchantShelf, PlaceholderStatic, BRLinkMerchShelf, BRLinkMerchChest, BRLinkItemRef, BRLinkMerchToggle, BRLinkMerchNext, BRLinkMerchPrev)
debug.Trace("BRMerchandiseList.PrevPage result: " + result)
if result
while !BRMerchandiseList.Replace3D(MerchantShelf, PlaceholderStatic, BRLinkMerchShelf, BRLinkItemRef)
Debug.Trace("BRMerchandiseList.Replace3D returned false, waiting and trying again")
Utility.Wait(0.05)
endWhile
else
if !result
Debug.MessageBox("Failed to load shop merchandise. Please submit a bug on Nexus Mods with the contents of BazaarRealmPlugin.log and BazaarRealmClient.log usually located in C:\\Users\\<your user>\\Documents\\My Games\\Skyrim Special Edition\\SKSE.")
endif
endif

View File

@@ -16,13 +16,21 @@ Event OnActivate(ObjectReference akActionRef)
BRQuestScript BRScript = BRQuest as BRQuestScript
bool result = BRMerchandiseList.Toggle(BRScript.ApiUrl, BRScript.ApiKey, BRScript.MerchandiseListId, MerchantShelf, PlaceholderStatic, BRLinkMerchShelf, BRLinkMerchChest, BRLinkItemRef, BRLinkMerchToggle, BRLinkMerchNext, BRLinkMerchPrev)
debug.Trace("BRMerchandiseList.Toggle result: " + result)
if result
while !BRMerchandiseList.Replace3D(MerchantShelf, PlaceholderStatic, BRLinkMerchShelf, BRLinkItemRef)
Debug.Trace("BRMerchandiseList.Replace3D returned false, waiting and trying again")
Utility.Wait(0.05)
endWhile
else
if !result
Debug.MessageBox("Failed to load or clear shop merchandise. Please submit a bug on Nexus Mods with the contents of BazaarRealmPlugin.log and BazaarRealmClient.log usually located in C:\\Users\\<your user>\\Documents\\My Games\\Skyrim Special Edition\\SKSE.")
endif
endif
EndEvent
Event OnLoadMerchandise(bool result)
debug.Trace("BRMerchToggleScript OnLoadMerchandise result: " + result)
if result
ObjectReference MerchantShelf = self.GetLinkedRef(BRLinkMerchShelf)
while !BRMerchandiseList.Replace3D(MerchantShelf, PlaceholderStatic, BRLinkMerchShelf, BRLinkItemRef)
Debug.Trace("BRMerchandiseList.Replace3D returned false, waiting and trying again")
Utility.Wait(0.05)
endWhile
else
Debug.MessageBox("Failed to load or clear shop merchandise. Please submit a bug on Nexus Mods with the contents of BazaarRealmPlugin.log and BazaarRealmClient.log usually located in C:\\Users\\<your user>\\Documents\\My Games\\Skyrim Special Edition\\SKSE.")
endif
EndEvent