antstubell Posted August 16, 2020 Share Posted August 16, 2020 I hope my video will show you my problem. Please watch and look at the script. I know something is very wrong. Actor Property PlayerREF AutoGlobalVariable Property My_GVtownClockSwap AutoGlobalVariable Property My_GVtownClockSetOnce AutoMessage Property My_MENU_TownClockTime AutoMiscObject Property My_TownClockHand_Large AutoMiscObject Property My_TownClockHand_Small AutoObjectReference Property ClockMissHands AutoObjectReference Property Clock12 AutoObjectReference Property Clock300 AutoObjectReference Property Clock600 Auto; already set times N 6:45 E 9:00 W 3:30; available times S 12.00 3:00 6:00; variable 0 = missing hand 3 = 3oClock(correct) 6 = 6oClock 12 = 12oClockEvent OnTriggerEnter(ObjectReference akActionRef)if akActionRef == PlayerRefInt iButton = My_MENU_TownClockTime.Show()If iButton == 4; leave; do nothingReturnEndIfIf iButton == 3; resetdebug.notification("Sending To Reset Time Function")ResetTime()EndIfIf PlayerRef.GetItemCount(My_TownClockHand_Large) < 1 || PlayerRef.GetItemCount(My_TownClockHand_Small) < 1debug.messagebox("You Don’t Have Enough Clock Hands")EndIfIf iButton == 0; 12:00Clock12.Enable()ClockMissHands.Disable()Utility.Wait(0.2)My_GVtownClockSwap.SetValue(12); tells translate script which clock to movePlayerREF.RemoveItem(My_TownClockHand_Large, 1)PlayerREF.RemoveItem(My_TownClockHand_Small, 1)Self.Disable()ReturnElseIf iButton == 1; 3:00Clock300.Enable()ClockMissHands.Disable()Utility.Wait(0.2)My_GVtownClockSwap.SetValue(3); tells translate script which clock to movePlayerREF.RemoveItem(My_TownClockHand_Large, 1)PlayerREF.RemoveItem(My_TownClockHand_Small, 1)Self.Disable()ReturnElseIf iButton == 2; 6:00Clock600.Enable()ClockMissHands.Disable()Utility.Wait(0.2)My_GVtownClockSwap.SetValue(6); tells translate script which clock to movePlayerREF.RemoveItem(My_TownClockHand_Large, 1)PlayerREF.RemoveItem(My_TownClockHand_Small, 1)Self.Disable()ReturnEndIfEndIfEndEvent; ------------- Reset Time --------------; missing hands clock position may need to be resetFunction ResetTime()debug.notification("Reset Time Function")My_GVtownClockSetOnce.SetValue(1); tells menu to display ‘Reset Time’ optionIf PlayerRef.GetItemCount(My_TownClockHand_Large) == 0 && PlayerRef.GetItemCount(My_TownClockHand_Small) == 0PlayerREF.AddItem(My_TownClockHand_Large, 1)PlayerREF.AddItem(My_TownClockHand_Small, 1)EndIfClockMissHands.Enable(); enable starting (missing hands) clock, disable othersIf (Clock12.IsEnabled())Clock12.Disable()EndIfIf (Clock300.IsEnabled())Clock300.Disable()EndIfIf (Clock600.IsEnabled())Clock600.Disable()EndIfEndFunction https://onedrive.live.com/?cid=B60C11D037429D8E&id=B60C11D037429D8E%2152860&parId=B60C11D037429D8E%21191&o=OneUp Link to comment Share on other sites More sharing options...
Evangela Posted August 16, 2020 Share Posted August 16, 2020 (edited) You have the leave and reset buttons swapped. If iButton == 4; leave ; do nothing Return EndIf If iButton == 3; reset debug.notification("Sending To Reset Time Function") ResetTime() EndIf When you hit leave (3) it calls resettime when you intended that to be for button 4. Edit: I make this kind of mistake all the time :P and am always happy to see it because it's simple to fix lol. Edited August 16, 2020 by Rasikko Link to comment Share on other sites More sharing options...
antstubell Posted August 17, 2020 Author Share Posted August 17, 2020 Oh man, duh! Sometimes the obvious evades us all. So that's that part sorted. Could you shed some light on my next issue please. This is related to the post I made about 'Return'. The video has explanations about the issue.I have reordered the conditions in the script, hoping to fix the problem, and corrected the button numbering as you pointed out was wrong. I've attached the script minus its properties which are still the same.Thanks for your time. Event OnTriggerEnter(ObjectReference akActionRef)if akActionRef == PlayerRefInt iButton = My_MENU_TownClockTime.Show()If PlayerRef.GetItemCount(My_TownClockHand_Large) < 1 || PlayerRef.GetItemCount(My_TownClockHand_Small) < 1debug.messagebox("You Don’t Have Enough Clock Hands")EndIfIf iButton == 3; leave; do nothingReturnEndIfIf iButton == 4; resetdebug.notification("Sending To Reset Time Function")ResetTime()EndIfIf iButton == 0; 12:00Clock12.Enable()ClockMissHands.Disable()Utility.Wait(0.2)My_GVtownClockSwap.SetValue(12); tells translate script which clock to movePlayerREF.RemoveItem(My_TownClockHand_Large, 1)PlayerREF.RemoveItem(My_TownClockHand_Small, 1)Self.Disable()ReturnElseIf iButton == 1; 3:00Clock300.Enable()ClockMissHands.Disable()Utility.Wait(0.2)My_GVtownClockSwap.SetValue(3); tells translate script which clock to movePlayerREF.RemoveItem(My_TownClockHand_Large, 1)PlayerREF.RemoveItem(My_TownClockHand_Small, 1)Self.Disable()ReturnElseIf iButton == 2; 6:00Clock600.Enable()ClockMissHands.Disable()Utility.Wait(0.2)My_GVtownClockSwap.SetValue(6); tells translate script which clock to movePlayerREF.RemoveItem(My_TownClockHand_Large, 1)PlayerREF.RemoveItem(My_TownClockHand_Small, 1)Self.Disable()ReturnEndIfEndIfEndEvent; ------------- Reset Time --------------Function ResetTime()debug.notification("Reset Time Function")My_GVtownClockSetOnce.SetValue(1); tells menu to display ‘Reset Time’ optionIf PlayerRef.GetItemCount(My_TownClockHand_Large) == 0 && PlayerRef.GetItemCount(My_TownClockHand_Small) == 0PlayerREF.AddItem(My_TownClockHand_Large, 1)PlayerREF.AddItem(My_TownClockHand_Small, 1)EndIfClockMissHands.Enable(); enable starting (missing hands) clock, disable othersIf (Clock12.IsEnabled())Clock12.Disable()EndIfIf (Clock300.IsEnabled())Clock300.Disable()EndIfIf (Clock600.IsEnabled())Clock600.Disable()EndIfEndFunction https://onedrive.live.com/?cid=B60C11D037429D8E&id=B60C11D037429D8E%2152862&parId=B60C11D037429D8E%21191&o=OneUp Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 17, 2020 Share Posted August 17, 2020 You enter the trigger, the button shows. While you decide what button to press the script continues processing, since the next portion (the check for the hands) is not dependent upon an option and is true at that moment it runs. But it has to wait until the previous message box is cleared before it can show. Try this change: Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef == PlayerRef If PlayerRef.GetItemCount(My_TownClockHand_Large) < 1 || PlayerRef.GetItemCount(My_TownClockHand_Small) < 1 debug.messagebox("You Don’t Have Enough Clock Hands") Else Int iButton = My_MENU_TownClockTime.Show() If iButton == 3; leave ; do nothing Return EndIf If iButton == 4; reset debug.notification("Sending To Reset Time Function") ResetTime() EndIf If iButton == 0; 12:00 Clock12.Enable() ClockMissHands.Disable() Utility.Wait(0.2) My_GVtownClockSwap.SetValue(12); tells translate script which clock to move PlayerREF.RemoveItem(My_TownClockHand_Large, 1) PlayerREF.RemoveItem(My_TownClockHand_Small, 1) Self.Disable() Return ElseIf iButton == 1; 3:00 Clock300.Enable() ClockMissHands.Disable() Utility.Wait(0.2) My_GVtownClockSwap.SetValue(3); tells translate script which clock to move PlayerREF.RemoveItem(My_TownClockHand_Large, 1) PlayerREF.RemoveItem(My_TownClockHand_Small, 1) Self.Disable() Return ElseIf iButton == 2; 6:00 Clock600.Enable() ClockMissHands.Disable() Utility.Wait(0.2) My_GVtownClockSwap.SetValue(6); tells translate script which clock to move PlayerREF.RemoveItem(My_TownClockHand_Large, 1) PlayerREF.RemoveItem(My_TownClockHand_Small, 1) Self.Disable() Return EndIf EndIf EndIf EndEvent ; ------------- Reset Time -------------- Function ResetTime() debug.notification("Reset Time Function") My_GVtownClockSetOnce.SetValue(1); tells menu to display ‘Reset Time’ option If PlayerRef.GetItemCount(My_TownClockHand_Large) == 0 && PlayerRef.GetItemCount(My_TownClockHand_Small) == 0 PlayerREF.AddItem(My_TownClockHand_Large, 1) PlayerREF.AddItem(My_TownClockHand_Small, 1) EndIf ClockMissHands.Enable(); enable starting (missing hands) clock, disable others If (Clock12.IsEnabled()) Clock12.Disable() EndIf If (Clock300.IsEnabled()) Clock300.Disable() EndIf If (Clock600.IsEnabled()) Clock600.Disable() EndIf EndFunction Link to comment Share on other sites More sharing options...
antstubell Posted August 17, 2020 Author Share Posted August 17, 2020 Gave your script a go and am now seeing this...https://onedrive.live.com/?cid=B60C11D037429D8E&id=B60C11D037429D8E%2152864&parId=B60C11D037429D8E%21191&o=OneUp Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 17, 2020 Share Posted August 17, 2020 So you need to be able to interact with it even if the player does not have the correct number of items because they will be returning to the clock to do something else? Hmm... try this out then.It moves the check for the hands into a separate bool function that is then called when selecting an option. If it returns true it allows the code from the time options to run. If it returns false, the message box appears informing the user that they do not have enough hands. Leave and Reset do not check for the hands as I presume you want them available despite the status of the hands. Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef == PlayerRef Int iButton = My_MENU_TownClockTime.Show() If iButton == 3; leave ; do nothing Return EndIf If iButton == 4; reset debug.notification("Sending To Reset Time Function") ResetTime() EndIf If iButton == 0; 12:00 If CheckForHands() == True Clock12.Enable() ClockMissHands.Disable() Utility.Wait(0.2) My_GVtownClockSwap.SetValue(12); tells translate script which clock to move PlayerREF.RemoveItem(My_TownClockHand_Large, 1) PlayerREF.RemoveItem(My_TownClockHand_Small, 1) Self.Disable() EndIf Return ElseIf iButton == 1; 3:00 If CheckForHands() == True Clock300.Enable() ClockMissHands.Disable() Utility.Wait(0.2) My_GVtownClockSwap.SetValue(3); tells translate script which clock to move PlayerREF.RemoveItem(My_TownClockHand_Large, 1) PlayerREF.RemoveItem(My_TownClockHand_Small, 1) Self.Disable() EndIf Return ElseIf iButton == 2; 6:00 If CheckForHands() == True Clock600.Enable() ClockMissHands.Disable() Utility.Wait(0.2) My_GVtownClockSwap.SetValue(6); tells translate script which clock to move PlayerREF.RemoveItem(My_TownClockHand_Large, 1) PlayerREF.RemoveItem(My_TownClockHand_Small, 1) Self.Disable() EndIf Return EndIf EndIf EndEvent ; ------------- Reset Time -------------- Bool Function CheckForHands() If PlayerRef.GetItemCount(My_TownClockHand_Large) >= 1 && PlayerRef.GetItemCount(My_TownClockHand_Small) >= 1 Return True Else debug.messagebox("You Don’t Have Enough Clock Hands") Return False EndIf EndFunction Function ResetTime() debug.notification("Reset Time Function") My_GVtownClockSetOnce.SetValue(1); tells menu to display ‘Reset Time’ option If PlayerRef.GetItemCount(My_TownClockHand_Large) == 0 && PlayerRef.GetItemCount(My_TownClockHand_Small) == 0 PlayerREF.AddItem(My_TownClockHand_Large, 1) PlayerREF.AddItem(My_TownClockHand_Small, 1) EndIf ClockMissHands.Enable(); enable starting (missing hands) clock, disable others If (Clock12.IsEnabled()) Clock12.Disable() EndIf If (Clock300.IsEnabled()) Clock300.Disable() EndIf If (Clock600.IsEnabled()) Clock600.Disable() EndIf EndFunction Link to comment Share on other sites More sharing options...
antstubell Posted August 17, 2020 Author Share Posted August 17, 2020 (edited) Thanks, this does essentially everything required but "You Don’t Have Enough Clock Hands" never appears. This is not a big problem and as I said I can go with this as it is. It is obvious, I hope, to the player that here is a clock that rotates. One of the faces of the clock has no hands, I wonder what is need here? It is blindingly obvious what player needs to acquire and install for the puzzle to be completed. But even if just 1 player in the world is not wise enough to know what to do seeing the message "You Don’t Have Enough Clock Hands"...may... help... is my presuming that somebody would not know this belittling my fellow human beings. Anyway this can easily be overcome with another trigger box that shows a message like "This Clock Face Has Hands Missing" then self deletes and this is what I'll do.On a more technical note isn't the Bool Function checking what the menu conditions already check for? In the first video I posted I showed that the menu buttons 0, 1 and 2 are conditioned to only show if player has both clock hands.Thanks for your help and I am more than happy with what you have done for me. EDIT: Related to another post I made a few days ago. What does the 'Return' instruction/command at the end of a condition do? Edited August 17, 2020 by antstubell Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 17, 2020 Share Posted August 17, 2020 (edited) There was no way to know what your menu conditions were. Even watching the video it isn't explicitly clear to me at any rate (I don't like message boxes in-game so I do my best to avoid working with them when making mods). I'll think outside the box some more.... EDIT: Just a slight change in the logic. Moved the check outside of the menu box. If true, the menu will run. If false, the message in the function will display and the menu will not run. Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef == PlayerRef If CheckForHands() == True Int iButton = My_MENU_TownClockTime.Show() If iButton == 3; leave ; do nothing Return EndIf If iButton == 4; reset debug.notification("Sending To Reset Time Function") ResetTime() EndIf If iButton == 0; 12:00 ;conditioned in message box to only show when both hands are present Clock12.Enable() ClockMissHands.Disable() Utility.Wait(0.2) My_GVtownClockSwap.SetValue(12); tells translate script which clock to move PlayerREF.RemoveItem(My_TownClockHand_Large, 1) PlayerREF.RemoveItem(My_TownClockHand_Small, 1) Self.Disable() Return ElseIf iButton == 1; 3:00 ;conditioned in message box to only show when both hands are present Clock300.Enable() ClockMissHands.Disable() Utility.Wait(0.2) My_GVtownClockSwap.SetValue(3); tells translate script which clock to move PlayerREF.RemoveItem(My_TownClockHand_Large, 1) PlayerREF.RemoveItem(My_TownClockHand_Small, 1) Self.Disable() Return ElseIf iButton == 2; 6:00 ;conditioned in message box to only show when both hands are present Clock600.Enable() ClockMissHands.Disable() Utility.Wait(0.2) My_GVtownClockSwap.SetValue(6); tells translate script which clock to move PlayerREF.RemoveItem(My_TownClockHand_Large, 1) PlayerREF.RemoveItem(My_TownClockHand_Small, 1) Self.Disable() Return EndIf EndIf EndIf EndEvent ; ------------- Reset Time -------------- Bool Function CheckForHands() If PlayerRef.GetItemCount(My_TownClockHand_Large) >= 1 && PlayerRef.GetItemCount(My_TownClockHand_Small) >= 1 Return True Else debug.messagebox("You Don’t Have Enough Clock Hands") Return False EndIf EndFunction Function ResetTime() debug.notification("Reset Time Function") My_GVtownClockSetOnce.SetValue(1); tells menu to display ‘Reset Time’ option If PlayerRef.GetItemCount(My_TownClockHand_Large) == 0 && PlayerRef.GetItemCount(My_TownClockHand_Small) == 0 PlayerREF.AddItem(My_TownClockHand_Large, 1) PlayerREF.AddItem(My_TownClockHand_Small, 1) EndIf ClockMissHands.Enable(); enable starting (missing hands) clock, disable others If (Clock12.IsEnabled()) Clock12.Disable() EndIf If (Clock300.IsEnabled()) Clock300.Disable() EndIf If (Clock600.IsEnabled()) Clock600.Disable() EndIf EndFunction Edited August 17, 2020 by IsharaMeradin Link to comment Share on other sites More sharing options...
antstubell Posted August 18, 2020 Author Share Posted August 18, 2020 Thanks for 'thinking outside the box'. In this script after setting the clock once, spinning it (the reason for spinning is part of the puzzle), when going back to reset time, if player got it wrong and nothing happened, the "You don't have enough clock hands" message appears, which is true player has put the only clock hands in the mod on the clock, but the menu doesn't appear to show Reset and Leave.Like I said I am more than happy with the script you did prior to this and I added a self deleting trigger box that informs player that they need to find clock hands the first time they approach the clock.In all cases - thank you. Link to comment Share on other sites More sharing options...
IsharaMeradin Posted August 18, 2020 Share Posted August 18, 2020 So...They need to be able to reset via menu after turning the clock while they still do not have hands. Hmm...*completely throwing the box away* Bool HandsPlaced = false Event OnTriggerEnter(ObjectReference akActionRef) If akActionRef == PlayerRef If CheckForHands() == True Int iButton = My_MENU_TownClockTime.Show() If iButton == 3; leave ; do nothing Return EndIf If iButton == 4; reset debug.notification("Sending To Reset Time Function") ResetTime() EndIf If iButton == 0; 12:00 ;conditioned in message box to only show when both hands are present HandsPlaced = True Clock12.Enable() ClockMissHands.Disable() Utility.Wait(0.2) My_GVtownClockSwap.SetValue(12); tells translate script which clock to move PlayerREF.RemoveItem(My_TownClockHand_Large, 1) PlayerREF.RemoveItem(My_TownClockHand_Small, 1) Self.Disable() Return ElseIf iButton == 1; 3:00 ;conditioned in message box to only show when both hands are present HandsPlaced = True Clock300.Enable() ClockMissHands.Disable() Utility.Wait(0.2) My_GVtownClockSwap.SetValue(3); tells translate script which clock to move PlayerREF.RemoveItem(My_TownClockHand_Large, 1) PlayerREF.RemoveItem(My_TownClockHand_Small, 1) Self.Disable() Return ElseIf iButton == 2; 6:00 ;conditioned in message box to only show when both hands are present HandsPlaced = True Clock600.Enable() ClockMissHands.Disable() Utility.Wait(0.2) My_GVtownClockSwap.SetValue(6); tells translate script which clock to move PlayerREF.RemoveItem(My_TownClockHand_Large, 1) PlayerREF.RemoveItem(My_TownClockHand_Small, 1) Self.Disable() Return EndIf EndIf EndIf EndEvent ; ------------- Reset Time -------------- Bool Function CheckForHands() If (PlayerRef.GetItemCount(My_TownClockHand_Large) >= 1 && PlayerRef.GetItemCount(My_TownClockHand_Small) >= 1) || (HandsPlaced == True) Return True Else debug.messagebox("You Don’t Have Enough Clock Hands") Return False EndIf EndFunction Function ResetTime() debug.notification("Reset Time Function") HandsPlaced = False My_GVtownClockSetOnce.SetValue(1); tells menu to display ‘Reset Time’ option If PlayerRef.GetItemCount(My_TownClockHand_Large) == 0 && PlayerRef.GetItemCount(My_TownClockHand_Small) == 0 PlayerREF.AddItem(My_TownClockHand_Large, 1) PlayerREF.AddItem(My_TownClockHand_Small, 1) EndIf ClockMissHands.Enable(); enable starting (missing hands) clock, disable others If (Clock12.IsEnabled()) Clock12.Disable() EndIf If (Clock300.IsEnabled()) Clock300.Disable() EndIf If (Clock600.IsEnabled()) Clock600.Disable() EndIf EndFunctionAdded a bool variable that is initially false. It gets set to true when hands are placed. The function which checks for the hands will return true when the player has the hands OR when the added bool variable is true. The bool variable is set to false when Reset is selected. Leave does not touch the bool variable. Feel free to stick with the other if this doesn't work out. The box has been shredded and recycled already. Got nothing left but packing peanuts and bubble wrap. Great stress relievers but not enough to think with. :laugh: Link to comment Share on other sites More sharing options...
Recommended Posts