inventory dimensions

Started by ManicMatt, Sun 04/12/2005 18:32:17

Previous topic - Next topic

ManicMatt

I'm sure you ALL know this one... help me out please!

The manual informs me to adjust the dimensions for my inventory I must use this code in the global game start:

invMain.ItemWidth = 50;
invMain.ItemHeight = 30;

But it says:

Undefined token: invMain

Just to be clear here is how it is laid out on my script:

#sectionstart game_start  // DO NOT EDIT OR REMOVE THIS LINE
function game_start() {
  // called when the game starts, before the first room is loaded
game.bgspeech_stay_on_display = 0;
invMain.ItemWidth = 50;
invMain.ItemHeight = 30;
}

I'm using version 2.70

Thanks!

Ashen

#1
invMain is just a pointer - you'll need to replace it with the script name of the inventory window you want to change the dimensions for. (There's no global set dimensions function, as far as I know - if you've got multiple inventory windows, you need to set each of them seperately.)
I know what you're thinking ... Don't think that.

Akumayo

Darnit Ashen, as soon as I look up the answer and log in, you've already answered.  Bah!   ;)
"Power is not a means - it is an end."

ManicMatt

#3
Thanks for the quick reply!

my inventory is the default one. How do i know what it's defined script name is?

EDIT:  ooh what's this? script-o-name?

Akumayo

I'm not positive, but I don't think that there is a name for it, as in, it can't be manipulated like a normal inventory screen. Ã, Look into create a custom one, it's really very easy.
"Power is not a means - it is an end."

Ashen

#5
The hardcoded one, I don't think you can change (someone correct me if I'm wrong). The one on gInventory -  just click on it and read the properties box, it's invCustomInv.

Quoteooh what's this? script-o-name?
1. Don't double post.
2. Umm, what? Sorry, what was the point of this post, you're asking what a script-o-name is in general?
I know what you're thinking ... Don't think that.

ManicMatt

Oh sorry.

In honesty I was just writing script-o-name incase you said that's the script name, so i looked clever. this was not the case.

I don't understand. Click on it and read the properties box? What, the bit with the x and y etc? My head is spinning! (Although maybe that's because I'm hungry)

So basically, I should ditch the default inventory and create a new, custom one?

Ashen

#7
There're (sort of) two default inventories, and I don't know which one you're talking about.
One is hard-coded into AGS, and I don't think you can change anything about it.
The other is the INVENTORY GUI in the GUI editor (script-o-name gInventory). That you can change as much as you want. Click on the Inventory Window object to view it's properties (script name, x position, y position, width, height, Character ID and - crucially - Item width and height). Character ID is what character's inventory it displays (-1 for whatever the player character is). Item width/height do the same thing as the commands you're using - if you don't need to change the item dimensions in-game, just set the here and leave them alone.
If you do need to change in-game (for soem reason), the command would be:
Code: ags

invCustomInv.ItemWidth = 50;
invCustomInv.ItemHeight = 30;


You can tell which (gInventory or the hard-coded one) is used by checking the show_inventory_window function, in the Global Script.

EDIT: I think the default default is now the GUI version (it used to be the hard-coded one), so changing the settings on INVENTORY should be all you need to do. This had gotten far more complicated than I meant it to ...
I know what you're thinking ... Don't think that.

ManicMatt

Mine is indeed the ginventory one.

Anyway, it seems that my problem here was, that I thought the menu that popped up was the only menu. I didn't know that you could click on the actual GUI and get a different menu! Duh!

So in other words, I thought scripting it was the ONLY solution! (No wonder the forum search came up with nothing useful, or up to date.)

Thanks Ashen and Akumayo!


SMF spam blocked by CleanTalk