Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: Inventory box  (Read 4281 times)

0 Members and 1 Guest are viewing this topic.

valter.home

  • Supporter
  • Occasional poster
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 55
    • View Profile
Inventory box
« on: October 11, 2015, 05:15:52 PM »

Hello, I'm customizing the inventory and I'm trying to change the size dynamically according to the items contained and displaying on one or two lines.
No problem to resize the window and place it at the center of the screen, but I have difficulty with INVENTORY_BOX.
Can I dynamically change the value AREA {x, y, Width, Height}?
Or I should write on the file inventory.def (if that is possible)?
Logged

valter.home

  • Supporter
  • Occasional poster
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 55
    • View Profile
Re: Inventory box
« Reply #1 on: October 11, 2015, 05:56:57 PM »

I did so, but I do not know if it is a useless work around.
I made copies of Inventory.def changing only the values for the Inventory box.
Then from code I use Game.LoadInventoryBox("interface \ myfile.def") and everything works perfectly.
But I ask you, is that correct or is there an instruction that allows me to change AREA InventoryBox without use this files?
Thank you
Logged

eborr

  • Regular poster
  • ***
  • Karma: 4
  • Offline Offline
  • Posts: 196
    • View Profile
Re: Inventory box
« Reply #2 on: October 12, 2015, 01:18:39 PM »

The inventory window behave pretty much like any other window.

If in the project manager you select the inventory widow - click on the three dots and choose edit, the current inventory window will appear in the window editor and you can set it up as you wish.

You have programmatic access to the same set of windows attributes, for reference take a look at the windows object in the scripting language reference.
Logged

valter.home

  • Supporter
  • Occasional poster
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 55
    • View Profile
Re: Inventory box
« Reply #3 on: October 12, 2015, 02:17:05 PM »

Hello, I was looking for a way to avoid creating different inventory window only to have a different value (AREA inventory box).
I had already looked into the guide, unfortunately I could not find a solution.
If I write
win = Game.LoadWindow ("interface \ inventory.window");
winbox = win.GetControl ("Inventory box");
I can't access the property Area (x, y, Width, Height) of winbox.
I've the same problem with the definition file of the sprites, I would change HOTSPOT {x, y} from code but I can't figure out if I can do this and how.
I'm thinking to create file.sprite where I impose hotspot and then reloading it.
I can't seem to access these properties  :(, have you a link with small code?
Thank you
Logged

anarchist

  • Regular poster
  • ***
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 212
    • View Profile
Re: Inventory box
« Reply #4 on: October 13, 2015, 09:05:48 PM »

I haven't tried this but I found in documentation the command Game.GetInventoryWindow(). Hope this helps you a bit. I haven't had the need to modify my inventory so far so can't help you further.
Logged

valter.home

  • Supporter
  • Occasional poster
  • *
  • Karma: 1
  • Offline Offline
  • Gender: Male
  • Posts: 55
    • View Profile
Re: Inventory box
« Reply #5 on: October 15, 2015, 09:30:49 AM »

Yes, I am already using this command.
The reason to change inventory box at runtime is because I don't like the inventory with the scroll button and depending on the number of objects contained in the inventory I change the number of rows and I resize width and height.
Thanks anyway, probably to have various forms of inventory is the only way.
Logged
 

Page created in 0.022 seconds with 20 queries.