Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Small inventory scrolling quirk  (Read 1255 times)

0 Members and 1 Guest are viewing this topic.

Mikael

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 124
    • View Profile
    • MDNA Games
Small inventory scrolling quirk
« on: February 05, 2012, 04:19:02 PM »

This is not a big problem, but if it could be fixed easily, it would be nice.

In my game, a total of 15 inventory items can be seen at once. In this first picture, I have 18 items, and the inventory has been scrolled all the way to the right, using the right arrow (not visible in the screencap, since no more right scrolling is possible). That means that 3 items are "hidden" to the left. Nothing strange this far.

http://www.mdna-games.com/priv/inv_1.jpg

Shortly after this scene, 4 items disappear from the inventory for various reasons. During that period, I don't have to access any of the 3 "hidden" items. That is, I don't have to scroll to the left. This leaves me with an inventory looking like this:

http://www.mdna-games.com/priv/inv_2.jpg

Is there any way to automatically fill the maximum number of blank spaces in the inventory?
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Small inventory scrolling quirk
« Reply #1 on: February 05, 2012, 05:16:15 PM »

Something like this?

Code: WME Script
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Mikael

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 124
    • View Profile
    • MDNA Games
Re: Small inventory scrolling quirk
« Reply #2 on: February 05, 2012, 06:03:42 PM »

Still same result ... I guess that it's of no crucial importance how or where i place the code?

Edit:
I think I see now... But it requires that the code is added everytime an object is removed from the inventory, and there's a potential risk for an "unwanted" blank?
« Last Edit: February 05, 2012, 06:12:32 PM by Mikael »
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: Small inventory scrolling quirk
« Reply #3 on: February 05, 2012, 08:06:45 PM »

not really. you can override the Game.DeleteItem and calculate the position based on current amount of inventory items.

in game.script something like:

Code: WME Script
  1.  
  2. method DeleteItem(item)
  3. {
  4.     var numberOfSlots = 8; // how many slots are there in upper inventory
  5.  
  6.     Game.DeleteItem(item);
  7.    
  8.     var endPosition = Game.InventoryScrollOffset + numberOfSlots - 1;
  9.    
  10.     if (endPosition > Game.NumItems)
  11.     {
  12.          endPosition = Game.NumItems - numberOfSlots;
  13.          if (endPosition < 0) endPosition = 0;
  14.          Game.InventoryScrollOffset = endPosition;
  15.     }
  16.  
  17. }
  18.  

It's untested so if it doesn't work, skype me. :)))
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet
 

Page created in 0.267 seconds with 23 queries.