Jump to content

How to use script close a book?


azzendix

Recommended Posts

Problem:

I created the mod and use a book as option menu. I want to skip the "close a book" part after using menu. Any way to do it with a script?

 

 

Detail:

Here is an example screenshot from Violens mod.

http://i.imgur.com/oa6bKx8.jpg

 

General book menu

Open inventory menu -> Read that book -> (the book open) -> (the message box show up) -> choose option and exit -> press Tab/Esc to close the book -> Back to inventory menu

 

What I want to do

Open inventory menu -> Read that book -> (the book open) -> (the message box show up) -> choose option and exit -> (the book close automatically) -> Back to inventory menu

 

This is my book script.

Scriptname _TakeCare_Book extends ObjectReference  

Message Property _TakeCare_MainMenu  Auto  
Message Property _TakeCare_Msg  Auto  
_TakeCare_Quest Property _TakeCare_Quest_Property  Auto  

Event OnRead()
	Utility.WaitMenuMode(1.0)
	Menu(0)
EndEvent

Function Menu(Int aiButton)
	If aiButton == 0	
		aiButton = _TakeCare_MainMenu.Show()
		If aiButton == 0				; Turn ON message
			_TakeCare_Quest_Property.Status = 1	
		ElseIf aiButton == 1				; Turn OFF message	
			_TakeCare_Quest_Property.Status = 0	
		EndIf
	EndIf	
EndFunction
Edited by azzendix
Link to comment
Share on other sites

I put "return" to all three button. None of them auto-close the book.

What am I doing wrong?

 

Here is my current script.

Scriptname _TakeCare_Book extends ObjectReference  

Message Property _TakeCare_MainMenu  Auto  
Message Property _TakeCare_Msg  Auto  
_TakeCare_Quest Property _TakeCare_Quest_Property  Auto  

Event OnRead()
	Utility.WaitMenuMode(1.0)
	Menu(0)
EndEvent

Function Menu(Int aiButton)
	If aiButton == 0	
		aiButton = _TakeCare_MainMenu.Show()
		If aiButton == 0							; Turn ON message
			_TakeCare_Quest_Property.Status = 1	
			return
		ElseIf aiButton == 1							; Turn OFF message	
			_TakeCare_Quest_Property.Status = 0
			return
		ElseIf aiButton == 2							; Exit
			return
		EndIf
	EndIf
EndFunction
Edited by azzendix
Link to comment
Share on other sites

Checked it. Black book auto-close and back to 1st person view not inventory menu.

I think It can be done with this code.(from creation kit website)

Game.DisablePlayerControls(False, False, False, False, False, True) ; Ensure MessageBox is not on top of other menus & prevent book from opening normally.
Game.EnablePlayerControls(False, False, False, False, False, True) ; Undo DisablePlayerControls

Not really what I want but thank for the answer. Lisselli and lofgren.

Look like it's a bit too far from my knowledge. I decide to leave it that way.(or use code above, at most)

Edited by azzendix
Link to comment
Share on other sites

 

I put "return" to all three button. None of them auto-close the book.

What am I doing wrong?

 

 

Nothing. That was my mistake. Return works well when you're using a menu that is'nt invoked from opening a book. My mod doesn't use books.

 

The code on that wiki is actually the old Oblivion way of making menus. It's much easier to just use separate menu "functions", than nesting a while loop.. if you think about trying the examples there.

Edited by Lisselli
Link to comment
Share on other sites

  • Recently Browsing   0 members

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