Items not appearing in GUI inv

Started by Nixxon, Wed 28/05/2003 21:02:31

Previous topic - Next topic

Nixxon

I have drawn a GUI inventory window on my GUI and my script goes as follows -

function hotspot3_a() {
 // script for hotspot3: Interact hotspot
 AddInventory(3);

However the item doesnt appear in my GUI inv window... if i press alt-I it does infact appear in the default AGS inv window. What am i missing in my code?

ALSO -
(non-related matter)
I've managed to create a closeup window (which is actually an object) of a hotspot to appear when the initial hotspot is looked at. (eg. look at glass (hotspot) - big close up of glass appears (object)

// script for hotspot2: Look at hotspot
 ObjectOn(0); // close up of the glass
 DisableCursorMode(MODE_WALK);
DisableCursorMode(MODE_TALK);
DisableCursorMode(MODE_LOOK);
GUIOn(3); // the cancell close up button

(notice i've disabled all other cursor modes (apart from interact) while this object close up appears, since i dont want the player walking underneith it, taking part in other actions on the screen and so forth while it's still present)

It all works fine, i've even scripted a "cancell" GUI button to also appear accordingly if the player decides to close the "close up object" this also works fine... however when i want to display a messal val when i interect with the new 'close up object'  it does nothing. Infact any type of interaction concearning the new close up object is unregisterd.

I hope i've been clear in my question, any tips would be extreemly appreciated :) :)



Gilbert

Quote from: IbeX on Wed 28/05/2003 21:02:31
However the item doesnt appear in my GUI inv window... if i press alt-I it does infact appear in the default AGS inv window. What am i missing in my code?

Hmmmm, try adding the following line after that AddInventory line:
UpdateInventory();

If that doesn't work, there're probably some problem with scripting in the inv. GUI, in that case, you may post the inv. GUI script here.


Quote from: IbeX on Wed 28/05/2003 21:02:31
however when i want to display a messal val when i interect with the new 'close up object'  it does nothing. Infact any type of interaction concearning the new close up object is unregisterd.

Hmmm which interaction entry did you use for displaying teh message? Is it "Interact with object #" or otherwise?
If that "cancel" GUI is set to "script only", change it to "always on", you may use a GUIOff() in game_start() of the global script to prevent it from initially visible in the game.

Scorpiorus

QuoteHowever the item doesnt appear in my GUI inv window... if i press alt-I it does infact appear in the default AGS inv window. What am i missing in my code?
Also make sure you made the inventory window is broad enough or the items do not fit the window. In that case you see nothing. If that's ok then, yep, it would be useful to see the code you are using.

QuoteIf that "cancel" GUI is set to "script only", change it to "always on", you may use a GUIOff() in game_start() of the global script to prevent it from initially visible in the game.
Just for reference: this is because script-only GUI pauses the game. If you look at on_mouse_click() function in the global script you see that it doesn't process any clicks when the game is paused.

-Cheers

Nixxon

#3
thanks guys!!, i had no idea script only GUI's disabled the interface, all working now :) :) :) 1 prob though, now that GUI 3 is set to turn it'self off when the room loads... i see it quicky appear for a split second apon entering the room,  it then dissapears due to the code taking effect. perhaps this is due to my computer specs? (it's age is relatively close to dinosaur feacies).

update inv didnt seem to work, i think im missing a huge chunk of code in my main GUI, since im basically working with the template provided... changing it as i go.

The inventory object is 11x8 in size, the GUI inv window is 148x11 so shouldnt be any probs there. anyway i'll paste my script, take a gander and tell us how many holes need to be filled :) thanks again highly appreciated :D :D

 if (interface == 1) {
   if (button == 4)   // see inventory
     InventoryScreen();
   else if (button == 5) {   // use selected inventory
     if (character[ GetPlayerCharacter() ].activeinv >= 0)
       SetCursorMode(4);
   }
   else if (button == 6)    // save game
     SaveGameDialog();
   else if (button == 7)   // load game
     RestoreGameDialog();
   else if (button == 8)   // quit
     QuitGame(1);
   else if (button == 9)    // about
     Display("Adventure Game Studio v2 run-time engine[[Copyright (c) 1999-2002 Chris Jones");
 }  // end if interface 2


if (interface == 3) {
if (button == 0) // disable object close up
ObjectOff(0);
GUIOff(3);
EnableCursorMode(MODE_WALK);
EnableCursorMode(MODE_TALK);
EnableCursorMode(MODE_LOOK);

}

By the way, my 'main' lucas style GUI, is infact GUI no.2... i just noticed theres no code in my script to support this GUI, MOST LIKELY THE PROB, laughs* anyways, if i could get a breif glimps of what should be added in my script to support inv for GUI 2 i'd gift wrap my soul and hand it to you on a gold platter.
thanks again, means a lot

EDIT -
i found this in the LUCASART.GUI included with AGS

/*  PASTE THIS CODE INTO THE game_start FUNCTION:
 game.items_per_line=4;
 game.num_inv_displayed=8;

should i paste this into my global script? if so, where?

Nixxon

ok after all that, indeed the inventory window was too small "even though technically it wasn't, pffft ;)'
s'all fine and dandy, thanks for putting up with me
cheers :D

Scorpiorus

Quote1 prob though, now that GUI 3 is set to turn it'self off when the room loads... i see it quicky appear for a split second apon entering the room, it then dissapears due to the code taking effect.
I think it's because you placed GUIOff(3) into Player enters screen (after fade-in), didn't you? You could place it inside Player enters screen (before fade-in). But actually there is a global game_start() function for such things like disabling the always-on GUIs on start up. So, as Gibert suggested, place it there instead.


Quoteindeed the inventory window was too small "even though technically it wasn't
Btw, take a look in the manual for the SetInvDimensions() function controling item cell size. The default value is 40x22 pixels so you need to adjust it. ;)

QuoteBy the way, my 'main' lucas style GUI, is infact GUI no.2... i just noticed theres no code in my script to support this GUI, MOST LIKELY THE PROB
In fact you do not need any code for the inv window in case you do not make something advanced. As about the code, it seems ok.

Quote
/* PASTE THIS CODE INTO THE game_start FUNCTION:
game.items_per_line=4;
game.num_inv_displayed=8;

should i paste this into my global script? if so, where?
It depends on you. Paste it, see how it works, adjust the values maybe, etc. As I said above the game_start() is a global function located in the global script, so paste the code inside:

//main script:

function game_start() {

game.items_per_line=4;
game.num_inv_displayed=8;

GUIOff(3); <----- related to the first question
}

-Cheers

Nixxon

#6
Thanks Scorpiorus, Gilbert.
I pasted it in the (before fadein) no hassles now :P (bugger, really wanted to blame my PC).

just ooooooonnnee more thing though. the last i promise ;)

Can i place a hotspot over an object? now i have the closeup of the glass, i want the player to be able to specifically click on the straw to obtain the item, but alas not be able obtain anything while clicking on the glass itself (apart from a message val which i have already assigned:)).

I've drawn the 'straw' hotspot and disabled it along with the close up Object untill of coarse the glass is looked at. they both popup at the same time, problem is the object appears in front of the hotspot.




Hands over gift wrapped soul...

Scorpiorus

QuoteCan i place a hotspot over an object?
No, it's not possible. On the other hand you have two different objects actually - a glass and a straw. Make the straw as another object then assign interaction.

QuoteHands over gift wrapped soul
thanks, but you need it much more, otherwise who would finish the game then? ;D

-Cheers

Nixxon

lol, lord knows your doing most of the work for me at this point :P
once again, thanks :)

Nixxon

#9
Your not gonna beleive this, i re-introduced the straw as an object, everything worked great, apon obtaining the straw i scripted it so that it closes both GUI(3) (the cancell close up object) and the close up object itself, now all of a sudden my items arent going into my inventory 'again'.

anyhow heres the script, plz inform me of any misstakes, i can't see any

 // room script file

function hotspot2_a() {
 // script for hotspot2: Look at hotspot

 ObjectOn(3);
 ObjectOn(0);
 DisableCursorMode(MODE_WALK);
DisableCursorMode(MODE_TALK);
DisableCursorMode(MODE_LOOK);
GUIOn(3);


}

function hotspot3_a() {
 // script for hotspot3: Interact hotspot
 AddInventory(3);
ObjectOn(1);
UpdateInventory ();
}

function room_a() {
 // script for room: Player enters screen (after fadein)


}

function room_b() {
 // script for room: Player enters screen (before fadein)
 
   GUIOff(3);
   SetObjectView(2,11);
   AnimateObject(2,0,2,1);



}


function object3_a() {
 // script for object3: Interact object
 AddInventory(4); //adds straw to inventory
 UpdateInventory ();
 PlaySound(1);
GiveScore(2);
ObjectOff(3); //cancell self
GUIOff(3); //cancell close up of glass
GUIOn(2);
ObjectOff(0); //cancell close up of glass
DisableHotspot(2); //hotspot of glass (opens the close up)
EnableCursorMode(MODE_WALK); //previously dissabled/interact with object0
EnableCursorMode(MODE_TALK); //previously dissabled/interact with object0
EnableCursorMode(MODE_LOOK); //previously dissabled/interact with object0

}

Scorpiorus

Quotenow all of a sudden my items arent going into my inventory 'again'.
how about Alt - I. Are they in the inventory?

Nixxon

yep...
also i noticed at first the items took a while to appear in the inventory, now they dont appear at all however :(
I owe u a space in the credits for this

Scorpiorus

good. if they are shown inside the Sierra-style inventory the player has them undoubtedly. ;)


Quote
//main script:

function game_start() {

game.items_per_line=4;
game.num_inv_displayed=8;

GUIOff(3); <----- related to the first question
}
Have you placed these lines? If you have then remove them and see how it turns out.

Also you may try adjusting inv window size again ;)

Nixxon

YAY, Scorpiorus your my hero :D
thanks a bunch!

SMF spam blocked by CleanTalk