JWGamimg75 Posted July 4, 2022 Share Posted July 4, 2022 (edited) Assuming it's possible somehow.... I basically want to be able to talk to specific follower about toggling something on or off (via dialog).When the typical dialog box appears (ie. Wait here, etc) there will be something like "Toggle Such and Such On/Off", and when this is selected a menu with the toggles will appear with 3 options: Cancel, On, and Off. I already have the dialog quest setup -- non issue -- but I was experimenting with some scripting in the Papyrus fragment box to see if I can get this to work, and the script is producing errors. I've looked into creating a menu/toggles but in relation to activator switches on object references. Does anyone know what the fragment is missing in the code below in order to make it his work (Again, I'm assuming it's possible)? I appreciate any thorough guidance :smile: ;BEGIN FRAGMENT CODE - Do not edit anything between this and the end comment ;NEXT FRAGMENT INDEX 1 Scriptname JWG_TIF__050E9AAD Extends TopicInfo Hidden ;BEGIN FRAGMENT Fragment_0 Function Fragment_0(ObjectReference akSpeakerRef) Actor akSpeaker = akSpeakerRef as Actor ;BEGIN CODE Function Menu(Int aButton = 0) ;I'm guessing there needs to be something different than Function? aButton = JWD_MSG_LocationMarkerToggle.Show() If aButton == 0 ;Cancel button Debug.Notification("Action cancelled") ElseIf aButton == 1 ;Toggle On button ;an action will go here Debug.Notification("Turned ON") ElseIf aButton == 2 ;Toggle OFF button ;an action will go here Debug.Notification("Turned OFF") EndIf EndFunction ;END CODE EndFunction ;END FRAGMENT ;END FRAGMENT CODE - Do not edit anything between this and the begin comment Message Property JWD_MSG_LocationMarkerToggle Auto The following errors are showing up: * mismatched input 'Function' expecting ENDFUNCTION <---doesn't seem to like a 'Function' within a 'Function' I guess* missing EOF at 'EndFunction' Thanks again! Edited July 4, 2022 by justinglen75 Link to comment Share on other sites More sharing options...
dylbill Posted July 4, 2022 Share Posted July 4, 2022 For fragments, you can't use functions, as that's putting a function inside another function. So just get rid of the Function Menu(Int aButton = 0) line and it's corresponding EndFunction line, (which is right below your last EndIf) and it should work Link to comment Share on other sites More sharing options...
Sphered Posted July 4, 2022 Share Posted July 4, 2022 With the approach you decided to go with, you would just want to have dialogue open a menu, which would kinda defeat the point of having choices in the dialogue just before that You have to be able to relay your selection to pull this off the way you are wanting. The most basic way would be to just have different fragments setup, ready to respond if selected Link to comment Share on other sites More sharing options...
JWGamimg75 Posted July 4, 2022 Author Share Posted July 4, 2022 (edited) @dylbill Thanks for the info! I removed what you suggested -- I was sus of the Function/endfunction within a function/endfunction. Initially, what you suggested didn't work because I took it literally and removed the part with "Int aButton = 0" but after removing the function/endfunction stuff, I re-added the "Int aButton = 0" line, compiled and it worked! So, thanks again for the input! @Sphered Actually that is what I was working on accomplishing -- I go in dialog with a particular follower, there's a line/topic that says "Let's change something...". When the player chooses that line, a messagebox pops up saying this is the current status of this (using conditions within the script), then player hits ok. After that, the menu with the toggle choices appear -- Nevermind, Turn ON this, Turn OFF this. This is currently working in-game like a charm :smile: The final working fragment is below: ;lets check the status of the follower's location marker quest -- is it on or off? and let the player know by displaying a messagebox If (JWG_Quest.GetStage() == 10) || (JWG_Quest.GetStageDone(10) == 1) Debug.Messagebox("The location marker for this NPC is currently ON") ElseIf (JWG_Quest.GetStage() == 0) || (JWG_Quest.GetStageDone(40) == 1) Debug.Messagebox("The location marker for this NPC is currently OFF") endif ;let's start the toggle menu Int aButton = 0 aButton = JWG_Message.Show() If aButton == 0 ;Cancel button Debug.Notification("Action cancelled") ElseIf aButton == 1 ;Toggle On button ;if the quest for the markers was previously reset, then it's waiting to be restarted JWG_Quest.Start() ;so, restart the quest then, and... JWG_Quest.SetStage(10) ;initiate the first stage in the quest -- 10 -- to reactivate the location marker Debug.Notification("The location marker for this NPC is now ON") ElseIf aButton == 2 ;Toggle OFF button JWG_Quest.SetStage(30) ;set the stage in the quest to 30 to ultimately end and complete the quest so it doesn't show on Misc Quest Journal JWG_Quest.Reset() ;reset the quest -- per CK notes this will not START the quest -- it is waiting to be re-started Debug.Notification("The location marker for this NPC is now OFF") EndIf Edited July 4, 2022 by justinglen75 Link to comment Share on other sites More sharing options...
Sphered Posted July 4, 2022 Share Posted July 4, 2022 Yeah if you are wanting a submenu thatll do. Some reason I got the impression you wanted an alternative to that. Cheers Link to comment Share on other sites More sharing options...
dylbill Posted July 4, 2022 Share Posted July 4, 2022 No problem, you can also put that on a single line: Int aButton = JWG_Message.Show() You have to have Int so it know what type aButton is. Link to comment Share on other sites More sharing options...
Recommended Posts