Jump to content

Looking for a way to get the formID of the highlighted item in the inventory


Hjorr

Recommended Posts

Hello Everyone,



I'm trying to get the formID of the item that has got mouse focus on while in the inventory, In other words, the item which is highlighted, not necessarily activated.


I've done some research, and I think that I have found what I need, but I can't seem to make it work properly.


My script compiles with no errors but the notification displays Item = None on the "activate" while in inventory Keyup event.


Other users seem to have used the same path (_root.Menu_mc.inventoryLists.itemList.selectedEntry.formId) with success


Any idea of what I'm doing wring here? I could really use some help. Thanks in advance!




Here's my script:



Event OnInit()


IKey = Input.GetMappedKey("Activate")

RegisterForKey(IKey)


EndEvent



Event OnKeyUp(Int KeyCode, Float HoldTime)


If KeyCode == IKey


Form ValuableItem = Game.GetFormEx(UI.GetInt("InventoryMenu", "_root.Menu_mc.inventoryLists.itemList.selectedEntry.formId"))

debug.Notification("Item = " + ValuableItem)


EndIf

EndEvent


Link to comment
Share on other sites

Ok, solved. The script works with SKYUI installed. I just needed to extract and copy the SKYUI .psc and .pex scripts into the data/scripts folder and then to import them in my script like so.

 

 

Scriptname AYF_BardQuestScript extends Quest
import ski_activeeffectswidget
import SKI_ConfigBase
import SKI_ConfigManager
import ski_configmenu
import ski_favoritesmanager
import ski_main
import SKI_PlayerLoadGameAlias
import ski_qf_configmanagerinstance
import SKI_QuestBase
import ski_settingsmanager
import ski_widgetbase
import ski_widgetmanager
MiscObject Property Lute Auto
MiscObject Property Flute Auto
MiscObject Property Flute01 Auto
MiscObject Property DancersFlute Auto
MiscObject Property Drum Auto
string itemName
Int IKey
Event OnInit()
IKey = Input.GetMappedKey("Activate")
RegisterForKey(IKey )
EndEvent
Event OnKeyDown(Int KeyCode)
If KeyCode == IKey
itemName = UI.GetString("InventoryMenu", "_root.Menu_mc.inventoryLists.itemList.selectedEntry.text")
debug.Notification("Item = " + itemName )
EndIf
EndEvent
Link to comment
Share on other sites

  • Recently Browsing   0 members

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