Going back to a room you have allready visited [SOLVED]

Started by Bhup, Wed 05/01/2005 17:26:58

Previous topic - Next topic

TerranRich

Curious about the manual? Did you read this forum's sticky thread about the rules and resources? The AGS manual is the AGS help file. Press F1 in AGS or look at AGS.CHM.
Status: Trying to come up with some ideas...

Bhup

#21
To anybody reading this I discovered some helpful info.Ã,  :)

Quote
1. Go to menu "Script" -> "interface_click"
Quote


In the script under the function show_inventory_window ()Ã,  there is commented out code for adding a custom window.Ã,  So it seems that one just needs to "uncomment" the bit under "custom inventory window". This code maybe seen below I haven't uncommented the custom bit yet though.

Code: ags

function show_inventory_window () {
Ã,  // This demonstrates both types of inventory window - the first part is how to
Ã,  // show the built-in inventory window, the second part uses the custom one.
Ã,  // Un-comment one section or the other below.
Ã,  
Ã,  // ** DEFAULT INVENTORY WINDOW
Ã,  InventoryScreen();
/*Ã,  
Ã,  // ** CUSTOM INVENTORY WINDOW
Ã,  GUIOn (INVENTORY);Ã,  
Ã,  // switch to the Use cursor (to select items with)
Ã,  SetCursorMode (MODE_USE);
Ã,  // But, override the appearance to look like the arrow
Ã,  SetMouseCursor (6);
*/
}


Quote
2. where "INVENTORY" is either the name or the number of your custom inventory GUI.
3. Yes.
Cool/ich dankbar/ich der Gedanke dasÃ,  Ã, ::)

Scorpiorus

Quote from: Bhup on Thu 13/01/2005 18:23:24
Strazer, Thanks again for the tip.Ã,  :)

But...if I may point out you don't appear to be very generous with your explanations :P
for example, :

You see, most of the things you have asked about is either covered in the AGS Manual or AGS Beginners FAQ. Strazer tries pointing you to the right direction in solving the issues, so that you could open the manual and find the info on the related topics; but it's hard to know in advance of all the possible problems you may face, therefore that's how it works -- you try solutions that people suggest and then post back your following specific questions, if any. But if you need a generous (yet broad) description on a certain topic then the best way, really, is to browse the manual and read through the BFAQ. But of course that doesn't mean you can't post questions that are already covered by the manual. We just can't quote large sections from the manual because otherwise it'd be simplier to direct to it. :)

QuoteIt appears that I was right this also is the same script revealed by EditScript in the GUI option.

Yeah, "edit script..." leads you into the interface_click function of the main global script.

QuoteIn the script under the function show_inventory_window ()Ã,  there is commented out code for adding a custom window.Ã,  So it seems that one just needs to "uncomment" the bit under "custom inventory window". This code maybe seen below I haven't uncommented the custom bit yet though.

Yep, uncomment the custom inventory script but be also sure to comment out (or remove) the InventoryScreen(); function there, because it displays the built-in inventory window (which you don't need). :)

Bhup

#23
Scorpiorus,
Quote
Yeah, "edit script..." leads you into the interface_click function of the main global script.
Actually I have withdrawn my claim that Edit Script in the GUI tab is the same as the main global script in -> script ->interface_click.Ã,  "Edit Script", does not lead to the "main global script". Edit Script only partially shows some code which belongs to the GUI.Ã,   8) I don't know whether it is generic code in response to the default/built in Gui or what.Ã,  What are your thoughts???

Oh yes and one more thing, I am also confused as to the Gui one is presented with when going into the INVENTORY  tab in GUI. I understand that Ags has a built in  inventory window which cannot be changed my question is: is the inventory window in INVENTORY,  the default/built in inventory screen/window, if so why am I allowed to add a slider to it. ??? (By the way adding a slider does not make any difference to my game, it simply does not register it. Again Why is this?)

I want to create my own Gui because the default one does not seem to allow more than 5 objects.  :o
Bhup     ;D

Scorpiorus

#24
Quote from: Bhup on Fri 14/01/2005 14:11:54Actually I have withdrawn my claim that Edit Script in the GUI tab is the same as the main global script in -> script ->interface_click.Ã,  "Edit Script", does not lead to the "main global script". Edit Script only partially shows some code which belongs to the GUI.Ã, Ã,  8) I don't know whether it is generic code in response to the default/built in Gui or what.Ã,  What are your thoughts???

Yes, clicking the "Edit Script" button will only show you the content of the interface_click function as there is a little need to view the whole global script. However, you can also open the global script and find the same interface_click code there.

The thing is, a GUI in AGS is not exactly what you might thought of. Yes, a word GUI stands for "Graphical User Interface", but in AGS a single GUI is one of the many windows you can have to put other controls (buttons/labels/sliders/inventory windows/etc. onto -- it is not about a GUI in general.

As you see, there can be a bunch of GUIs (i.e. windows). One is a statusline, the other is a iconbar, the third is an inventory dialog window. You can add you own GUIs, of course.

The interface_click function operates ALL these GUIs. To distinguish between different GUIs you use their names (you can also use their numbers):

#sectionstart interface_clickÃ,  // DO NOT EDIT OR REMOVE THIS LINE
function interface_click(int interface, int button) {
 
 Ã,  Ã,  // when we click over ICONBAR GUI's controls:
Ã,  Ã,  if (interface == ICONBAR) {

Ã,  Ã,  Ã,  Ã,  ifÃ,  Ã,  Ã,  (button == 4 ) { } // code when clicking on GUI control(object) 4
Ã,  Ã,  Ã,  Ã,  else if (button == 6 ) { } // code when clicking on GUI control(object) 6
Ã,  Ã,  Ã,  Ã,  else if (button == 7 ) { } // code when clicking on GUI control(object) 7
Ã,  Ã,  Ã,  Ã,  else if (button == 8 ) { } // code when clicking on GUI control(object) 8
Ã,  Ã,  Ã,  Ã,  else if (button == 9 ) { } // code when clicking on GUI control(object) 9
Ã,  Ã,  Ã,  
Ã,  Ã,  }Ã,  // end if interface ICONBAR
 
 
Ã,  Ã,  // when we click over INVENTORY GUI's controls:
Ã,  Ã,  if (interface == INVENTORY) {
 
Ã,  Ã,  Ã,  Ã,  < code for GUI controls there (similar to ICONBAR's) >
Ã,  Ã,  }

Ã,  Ã,  ...
Ã,  Ã,  ...
Ã,  Ã,  etc.


You can use that function to handle clicks over all GUIs. As to built-in inventory dialog, you can't change how it works -- there is no code about it in the interface_click function and there is no related GUI window either.


QuoteOh yes and one more thing, I am also confused as to the Gui one is presented with when going into the INVENTORYÃ,  tab in GUI. I understand that Ags has a built inÃ,  inventory window which cannot be changed my question is: is the inventory window in INVENTORY,Ã,  the default/built in inventory screen/window, if so why am I allowed to add a slider to it. ???

So, considering all the above, INVENTORY is a name of the customizable GUI window and the inventory window is its control (GUI object), just like a button or a label. And just like as buttons you can add inventory window controls to any other GUI and then, for example, the iconbar can additionally display the inventory items. Therefore, by adding a slider you change the custom INVENTORY Gui -- not the built-in inventory dialog. You see, I refer to the built-in GUI as inventory dialog, not as the inventory window, just to avoid confusion. This built-in inventory dialog (or the built-in inventory screen, considering the name of the function to show it - i.e. InventoryScreen() ) also has its own inventory window (that black-coloured rectangle where inventory items are shown) as well as other buttons.

Quote(By the way adding a slider does not make any difference to my game, it simply does not register it. Again Why is this?)

You probably see not the INVENTORY Gui but the built-in one. To show a GUI you need, as Strazer has already said, to use the GUIOn(<gui name>) function. Uncommenting that code to replace the built-in dialog, you must have seen GUIOn(INVENTORY); there.

QuoteI want to create my own Gui because the default one does not seem to allow more than 5 objects.Ã,  :o

The built-in inventory dialog does allow having more inventory items displayed. On adding new items it gets resized automatically. But if there is too many items then an arrow appears right under the bottom right corner of the inventory window of the built-in dialog. So, you can scroll down to see more items.

Bhup

#25
Scorpiorus,
Thanks for for making the effort with a lengthy explanation.Ã,  Ã, :)

Quote
The built-in inventory dialog does allow having more inventory items displayed. On adding new items it gets resized automatically. But if there is too many items then an arrow appears right under the bottom right corner of the inventory window of the built-in dialog. So, you can scroll down to see more items.
Thats my problem. In rooms 1,2,3 the inventory window seems allright and quite happily displays the items.Ã,  Ã, But when I reach room 4 and add another
item the screen is displayed in the way shown onÃ,  page 1 back(at the top).Ã,  The only explanation (from pumaman) that I have had is the pictures are bigger than 32x32.Ã,  Its true, they are, but would that really affect the window.Ã,  As you said if there are too many items thenÃ,  it would become scrollable. But it in my case it doesn't.Ã,  (The only reason I wanted to customise a new inventory window was because I wanted something scrollable since it wasn't doing this in the built in version.)

I feel a real dunce as it is and I realise your getting fed up with this topic as well as I, but if you do reply, please be gentle.
BhupÃ,  ;D

Scorpiorus

I think it's the number of displayed inventory items that makes it being scrollable and not their size, I'm not fully sure though.

In that case it well may be the built-in inventory dialog doesn't support displaying items of a big size.

Bhup

Scorpiorus and Pumaman,
You were absolutely right!!!! The images "were" too big for the inventory window.Ã,  Yes I repeat the "inventory window" which is the key. I didn't realise you could use seperate images for the inventory window and the objects.Ã,  Mine were one and the same.Ã,  I was reluctant to reduce my images to 32 x32 because when I executed the game the images were far too small but of course it all makes sense now because you can use one set of images for the objects and another for the inventory window. So I reduced the images to 32X32 for the built in inventory window and used the large ones for the objects. It all seems so easy now and makes sense but I just didn't get it before..durrrr and :-[
Thanks for all your help and putting up with me.
Bhup

Scorpiorus

QuoteI didn't realise you could use seperate images for the inventory window and the objects.
Yeah, this is deliberate because you can, for example, make a cupboard as a hotspot and by clicking over it get a cup (inventory item) -- you don't even use an object in that case.

SMF spam blocked by CleanTalk