Jump to content

[LE] [Papyrus] Refreshing merchant inventory.


SevenBlue

Recommended Posts

It's on the MCM script, so it's the SKI_ConfigBase script.

 

Doesn't matter; what matters is the object the function is being called on, in this particular case MerchantCaravanAChest. I strongly suspect that is filled with the base form of the chest (name matches), not the world reference, and it's the world reference you need since RemoveItem only exists on things that are ObjectReferences.

Link to comment
Share on other sites

Foamy was completely right, I was using the base object instead of the ref. Also sorry for not including the code, oversight on my part. It's getting errors still. Here's the section of code I'm working on at the moment

Event OnOptionSelect(int option)


	If (CurrentPage == "Settings")
	
		If (option == iKit)

			KitVal = !KitVal
			SetToggleOptionValue(iKit, KitVal)
			
				If (SB_SkoomaSetGlobal.GetValue() == 0)

					SB_SkoomaSetGlobal.SetValue(1)
					
					
					
			

			Else

				
				
				SB_SkoomaSetGlobal.SetValue(0)
				CaravanAChestREF.RemoveItem SB_Skoomaset 10
				

			EndIf
		EndIf
	EndIf
EndEvent

and here are the errors

C:\Games\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SB_MCMScript.psc(100,21): no viable alternative at input 'RemoveItem'
C:\Games\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SB_MCMScript.psc(100,32): no viable alternative at input 'SB_SkoomaSet'

Thank you guys for helping me with this so much, I really appreciate it.

Link to comment
Share on other sites

My mistake, I tried it with and without the brackets and got two different errors, the missing comma seemed to be the key. I defaulted to without it because the example on the wiki doesn't use them. Although I'm still getting a compiler error.

Event OnOptionSelect(int option)


	If (CurrentPage == "Settings")
	
		If (option == iKit)

			KitVal = !KitVal
			SetToggleOptionValue(iKit, KitVal)
			
				If (SB_SkoomaSetGlobal.GetValue() == 0)

					SB_SkoomaSetGlobal.SetValue(1)
					
					
					
			

			Else

				
				
				SB_SkoomaSetGlobal.SetValue(0)
				CaravanAChestREF.RemoveItem(SB_Skoomaset,10)
				

			EndIf
		EndIf
	EndIf
EndEvent

and the error

C:\Games\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SB_MCMScript.psc(100,21): RemoveItem is not a function or does not exist

Is this because it's a Ski_config script?

Link to comment
Share on other sites

C:\Games\Steam\steamapps\common\skyrim\Data\Scripts\Source\temp\SB_MCMScript.psc(100,21): RemoveItem is not a function or does not exist

Is this because it's a Ski_config script?

 

No, it's not because it's an SKI_Config script. Can I see your property declarations? Did you remember to update the declaration type from Container (a base form) or Form (which can be either a base form or a placed reference, and thus doesn't have ObjectReference-only functions defined) to ObjectReference?

Edited by foamyesque
Link to comment
Share on other sites

Right on the money, I got it to compile now but it's glitching in game. With my test mod activated when I try and open the MCM menus it never opens and just idles indefinitely, here's the entire script.

Scriptname SB_MCMScript extends SKI_ConfigBase

Actor Property Risaad  Auto  
LeveledItem Property SB_SkoomaSetPartB  Auto
MiscObject Property SB_SkoomaSet  Auto 
GlobalVariable Property SB_SkoomaSetGlobal  auto
ObjectReference Property CaravanAChestREF  Auto  
;====================
;			DIVIDER
;====================

;TOGGLE STATES

Bool KitVal = False;

;====================
;			DIVIDER
;====================

;OIDS (Option IDs)

Int iKit

;====================
;			DIVIDER
;====================


Event OnConfigInit()

	Pages = new string[2]
	Pages[0] = "Settings"
	Pages[1] = "Skooma Types"

EndEvent

;====================
;			DIVIDER
;====================



Event OnPageReset(string page)

	If (page == "")

		LoadCustomContent("MY FILE DIRECTORY")

	Else

		UnloadCustomContent()

	EndIf

	;====================
	;			DIVIDER
	;====================

	If (page == "Settings")

		SetCursorFillMode(TOP_TO_BOTTOM)
		AddHeaderOption("My Header")
		AddEmptyOption()
		ikit = AddToggleOption("Caravans have Skooma Kit", KitVal)		

	ElseIf (page == "Skooma Types")

		

	EndIf
	
EndEvent
;====================
;			DIVIDER
;====================

Event OnOptionSelect(int option)


	If (CurrentPage == "Settings")
	
		If (option == iKit)

			KitVal = !KitVal
			SetToggleOptionValue(iKit, KitVal)
			
				If (SB_SkoomaSetGlobal.GetValue() == 0)

					SB_SkoomaSetGlobal.SetValue(1)
					
					
					
			

			Else

				
				
				SB_SkoomaSetGlobal.SetValue(0)
				CaravanAChestREF.RemoveItem(SB_Skoomaset,10)
				

			EndIf
		EndIf
	EndIf
EndEvent






Link to comment
Share on other sites

Remove this, I think it's looking for a DDS texture which doesn't exist...

    If (page == "")
        LoadCustomContent("MY FILE DIRECTORY")
    Else
        UnloadCustomContent()
    EndIf

You don't need that part unless you actually have a custom image to display.

 

I don't know if this should be "page" rather than "current page", but you don't need it anyway...

   If (CurrentPage == "Settings")

On a side-note, I have no idea what this is all about...

 

https://www.creationkit.com/index.php?title=RemoveItem

 

I don't know if it's for Fallout, if it's relating to the Creation Kit itself, or what.

 

Use the page which actually references the script it is for, in this case ObjectReference...

 

https://www.creationkit.com/index.php?title=RemoveItem_-_ObjectReference

 

As you might notice, the examples are formatted differently for some odd reason.

Edited by Kapteyn
Link to comment
Share on other sites

On a side-note, I have no idea what this is all about...

 

https://www.creationkit.com/index.php?title=RemoveItem

 

I don't know if it's for Fallout, if it's relating to the Creation Kit itself, or what.

 

Use the page which actually references the script it is for, in this case ObjectReference...

 

https://www.creationkit.com/index.php?title=RemoveItem_-_ObjectReference

 

As you might notice, the examples are formatted differently for some odd reason.

 

That's because one is a command you type into the console whilst in game (the top) and the other is the papyrus function call (the bottom).

 

SevenBlue: MCM registration can be finicky and it's an area I'm a less familiar with. That said: Pages is a property on the script; try moving your page names into that instead of scripting them, and remove the OnConfigInit event entirely; see what happens.

Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...