Sure,
In the Multiverse Client workspace for C# I will use the solution explorer tab to locate the Multiverse.Base project and open it and then into the 'input' section locate the file named:
InputHandler.cs Open it, search for:
- Code:
-
// Used by client API
note the method:
- Code:
-
// Used by client API
bool CameraGrabbed { get; set; }
bool MouseLookLocked { get; set; }
Note we have added access to the MouseLookLocked method for set and get, this will be exposed to the bindings file according to this comment:
- Code:
-
// These are used by the bindings file
Also take mind that the output file that will contain this change is file:
MultiverseBase.dll Next we move to the client side script file named :
ClientAPI.py This is located in the Scripts folder on the client side.
Search the file for this code:
- Code:
-
def GrabPlayerCamera():
InputHandler.CameraGrabbed = True
def ReleasePlayerCamera():
InputHandler.CameraGrabbed = False
We will add below it:
- Code:
-
def GrabMouseLook():
InputHandler.MouseLookLocked = True
def ReleaseMouseLook():
InputHandler.MouseLookLocked = False
hah, python whitespace don't forget
So now we want to bind escape to activate the method.
Starting in the AssetRepository for your world, here sampleworld is used, Locate the folder:
sampleworld/Interface/FrameXML/Locate your binding.txt file, verify escape is bound to the command you want, currently it is bound to a name:
TOGGLEGAMEMENU Relates to the bindings.xml file beside it which has the code:
- Code:
-
<Binding name="TOGGLEGAMEMENU" header="UIOPERATION">
ToggleGameMenu()
</Binding>
Here I have added the call to:
ToggleGameMenu()Here is the code:
- Code:
-
def ToggleGameMenu():
frame = getglobal("GameMenu_UI")
if not frame.IsVisible():
ClientAPI.Write("Open Game Menu")
frame.Show()
ClientAPI.ReleaseMouseLook()
else:
ClientAPI.Write("Close Game Menu")
frame.Hide()
ClientAPI.GrabMouseLook()
I am certain we can leave you to handle the remaining portion which is to include this ToggleGameMenu in a python script that you load via an XML file decalared in a *.toc file.
Fairly certain I did not leave anything out, be sure to provide some feedback.
Hope it helps!