Jump to content

[LE] Are dynamic menu options possible?


Recommended Posts

Does anyone know for sure? As far as I can tell, they're not, but I wanted to make sure before I gave up on my current approach.

 

By dynamic, I mean that, instead of having options A, B, etc., I'd have FirstFollower'sName, SecondFollower'sName, etc.. So, if I wanted the player to select one of their followers by name to die/live/striptease/whatever, I could do so without having to create a quest, use a quest NPC, and do everything via dialogue (which seems like it might work if I understood this correctly).

Link to comment
Share on other sites

Yes, it just more variables that you need to account for, for what displays at a given time. But it is very possible, heaps of mods do it. Here a shitty example of one of mine where I don't just change the text but switch from Slider Dialogue to Input Dialogue.

 

 

 

AddTextOptionST("TEXT_IMPORT_DEFAULT_JSON_STATE", "Cloned Choreographer Default","Click Me", nFLAG_TYPE1_NONE)
  AddMenuOptionST("MENU_DIALOGUE_BOX_STATE", "Dialogue Boxes: ", "$DQ2__DialogBox" + FDQMain.bInputDialog As Int)
  a_index = 0
  Int nMaximum = FDQMain.nCloneDancers
  If(FDQMain.bInputDialog)
   While(a_index < nMaximum)
    AddHeaderOption("Dancer " + (a_index + 1)  + " : " + sDancerName[a_index])
    AddInputOptionST("INPUT_POSITION_X_STATE" + a_index, "Backwards & Forwards:", FDQMain.fSetPositionX[a_index] As Int, nFLAG_TYPE1_NONE)
    AddInputOptionST("INPUT_POSITION_Y_STATE" + a_index, "Left & Right:", FDQMain.fSetPositionY[a_index] As Int, nFLAG_TYPE1_NONE)
    AddInputOptionST("INPUT_ROTATION_Z_STATE" + a_index, "Rotation:", FDQMain.fSetAngleZ[a_index] As Int, nFLAG_TYPE1_NONE)
    a_index += 1
   EndWhile
  Else
   While(a_index < nMaximum)
    AddHeaderOption("Dancer " + (a_index + 1)  + " : " + sDancerName[a_index])
    AddSliderOptionST("SLIDER_POSITION_X_STATE" + a_index, "Backwards & Forwards:", FDQMain.fSetPositionX[a_index], "{0}", nFLAG_TYPE1_NONE)
    AddSliderOptionST("SLIDER_POSITION_Y_STATE" + a_index, "Left & Right:", FDQMain.fSetPositionY[a_index], "{0}", nFLAG_TYPE1_NONE)
    AddSliderOptionST("SLIDER_ROTATION_Z_STATE" + a_index, "Rotation:", FDQMain.fSetAngleZ[a_index], "{0}", nFLAG_TYPE1_NONE)
    a_index += 1
   EndWhile
  EndIf

 

 

 

So knock yourself out, IT IS POSSIBLE. I wouldn't have any trouble at all doing it, what holding you back is lack of imagination & skill, coding is like writing a story, make it happen, but your ABC ain't up to scratch yet, for more complex stuff YET.

Don't be discourage, with experience, you with grow to be novelist.

 

Cheers.

Link to comment
Share on other sites

Yes, it just more variables that you need to account for, for what displays at a given time. But it is very possible, heaps of mods do it. Here a shitty example of one of mine where I don't just change the text but switch from Slider Dialogue to Input Dialogue.

 

 

 

AddTextOptionST("TEXT_IMPORT_DEFAULT_JSON_STATE", "Cloned Choreographer Default","Click Me", nFLAG_TYPE1_NONE)
  AddMenuOptionST("MENU_DIALOGUE_BOX_STATE", "Dialogue Boxes: ", "$DQ2__DialogBox" + FDQMain.bInputDialog As Int)
  a_index = 0
  Int nMaximum = FDQMain.nCloneDancers
  If(FDQMain.bInputDialog)
   While(a_index < nMaximum)
    AddHeaderOption("Dancer " + (a_index + 1)  + " : " + sDancerName[a_index])
    AddInputOptionST("INPUT_POSITION_X_STATE" + a_index, "Backwards & Forwards:", FDQMain.fSetPositionX[a_index] As Int, nFLAG_TYPE1_NONE)
    AddInputOptionST("INPUT_POSITION_Y_STATE" + a_index, "Left & Right:", FDQMain.fSetPositionY[a_index] As Int, nFLAG_TYPE1_NONE)
    AddInputOptionST("INPUT_ROTATION_Z_STATE" + a_index, "Rotation:", FDQMain.fSetAngleZ[a_index] As Int, nFLAG_TYPE1_NONE)
    a_index += 1
   EndWhile
  Else
   While(a_index < nMaximum)
    AddHeaderOption("Dancer " + (a_index + 1)  + " : " + sDancerName[a_index])
    AddSliderOptionST("SLIDER_POSITION_X_STATE" + a_index, "Backwards & Forwards:", FDQMain.fSetPositionX[a_index], "{0}", nFLAG_TYPE1_NONE)
    AddSliderOptionST("SLIDER_POSITION_Y_STATE" + a_index, "Left & Right:", FDQMain.fSetPositionY[a_index], "{0}", nFLAG_TYPE1_NONE)
    AddSliderOptionST("SLIDER_ROTATION_Z_STATE" + a_index, "Rotation:", FDQMain.fSetAngleZ[a_index], "{0}", nFLAG_TYPE1_NONE)
    a_index += 1
   EndWhile
  EndIf

 

 

 

So knock yourself out, IT IS POSSIBLE. I wouldn't have any trouble at all doing it, what holding you back is lack of imagination & skill, coding is like writing a story, make it happen, but your ABC ain't up to scratch yet, for more complex stuff YET.

Don't be discourage, with experience, you with grow to be novelist.

 

Cheers.

Honestly, that doesn't even look like papyrus to me ;)

 

I've been working on a different implementation (no menus) that I think I like better (assuming I can get it to work), but I'll definitely look this over later. Is this using SKSE or something by the way?

Link to comment
Share on other sites

Just SkyUI, so SKSE by default.

AddMenuOptionST("MENU_DIALOGUE_BOX_STATE", "Dialogue Boxes: ", "$DQ2__DialogBox" + FDQMain.bInputDialog As Int)

Just look at third parameter, it's exactly what your asking about, dynamic. I cheat with the SKSE SkyUI translation text tho, for the finished product.

 

There is nothing stopping anybody from doing that in the second parameter, I've never had the need. But it definitely can be done.

 

Lets me finish with, there more than one way to skin a cat, if ya get my meaning, there are different things you can do to achieve the same result.

Link to comment
Share on other sites

I use that, I highly recommend it. Both has a Global & attach to a file for functions.

 

But UIExtensions is better, IMHO. Except for using Input Dialogue in menu mode. For me it froze the SkyUI Mod Config Menu, but work fine other wise.

 

Look into using a SKSE Translation Text... I don't think it will come in handy for the Follower thingy, but you should be aware of what it can do with SkyUI, very handy. Plus looks like you will dealing with some Dynamic Strings(&or Alias) Arrays. So SKSE is required, if that let's you down, take a look a PapyrusUtil.

 

Wow, looks like you just started down the path of Advance Papyrus Scripting. Good luck.

 

PS, just letting you know, the CK Wikki (last time I looked) hasn't court up to some 2015 SKSE codes, like Dynamic Arrays Codes, & these codes are very dangerous to use as a Newbie, don't be surprise if your Papyrus Log explodes , your game freezes. (your not using them properly)

 

I guarantee your PC will not catch on fire. Ha ha

 

God damn, thanks, now I need to check if SkyUILib & UIExts is out on SE, nah, to busy with school, RL calling, cheers.

; Size is treated as unsigned, negative numbers will result 
; extremely large positive numbers, USE WITH CARE
float[] Function CreateFloatArray(int size, float fill = 0.0) global native
int[] Function CreateIntArray(int size, int fill = 0) global native
bool[] Function CreateBoolArray(int size, bool fill = false) global native
string[] Function CreateStringArray(int size, string fill = "") global native
Form[] Function CreateFormArray(int size, Form fill = None) global native
Alias[] Function CreateAliasArray(int size, Alias fill = None) global native

float[] Function ResizeFloatArray(float[] source, int size, float fill = 0.0) global native
int[] Function ResizeIntArray(int[] source, int size, int fill = 0) global native
bool[] Function ResizeBoolArray(bool[] source, int size, bool fill = false) global native
string[] Function ResizeStringArray(string[] source, int size, string fill = "") global native
Form[] Function ResizeFormArray(Form[] source, int size, Form fill = None) global native
Alias[] Function ResizeAliasArray(Alias[] source, int size, Alias fill = None) global native

once again, AFAIK, the above codes are not mention on the CK Wikki... they are in the SKSE Utility.psc

Link to comment
Share on other sites

I had a quick thought. If you remove(dismiss?) a follower from the middle of the Array, you need PapyrusUtil to remove the None Form & Resize the Array!!! So you need PapyrusUtil. For a Professional Looking Display in MCM, SkyUIlib or UIExts UI Dialogue Box.

 

But let's recap, SkyUI for a Hot Key instead of an magic item.

 

a UI Mod instead of a Old School Message Box,

 

& some advance scripting for Shine Stuff Polish.

 

Is that what your trying to do?

 

Crappy Example for UIExtensions (one of mine)

 

 

Function UIExtensionsMenu()

	If(_FDQ_QUST_Dance.IsRunning())
		_FDQ_SNCT_AudioCategory.Pause()
		utility.Wait(0.25)
	EndIf
	ObjectReference SoundREF = PlayerREF
	UIListMenu expired6978 = Game.GetFormFromFile(0xE05, "UIExtensions.esp") As UIListMenu
	expired6978.ResetMenu()
	Int nIndex = 1
	While(nIndex < 4)
		expired6978.AddEntryItem("$DQ2__DanceMode" + nIndex)
		nIndex += 1
	EndWhile
	expired6978.OpenMenu()
	Int nResult1 = expired6978.GetResultInt()
	_FDQ_SOUN_UIMenuActive.Play(SoundREF)
	If(nResult1 != -1)
		expired6978.ResetMenu()
		If(nResult1 == 0)
			nIndex = 1		
			While(nIndex < 77)
				expired6978.AddEntryItem("$DQ2_CloneDance" + nIndex)
				nIndex += 1
			EndWhile
		ElseIf(nResult1 == 1)
			nIndex = 77
			While(nIndex < 109)
				expired6978.AddEntryItem("$DQ2_SyncDance" + nIndex)
				nIndex += 1
			EndWhile
		Else
			nIndex = 0
			While(nIndex < 25)
				String FileName = "../DanceQuest2/ChoreographerFolder/ChoreographerList"
				String sDancerPosition = jsonUtil.StringListGet(FileName, "sDancerPosition", nIndex)
				expired6978.AddEntryItem(sDancerPosition)
				nIndex += 1
			EndWhile
		EndIf
		expired6978.OpenMenu()
		Int nResult2 = expired6978.GetResultInt()
		_FDQ_SOUN_UIMenuActive.Play(SoundREF)
		If(nResult2 != -1)
			If(nResult1 == 0)
				nCloneDanceID = nResult2
			ElseIf(nResult1 == 1)
				nSyncDanceID = nResult2
			Else
				nChoreographID = nResult2
				ImportChoreographerFile(nResult2)
				If(nDanceTypes == nDT_Initialized_CLONE && _FDQ_QUST_Dance.IsRunning())
					RepositionDance(True)
				EndIf
			EndIf
		EndIf
		If(Input.IsKeyPressed(nSubMenuKey))
			Self.UIExtensionsMenu()
			Return
		EndIf
	EndIf
	If(_FDQ_QUST_Dance.IsRunning())
		_FDQ_SNCT_AudioCategory.UnPause()
	EndIf
EndFunction

 

 

 

 

I'm just happy to nudge you in the right direction
provide feedback, show example that you can't use.
but will kick start you.

Once you get some code up, there is a whole community (including me) willing to help.

 

Link to comment
Share on other sites

OOOh I forgot about SkyUILIB and UIExtensions, and yeah, there's nothing wrong with using the MCM either. The vanilla menu system is super limiting. It used to be much worse for Oblivion though. Maybe it'll be more robust for the next game..

Link to comment
Share on other sites

  • Recently Browsing   0 members

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