This thread is a few years old. Some details may refer to an earlier version of Visionaire Studio. Current tutorials
Hi!If he didn't include a note in the script or a message in his post about not being able to modify his code then you can share your edited version.I made two changes to the original code by Simon:1- The scrolling only happens when the player has an item selected (dragged);2- The scrolling is now endless. When the player reaches the first item in the inventory, Visionaire will automatically select the last item; When the player reaches the last item in the inventory, Visionaire will automatically select the first one. Obviously the player can exit the endless cycle with the mouse right click.I would post the edited code but I don't know if I can! I'm waiting for Simon's permission to do so!
-- author: SimonS
-- Inventory scrolling by mouse wheel
registerEventHandler("mouseEvent", "mouseEvtHandler")
function mouseEvtHandler(evt)
if evt == eEvtMouseWheelUp then
if not game.UsedItem:isEmpty() then
wheelUp()
end
end
if evt == eEvtMouseWheelDown then
if not game.UsedItem:isEmpty() then
wheelDown()
end
end
end
function wheelUp ()
local items = game:getLink(VGameCurrentCharacter):getLinks(VCharacterItems)
local len = table.getn (items)
local usedItem = game:getLink(VGameUsedItem)
if len == 0 then
game:setValue(VGameUsedItem,getObject("(-1,-1)"))
else
if usedItem:isEmpty() then
game:setValue(VGameUsedItem,items[1])
else
for index = 0, len-1, 1 do
if items[len-index]:getName() == usedItem:getName() then
if len-index == len then
game:setValue(VGameUsedItem,items[1])
else
game:setValue(VGameUsedItem,items[len-index+1])
end
break
end
end
end
end
game:setValue(VGameUsedItemPicked,true)
end
function wheelDown ()
local character = getObject("Game.GameCurrentCharacter")
local items = character:getLinks(VCharacterItems)
local len = table.getn (items)
local usedItem = game:getLink(VGameUsedItem)
if len == 0 then
game:setValue(VGameUsedItem,empty)
else
if usedItem:isEmpty() then
game:setValue(VGameUsedItem,items[len])
else
for i = 1, len, 1 do
if items[i]:getName() == usedItem:getName() then
if i == 1 then
game:setValue(VGameUsedItem,items[len])
else
game:setValue(VGameUsedItem,items[i-1])
end
break
end
end
end
end
game:setValue(VGameUsedItemPicked,true)
endThis thread is closed because nobody has replied for more than a year. Feel free to ask your question in a new thread.
New threadDeponia, The Whispered World and more than 160 other games were made with Visionaire Studio. The free version covers up to 25 scenes. For more scenes there is Visionaire Studio PRO from €75, and to sell your game the Indie Bundle for €99.
Through December 1: all licenses 30% off, for example the Indie Bundle for €69.30 instead of €99. Applied automatically at checkout.