Jump to content

Script help, need Form Type ID


Recommended Posts

We'll need a bit more information on what you're talking about here:

 

1. In what way do you "left-click" the object(s) in question? (i.e. console mode, inventory menu, etc.)

1a. If "left-click" occurs in inventory menu, is it the Player's inventory, a creature or NPC's inventory, a container's inventory, or any just inventory?

 

2. Are you trying to identify one or more specific books, or are you trying to identify if an object is a book of any title?

 

3. What is the script intended to do once the object is identified?

Link to comment
Share on other sites

It's my mod here, Taking books or scrolls after you've read them (you automatically read them when you click on them) isn't working correctly. I need some way to identify that it's a book or scroll you're reading and then disable the spacebar until it's in your inventory. According to OBSE documentation, MenuMode 1026 means 'book', but MenuMode returns 0 when reading a book or scroll. My next thought was to identify the object clicked as a book or scroll, and I need to get the Form Type ID to do that. Here's my current source code (sans experiments to get this working).

 

EDIT: MenuMode 1026 works if you're reading something already in your inventory, but not if you're reading something just laying in the game world (which is where the problem is).

scriptname XBOX_Controller_Script


float fQuestDelayTime
int DropAndGrab


begin MenuMode
    If MenuMode == 3 ;checks if console is open
        EnableKey 57 ;spacebar
        EnableKey 256 ;left mouse button
    Else
        DisableKey 57 ;spacebar
        EnableKey 256 ;left mouse button
        If IsKeyPressed2 44 ; Z button
            Set DropAndGrab To 1
        EndIf
    EndIf
end


begin GameMode
    set fQuestDelayTime to 0.001
    EnableKey 57 ;spacebar
    If IsKeyPressed2 44 ; Z Button
        If DropAndGrab == 1
            EnableKey 256 ;left mouse button
        EndIf
    Else
        Set DropAndGrab To 0
        DisableKey 256 ;left mouse button
    EndIf
end 
Edited by digitaltrucker
Link to comment
Share on other sites

Since I remapped the ACTIVATE control using the in-game options, everything works perfectly as expected. It is amusing though that a book or scroll isn't necessarily a book or scroll in the eyes of the game code. The making of this mod has exposed some really weird code behavior in Oblivion. None of it is noticeable using a kb/m as the was intended to be played, but it gets exposed when you start mapping keyboard keys to controller buttons.

Link to comment
Share on other sites

In my controller mod for Oblivion, I'm attempting the daunting task of replicating the XBox control style. It's working really well, actually, but it's not perfect (you know what I mean). What I'm trying to get working now is the ability to click a menu button with a keyboard key without having to highlight the button with the cursor first. I'm trying to eliminate the need to drag the cursor around anywhere but in the map menu, and I'm close...so close. I'm beginning with the Haggle button in the barter menu. On the XBox, pressing the Y button on the controller opens the barter menu. With the setup I'm using, the Y button on the controller is mapped to the E key on the keyboard. The script so far is as follows:

If GetActiveMenuMode == 1008
	If OnKeyDown 18 ;E key
; 		Set QualifiedName To GetActiveUIComponentFullName
; 		Set iCurrentMenuMode To GetActiveMenuMode
; 		PrintToConsole "%z", QualifiedName
; 		PrintToConsole "%.0f", iCurrentMenuMode
		ClickMenuButton "cont_background\page_layout\cont_contents\cont_button_haggle" 1008
	EndIf
EndIf

The commented out lines are just used for gathering info in my own testing. It works, but only if the Haggle button is highlighted with the cursor. I'm really unfamiliar with XML (to me, it sort of looks like what you'd be left with if weasels attacked your Scrabble game...but I'm slowly catching on). So, I have two questions;

 

1) What IS the fully qualified name for an un-highlighted Haggle button?

2) How do actually find that info in the xml file? I'm pretty sure it's somewhere in container_menu.xml...

 

Thanks in advance!

Edited by digitaltrucker
Link to comment
Share on other sites

The information close to what I believe you're looking for is buried in this code:

<xbuttony> <ref src="cont_button_haggle" trait="clicked"/> </xbuttony>

This line I'm sure delegates the "Y" controller button as the shortcut for the haggle button on Xbox. The problem I'm having, and perhaps you now as well, is determining if this line of code can be replaced to referencing a keyboard key instead, but I'm not sure a) if it can be done, and b) where to go to find out how it could be done. I'm not an expert at XML myself, but I think I have enough of a grasp that I know this is what causes the Xbox version to function like it does, because I've been able to adjust various other UI elements assuming that philosophy and the effect was just as I expected.

 

Digital - you mentioned you want to be able to navigate the UI without needing to use the mouse. Let me try to set you up with my entire /menus/ folder; go through the message_menu, container, map, inventory, and dialogue menus and look at what I have done. I am using DarN's interface so a lot of his remarks are in there. Also, feel free to compare it with the Stock Oblivion XML's which I'll also put in. I guess I'll try to put in a shared Google folder - one will be my /menus/ folder and the other will be the stock ones.

 

https://drive.google.com/folderview?id=0B40O3mUV0uACaklmYkFBSEg4WU0&usp=sharing

 

Basically, the lines you should be interested in that allow you to navigate the UI without the cursor are the lines that look like this:

<xleft> <ref src="cont_tabs_prev" trait="clicked" /> </xleft>

xleft and xright are buttons that the PC version of Oblivion understands even though they appear to refer to DPAD left and right on an xbox controller. So, simply find the command you want to assign a control to and assign it. The only issue is that you can only assign the 4 directional buttons to any menu command so far. For instance, if I wanted to use the haggle shortcut like on xbox, I would have to make the line I posted earlier that referenced haggling like this:

<xup> <ref src="cont_button_haggle" trait="clicked"/> </xup>

This assigns the up arrow to the haggle shortcut button. In addition, you could change the trait="clicked" portion to trait="mouseover", and that will allow you to just mouseover that option instead of clicking it like a shortcut. The problem with this approach however is that you want to be able to use the up and down arrow/direction keys to scroll through the item list in a container, as detailed in this line of code:

<!-- This element is a list item. If it gets an input command it doesn't know how to handle
							it will defer the command to its parent. The xlist trait set to true triggers this. -->
						<xdefault> &false; </xdefault>
						<xlist> &xitem; </xlist>
						<xup> &prev; </xup>
						<xdown> &next; </xdown>
						<xscroll>
							<copy src="me()" trait="listindex" />
							<sub>
								<copy src="cont_scroll_bar" trait="user8"/>
								<div> 2 </div>
								<ceil> 0 </ceil>
							</sub>
							<add> 1 </add>
						</xscroll>

That is sort of a template method of doing item cycling in containers using the directional buttons of a keyboard. It is consistently used across all the interface xml's with each using some different variables for src's depending on the context of the menu UI. I believe the parent file that heads all this information is master_menu_file in the stock Oblivion XML folder.

 

I gotta peace out ATM but let me know if you are able to get anywhere with this, or if I'm on completely the wrong track in trying to help. I'm currently working on getting Skyrim's controller functionality up to par - especially when it comes to interfacing the controller with SkyUI's MCM tool. Otherwise I'd be all over this.

Link to comment
Share on other sites

  • Recently Browsing   0 members

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