its possible via lua. it triggers the default inventory scrolling, not the cycling from the wiki. I have it in my game and its working nicely with scrolling wheel or gamepad. Sadly im not at my computer right now. Will post it asapOnly thing I'm seeing is CharacterItemsScrollPosition but it says it isn't scriptable. I guess you could increment that. Easy enough to get the total of character items. Maybe a function like this...function scrollItm(b) local itm = #(game.CurrentCharacter.CharacterItems) -- + -- if b then and game.CurrentCharacter.ItemsScrollPosition < itm then -- scroll right game.CurrentCharacter.ItemsScrollPosition = game.CurrentCharacter.ItemsScrollPosition + 1 elseif not b and game.CurrentCharacter.ItemsScrollPosition > 0 then -- scroll left game.CurrentCharacter.ItemsScrollPosition = game.CurrentCharacter.ItemsScrollPosition - 1 end end
... I've not used it before & it says it's not scriptable, so no idea if it's correct.
if Values["inventar_open"].Int == 1 and game.Interfaces["inventory"]:getInt(VInterfaceItemsScrollPosition) > 0 then --if inside inventory and scroll position is not at top row
local scrollposition = game.Interfaces["inventory"]:getInt(VInterfaceItemsScrollPosition)
game.Interfaces["inventory"]:setValue(VInterfaceItemsScrollPosition, scrollposition - 5) --scroll by 5 items up
startAction(Actions["inventory_draw_up"])
end
if Values["inventar_open"].Int == 1 and (table.maxn(game.CurrentCharacter:getLinks(VCharacterItems)) -15) > game.Interfaces["inventory"]:getInt(VInterfaceItemsScrollPosition) then --if inside inventory and scroll position is at the end (15 = max items on one page)
local scrollposition = game.Interfaces["inventory"]:getInt(VInterfaceItemsScrollPosition)
game.Interfaces["inventory"]:setValue(VInterfaceItemsScrollPosition, scrollposition + 5)
startAction(Actions["inventory_draw_down"])
end
Here is the method with the interface scroll position:Sure just remind me about it later on in the week. Maybe you would like to provide a template ved & some resource files for it? or maybe some images to go along with the tutorial part of the script?mouse wheel UP Action:1. Execute a script:if Values["inventar_open"].Int == 1 and game.Interfaces["inventory"]:getInt(VInterfaceItemsScrollPosition) > 0 then --if inside inventory and scroll position is not at top row local scrollposition = game.Interfaces["inventory"]:getInt(VInterfaceItemsScrollPosition) game.Interfaces["inventory"]:setValue(VInterfaceItemsScrollPosition, scrollposition - 5) --scroll by 5 items up startAction(Actions["inventory_draw_up"]) end
2. Pause 100msmouse wheel DOWN Action:1. Execute a script:if Values["inventar_open"].Int == 1 and (table.maxn(game.CurrentCharacter:getLinks(VCharacterItems)) -15) > game.Interfaces["inventory"]:getInt(VInterfaceItemsScrollPosition) then --if inside inventory and scroll position is at the end (15 = max items on one page) local scrollposition = game.Interfaces["inventory"]:getInt(VInterfaceItemsScrollPosition) game.Interfaces["inventory"]:setValue(VInterfaceItemsScrollPosition, scrollposition + 5) startAction(Actions["inventory_draw_down"]) end
2. Pause 100msThe Actions "inventory_draw_up" and "inventory_draw_down" are handling sound effects and play a short animation of the arrow blinking to give visual feedback.the name of the interface here is "inventory": you have to replace it if you named your interface otherwise.(i used a value to determine if inside inventory. You can also use a condition if you like)@AFRLme : maybe this can be added to the script index on the wiki?kind regardsSebastian
@sebastian:That's some bug with the forum. Sometimes when you post & you have added a code box it adds ; after some of the characters, mostly < or > - no idea why.
You see me stunned. The luadocs say that ItemsScrollPosition is not scriptable, so I haven't tried that. I will do so at once.
Thanks a lot for this hint.
Edit:
Works like a charm! And the behaviour is exactly how I wanted it.
PS: In the code boxes above you have to delete the semicolons in the first lines. The screenshots are alright.