thejadeshadow Posted December 12, 2014 Share Posted December 12, 2014 Hello! Author of Elysium Estate here and I am trying to evolve my item display scripts. Currently, the user activates an activator, which activates a dummy static item for display, and puts their item into a storage chest that they can't access (it is just for safe keeping). When they want the item back, they click the dummy static and it removes the object from the chest and gives it back to their inventory. However, two things. First of all, what I really want to do is let them either do what I explained above, OR...visit the chest and grab the item directly. Currently, they can grab the item from the chest, but it won't deactivate the dummy static. Here is my script below. I am getting an error when trying to compile: EE_DisplayArmorScript.psc(30,0): mismatched input 'EndEvent' expecting ENDIF I also haven't tested this script since it won't compile. Any help would be very appreciated.Scriptname EE_DisplayArmorScript extends ObjectReference Armor Property ItemToPlace Auto Bool Property isPlaced = false Auto Hidden ObjectReference Property EE_DisplayMasterChest Auto Actor Property PlayerRef Auto Event OnActivate(objectReference akActivator) If akActivator == PlayerRef if(isPlaced == FALSE) if PlayerRef.getItemCount(ItemToPlace) >= 1 isPlaced = TRUE self.getLinkedRef().enable() PlayerRef.removeItem(ItemToPlace, 1,False,EE_DisplayMasterChest) endif if(isPlaced == TRUE) if EE_DisplayMasterChest.getItemCount(ItemToPlace) >= 1 isPlaced = TRUE self.getLinkedRef().disable() EE_DisplayMasterChest.removeItem(ItemToPlace, 1,False,PlayerRef) endif endif endif EndEvent Link to comment Share on other sites More sharing options...
cdcooley Posted December 12, 2014 Share Posted December 12, 2014 On 12/12/2014 at 7:25 AM, thejadeshadow said: Here is my script below. I am getting an error when trying to compile: EE_DisplayArmorScript.psc(30,0): mismatched input 'EndEvent' expecting ENDIFScriptname EE_DisplayArmorScript extends ObjectReference Armor Property ItemToPlace Auto ObjectReference Property EE_DisplayMasterChest Auto Actor Property PlayerRef Auto Event OnActivate(objectReference akActivator) if akActivator == PlayerRef if EE_DisplayMasterChest.getItemCount(ItemToPlace) > 0 EE_DisplayMasterChest.removeItem(ItemToPlace, 1, false, PlayerRef) elseif PlayerRef.getItemCount(ItemToPlace) > 0 PlayerRef.removeItem(ItemToPlace, 1, false, EE_DisplayMasterChest) endif endif ; update the display static if EE_DisplayMasterChest.getItemCount(ItemToPlace) > 0 self.getLinkedRef().enable() else self.getLinkedRef().disable() endif EndEventThat should allow the player to add and remove the item through the activator and then update the display static appropriately. More importantly, if you call activate on that activator from a script on the master chest, it will just update the display static visibility. You could then put something like this on the master chest. Scriptname EE_MasterChestScript extends ObjectReference Activator Property Item01Activator Auto Activator Property Item02Activator Auto Activator Property Item03Activator Auto Event OnActivate(objectReference akActivator) while (!Utility.IsInMenuMode()) ; wait for container to open Utility.WaitMenuMode(0.01) endwhile Utility.Wait(0.01) ; and then close again ; now signal all of the activators to update their display statics Item01Activator.Activate(self) Item02Activator.Activate(self) Item03Activator.Activate(self) EndEventYou can replace those activator properties with an array, use a formlist, create a special type of linked ref and connect them to the master container using the CK, or use whatever other scheme you want as long as the script knows which items it needs to activate after the player accesses the container. Link to comment Share on other sites More sharing options...
thejadeshadow Posted December 12, 2014 Author Share Posted December 12, 2014 Thank you for responding. The first script works well....lets me drop one item and displays it, and let me retrieve it and disables the display. If I want to add more properties, where do I add them in the event and how? What I want is, for instance, a display for miraak's mask. But the player could have any 1 of 6 masks. So whichever the player has, I want that certain display to grab their miraak mask. I put them in the properties section, but any variation of getting them in the event section has compiled, but not worked properly. (script shown below with my properties, but not in events. Only added 3 properties for now, I can expand on it later once I understand how to script them in).Scriptname EE_DisplayArmorScript extends ObjectReference Armor Property ItemToPlace Auto Armor Property ItemToPlace2 Auto Armor Property ItemToPlace3 Auto ObjectReference Property EE_DisplayMasterChest Auto Actor Property PlayerRef Auto Event OnActivate(objectReference akActivator) if akActivator == PlayerRef if EE_DisplayMasterChest.getItemCount(ItemToPlace) > 0 EE_DisplayMasterChest.removeItem(ItemToPlace, 1, false, PlayerRef) elseif PlayerRef.getItemCount(ItemToPlace) > 0 PlayerRef.removeItem(ItemToPlace, 1, false, EE_DisplayMasterChest) endif endif ; update the display static if EE_DisplayMasterChest.getItemCount(ItemToPlace) > 0 self.getLinkedRef().enable() else self.getLinkedRef().disable() endif EndEvent Link to comment Share on other sites More sharing options...
cdcooley Posted December 12, 2014 Share Posted December 12, 2014 OK, here are two versions that should work for up to six items. The first one will run slightly faster but I think it's ugly and prefer the second where I don't have to repeat those very long lines. There's no significant difference so pick whichever you like best.Scriptname EE_DisplayArmorScript extends ObjectReference Armor Property ItemToPlace1 Auto Armor Property ItemToPlace2 Auto Armor Property ItemToPlace3 Auto Armor Property ItemToPlace4 Auto Armor Property ItemToPlace5 Auto Armor Property ItemToPlace6 Auto ObjectReference Property EE_DisplayMasterChest Auto Actor Property PlayerRef Auto Event OnActivate(ObjectReference akActivator) if akActivator == PlayerRef ; first check if it is already in the container if ItemToPlace1 && EE_DisplayMasterChest.getItemCount(ItemToPlace1) > 0 EE_DisplayMasterChest.removeItem(ItemToPlace1, 1, false, PlayerRef) elseif ItemToPlace2 && EE_DisplayMasterChest.getItemCount(ItemToPlace2) > 0 EE_DisplayMasterChest.removeItem(ItemToPlace2, 1, false, PlayerRef) elseif ItemToPlace3 && EE_DisplayMasterChest.getItemCount(ItemToPlace3) > 0 EE_DisplayMasterChest.removeItem(ItemToPlace3, 1, false, PlayerRef) elseif ItemToPlace4 && EE_DisplayMasterChest.getItemCount(ItemToPlace4) > 0 EE_DisplayMasterChest.removeItem(ItemToPlace4, 1, false, PlayerRef) elseif ItemToPlace5 && EE_DisplayMasterChest.getItemCount(ItemToPlace5) > 0 EE_DisplayMasterChest.removeItem(ItemToPlace5, 1, false, PlayerRef) elseif ItemToPlace6 && EE_DisplayMasterChest.getItemCount(ItemToPlace6) > 0 EE_DisplayMasterChest.removeItem(ItemToPlace6, 1, false, PlayerRef) ; if not, check to see if the player is carrying it elseif ItemToPlace1 && PlayerRef.getItemCount(ItemToPlace1) > 0 PlayerRef.removeItem(ItemToPlace1, 1, false, EE_DisplayMasterChest) elseif ItemToPlace2 && PlayerRef.getItemCount(ItemToPlace2) > 0 PlayerRef.removeItem(ItemToPlace2, 1, false, EE_DisplayMasterChest) elseif ItemToPlace3 && PlayerRef.getItemCount(ItemToPlace3) > 0 PlayerRef.removeItem(ItemToPlace3, 1, false, EE_DisplayMasterChest) elseif ItemToPlace4 && PlayerRef.getItemCount(ItemToPlace4) > 0 PlayerRef.removeItem(ItemToPlace4, 1, false, EE_DisplayMasterChest) elseif ItemToPlace5 && PlayerRef.getItemCount(ItemToPlace5) > 0 PlayerRef.removeItem(ItemToPlace5, 1, false, EE_DisplayMasterChest) elseif ItemToPlace6 && PlayerRef.getItemCount(ItemToPlace6) > 0 PlayerRef.removeItem(ItemToPlace6, 1, false, EE_DisplayMasterChest) endif endif ; update the display static if ItemToPlace1 && EE_DisplayMasterChest.getItemCount(ItemToPlace1) > 0 getLinkedRef().enable() elseif ItemToPlace2 && EE_DisplayMasterChest.getItemCount(ItemToPlace2) > 0 getLinkedRef().enable() elseif ItemToPlace3 && EE_DisplayMasterChest.getItemCount(ItemToPlace3) > 0 getLinkedRef().enable() elseif ItemToPlace4 && EE_DisplayMasterChest.getItemCount(ItemToPlace4) > 0 getLinkedRef().enable() elseif ItemToPlace5 && EE_DisplayMasterChest.getItemCount(ItemToPlace5) > 0 getLinkedRef().enable() elseif ItemToPlace6 && EE_DisplayMasterChest.getItemCount(ItemToPlace6) > 0 getLinkedRef().enable() else getLinkedRef().disable() endif EndEventScriptname EE_DisplayArmorScript extends ObjectReference Armor Property ItemToPlace1 Auto Armor Property ItemToPlace2 Auto Armor Property ItemToPlace3 Auto Armor Property ItemToPlace4 Auto Armor Property ItemToPlace5 Auto Armor Property ItemToPlace6 Auto ObjectReference Property EE_DisplayMasterChest Auto Actor Property PlayerRef Auto Event OnActivate(ObjectReference akActivator) if akActivator == PlayerRef ; first if it is already in the container try to move it to the player if MoveFromChestToPlayer(ItemToPlace1) || MoveFromChestToPlayer(ItemToPlace2) elseif MoveFromChestToPlayer(ItemToPlace3) || MoveFromChestToPlayer(ItemToPlace4) elseif MoveFromChestToPlayer(ItemToPlace5) || MoveFromChestToPlayer(ItemToPlace6) ; if not, check to see if the player is carrying it and move it to the container elseif MoveFromPlayerToChest(ItemToPlace1) || MoveFromPlayerToChest(ItemToPlace2) elseif MoveFromPlayerToChest(ItemToPlace3) || MoveFromPlayerToChest(ItemToPlace4) elseif MoveFromPlayerToChest(ItemToPlace5) || MoveFromPlayerToChest(ItemToPlace6) endif endif ; update the display static if IsInChest(ItemToPlace1) || IsInChest(ItemToPlace2) || IsInChest(ItemToPlace3) getLinkedRef().enable() else IsInChest(ItemToPlace4) || IsInChest(ItemToPlace5) || IsInChest(ItemToPlace6) getLinkedRef().enable() else getLinkedRef().disable() endif EndEvent Function IsInChest(ObjectReference item) return item && EE_DisplayMasterChest.getItemCount(item) > 0 EndFunction Function MoveFromChestToPlayer(ObjectReference item) if IsInChest(item) EE_DisplayMasterChest.removeItem(item, 1, false, PlayerRef) return true endif return false EndFunction Function MoveFromPlayerToChest(ObjectReference item) if item && PlayerRef.getItemCount(i) > 0 PlayerRef.removeItem(i, 1, false, EE_DisplayMasterChest) return true endif return false EndFunction Link to comment Share on other sites More sharing options...
Terra Nova Posted December 12, 2014 Share Posted December 12, 2014 Oh dear lord @ all of that. Wouldn't arrays be easier and faster? Link to comment Share on other sites More sharing options...
cdcooley Posted December 12, 2014 Share Posted December 12, 2014 I try to be kind when suggesting code for other people. Arrays have the advantage of allowing an arbitrary number of items and I started writing it that way first. Unfortunately the array version was both longer and harder to understand/explain. If the script needed to handle a dozen or more items then arrays win, but for just 6 they over-complicate things. Link to comment Share on other sites More sharing options...
Terra Nova Posted December 12, 2014 Share Posted December 12, 2014 I see, understandable. Link to comment Share on other sites More sharing options...
thejadeshadow Posted December 12, 2014 Author Share Posted December 12, 2014 I was looking into arrays (which yes, I don't really understand lol..), but mostly I just need a single item display, and the mutli item display will only be covering a few overall objects, Thank you so much for your help. :) :) Link to comment Share on other sites More sharing options...
thejadeshadow Posted December 12, 2014 Author Share Posted December 12, 2014 Hm, I am getting these errors when I compile: (27,6): required (...)+ loop did not match anything at input 'IsInChest'(29,1): mismatched input 'else' expecting ENDIF(31,1): mismatched input 'endif' expecting ENDEVENT I've been having problems with the "mistmatched endif expecting ENDEVENT" since I started this script. What does this mean because I've tried looking it up and lots of variations of if statements. Is there a limit to the elseif statements you can use or where you can put them? Link to comment Share on other sites More sharing options...
Ghaunadaur Posted December 12, 2014 Share Posted December 12, 2014 These are 2 scripts I made for display of dragon priest masks. The first script is for the activator, which I made basically an activateable trigger box like the bookshelf clicktrigger. It is linked to the container. Reveal hidden contents Scriptname PMR_ArtifactsTriggerScript extends ObjectReference Actor Property PlayerRef auto ObjectReference Property DragonPriestMaskContainer auto hidden Event OnCellAttach() DragonPriestMaskContainer = GetLinkedRef() EndEvent Event OnActivate(ObjectReference akActionRef) if akActionRef == PlayerRef DragonPriestMaskContainer.Activate(PlayerRef) endif EndEvent The container script enables the static items when the player places a valid item in the container. The order of the items in the formlists needs to match the order of the corresponding static items in the array. Reveal hidden contents Scriptname PMR_ArtifactsContainerScript extends ObjectReference Actor Property PlayerRef auto Formlist Property ArtifactsList auto ObjectReference[] Property ArtifactRefs auto Message Property NoArtifactMSG auto Sound Property SoundWhenPlaced auto Event OnItemAdded(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) if ArtifactsList.HasForm(akBaseItem) int index = ArtifactsList.Find(akBaseItem) ArtifactRefs[index].Enable() SoundWhenPlaced.Play(ArtifactRefs[index]) else RemoveItem(akBaseItem, aiItemCount, true, PlayerRef) NoArtifactMSG.Show() endif EndEvent Event OnItemRemoved(Form akBaseItem, int aiItemCount, ObjectReference akItemReference, ObjectReference akSourceContainer) int index = ArtifactsList.Find(akBaseItem) ArtifactRefs[index].Disable() EndEvent Feel free to use/adapt/share to your liking. Link to comment Share on other sites More sharing options...
Recommended Posts