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.
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,
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 "
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.