Jump to content

Possible to Check if Menus are off?


Mattiewagg

Recommended Posts

Is there a function in Papyrus that allows you to check if the menus have been toggled? Since you can toggle the menus with Debug.ToggleMenus, which will turn the menus off if they're on, or on if they're off. But I can't figure out how I would make a function (since I can't seem to find one) that checks if the menus are toggled.

 

I thought initially that I could set a variable each time ToggleMenus was initiated, and then check that variable, like this:

 

 

 

; script declaration stuff up here

Bool MenusToggled = False
; initial value
Int MyKeyCode

Event OnKeyPressDown(Int KeyCode)

     If KeyCode == MyKeyCode

          Debug.ToggleMenus()
          
          If MenusToggled == False

              MenusToggled = True

          Else

              MenusToggled = False

     EndIf

EndEvent
         

 

 

 

So I could later call MenusToggled and do something based on its value, but then I realized this wouldn't work because there's no way to be sure that the user didn't already have their menus toggled when they first installed the mod, so I couldn't be sure that MenusToggled initial value should be false.

 

Is there any native functions to do this? I was looking through the CK Wiki and I couldn't find any. If there isn't, what would a custom function look like? I'd like to be able to use it like this:

If MenusToggled() == False

    ;Do stuff

Else

     ;Do different stuff

    

So the custom function would need to return a bool value. I'm going to look around the CK Wiki some more, and maybe dig around in Skyrim's scripts, but if you have an answer that would be very helpful.

 

EDIT: So I looked through Debug.psc since I was hoping I could glean some information on how I would create a IsMenuToggled() function, since ToggleMenus() would have to know if the menus were already toggled, or else it wouldn't be able to choose whether or not to turn the menus on and off (it wouldn't know if you already had the menus on, or if they were off), but all I found was this:

 

; Toggles menus on/off
Function ToggleMenus() native global

Is there any way to see what the function actually does? Custom functions have to be declared with a header, then the content of the function, and an endfunction, but I can't find what ToggleMenus() does in Debug.psc. Does anyone know where I might find that information?

 

 

Secondly, is there a way to create a smooth zoom effect? Right now I've tried this:

 

 

	
Function ZoomIn()

        ZoomAmount = Utility.GetINIFloat("fDefaultWorldFOV:Display")	as Float
	Debug.ToggleMenus()
	Utility.Wait(0.5)
	Game.ShowFirstPersonGeometry(false)
	Utility.SetINIFloat("fDefaultWorldFOV:Display", 12)
	Utility.Wait(0.05)	
	Input.TapKey(Input.GetMappedKey("Tween Menu"))
	Utility.WaitMenuMode(0.3)
	Input.TapKey(Input.GetMappedKey("Tween Menu"))
	Utility.Wait(0.05)	
	PressedOnceZoom = true
	Utility.Wait(0.05)	
	Debug.ToggleMenus()

EndFunction

 

 

 

And it's quite jerky. I've tried it without the Utility.Waits but that didn't work very well either. I took a look at Face to Face Conversation, but it used native functions, which, like I said above, I can't find out what they actually do, since it just shows the name of the function, its parameters, and its flags.

Edited by Matthiaswagg
Link to comment
Share on other sites

From the CK wiki

 

 

The "Native" flag indicates a function that does not have a function body, because the function is implemented by the game itself. If you add the native flag to a function the game does not expose, the compiler won't complain, but the game will error at you. The same flag cannot be specified more than once.

You cannot see what it does because it calls upon an existing function already within the game. Most likely the ToggleMenus console command.

Link to comment
Share on other sites

From the CK wiki

 

 

The "Native" flag indicates a function that does not have a function body, because the function is implemented by the game itself. If you add the native flag to a function the game does not expose, the compiler won't complain, but the game will error at you. The same flag cannot be specified more than once.

You cannot see what it does because it calls upon an existing function already within the game. Most likely the ToggleMenus console command.

 

OK... Hmmm. Then how would somebody create their own Native function? This question is mostly unrelated to the OP question, but I'm just curious how you would implement something. And if it's exposed in the game, is there any possible way I could find the way it works through the CK?

Link to comment
Share on other sites

I do not know how or if it is possible to create a native function. I suppose someone with more knowledge (such as the SKSE team) would need to answer that. I do not think you can see how it works via the Creation Kit.

Thank you for your help. I suppose I'll just have to leave that feature out then.

 

I'm still working on how to get a smoother zoom though.

Link to comment
Share on other sites

What are the chances that a player has menus toggled off when they first load the mod? I would say extremely slim. I would just put as part of the install process that if the player has toggled menus off at some point and they are loading for the first time, they should toggle menus back on and create a new save. Does anybody know of any popular mods that toggles menus off?

 

Finally obviously I would suggest creating a quest stage (or MCM option if the mod already has an MCM) that will allow the player to toggle menus manually and tell your mod what their current state is.

Link to comment
Share on other sites

What are the chances that a player has menus toggled off when they first load the mod? I would say extremely slim. I would just put as part of the install process that if the player has toggled menus off at some point and they are loading for the first time, they should toggle menus back on and create a new save. Does anybody know of any popular mods that toggles menus off?

 

Finally obviously I would suggest creating a quest stage (or MCM option if the mod already has an MCM) that will allow the player to toggle menus manually and tell your mod what their current state is.

OK. I'll add a note to the mod page. But for the user to open the MCM and activate the hotkey, they'd have to toggle the menus on anyway, so it's probably safe to add the feature.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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