SetHotKeyItem

Post » Tue Jan 19, 2016 2:36 pm

Hi,



I am working on a reassigning system for hotkeys.


I've an item, which can be used. It's actually a misc item so it disappears when it is used.


But if it gets applied to a hotkey, the hotkey is of course cleared out since the item which is used with that hotkey disappears.



So I've now a function which checks if the item is anywhere on a hotkey.



That already works pretty well.



However, everytime I want to use the SetHotKeyItem command, the item doesn't get reassigned.


I think that might be probably happening because I cannot use a base object to assign it to a hotkey.



Instead I need an inventory ref? So the problem I have is that I don't know how I can get an inventory ref.


I've tried this, but it doesn't work :(



if Player.GetItemCount SteinArkan > 0

let HkArray := Player.GetInvRefsForItem SteinArkan

if HkReset1

Set HkReset1 to 0

Let HkItem1 := HkArray[0] ;==>HkItem1 is a reference variable

SetHotKeyItem 1, HkItem1

endif
[...]

Any ideas?



Cheers



Addition: Just realized that HkReset1 is zero (0) from the start, while it should be one (1).


So that function doesn't even get processed. :sadvaultboy:


Problem lays elsewhere, gonna look through it again.


So nevermind :)



Cheers



Another addition: Seems the problem is related to a weird script behaviour.


I've changed to a system where the IDs are used, but no extra reset variables.


And I've checked with a console message and 8 ref variables if the IDs are valid through the "%n" code.


I got the name "Arkanstein" printed out on any ID where that item was set to the respective hotkey.



It was an ID which was retrieved through the "GetInvRefsForItem" function and an array variable. So even that command works fine.


I've set the ref variables to the ref ID of array[1] and used 10 Arkansteine in a row. I always got printed out "Arkanstein, , , , , , , ", since I set the Arkanstein to hotkey 1, while the other hotkeys were used with other objects so the variable gets cleared out instead of overwritten with Arkanstein array[1].


I just did not get any message for the last Arkanstein, since I used "Player.GetItemCount Arkanstein > 1", because it is no use if there is only one Arkanstein left.



However, the ref variable gets cleared somehow. I've checked it later in the script with another console message and everything was "", even if they didn't got cleared through any script lines at this point. :(


I use "SetHotkeyItem" only if the variables are valid (refVar != 0), but since all ref variables are cleared it doesn't get processed.


Well, I reverted back to the original system.


I don't mind, if the item gets cleared out of a hotkey that much.

User avatar
Matthew Barrows
 
Posts: 3388
Joined: Thu Jun 28, 2007 11:24 pm

Post » Tue Jan 19, 2016 7:32 pm

Since items in inventory have no reference, it's useless (if not harmful) to use a reference here.


Also, the command expect a base object (item or spell), so directly pass SteinArkan to the command.

User avatar
Emma
 
Posts: 3287
Joined: Mon Aug 28, 2006 12:51 am

Post » Tue Jan 19, 2016 1:54 pm

Strange, that was the first thing I tried.


But it didn't work either :(


So I guessed I need a accurate inventory reference. If items in the inventory have no reference at all, why does the "GetInvRefsForItem" function even exists? :o



However, I am fine with not having the possibility to add it to a hotkey like some potion.


That function was actually never implemented in Nehrim.


Only Oblivion had such a (hardcoded?) function to destroy Welkynd stones to regenerate magicka.



So if the magicka needs to be restored during a battle in our Nehrim addition, the menu has to be opened and the stone needs to be clicked manually.


It's not a big deal. :)

User avatar
Bethany Short
 
Posts: 3450
Joined: Fri Jul 14, 2006 11:47 am

Post » Tue Jan 19, 2016 8:34 pm

Enhanced Hotkeys by TheNiceOne allows you to add potions and Welkynd stones to your hot keys. You might want to have a look at how he did it.
User avatar
Ashley Tamen
 
Posts: 3477
Joined: Sun Apr 08, 2007 6:17 am

Post » Tue Jan 19, 2016 3:58 pm

Wow, thanks for that tip.


Description says that it is even compatible with Nehrim, so I doubt that it is necessary to even do it myself in my own mod.


Seems there are also no incompatibilities with my mod. :)

User avatar
Mrs shelly Sugarplum
 
Posts: 3440
Joined: Thu Jun 15, 2006 2:16 am

Post » Tue Jan 19, 2016 9:49 am

I thought it was compatible with Nehrim, but I wasn't sure. TNO is a genius. :D
User avatar
Mariaa EM.
 
Posts: 3347
Joined: Fri Aug 10, 2007 3:28 am

Post » Tue Jan 19, 2016 3:26 pm

IIRC you need to swap the master. It has Oblivion.esm but it's safe to swap the master as EH use no data from it.

User avatar
Robert
 
Posts: 3394
Joined: Sun Sep 02, 2007 5:58 am


Return to IV - Oblivion