Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: limeTree on Tue 30/12/2008 13:29:59

Title: [SOLVED] Use inventory on item
Post by: limeTree on Tue 30/12/2008 13:29:59
Hi,i have this problem and i can't override it.

My player is in the room.The room is dark.
The script is running(first time player enters a room),so he is talking to somebody.
Then it comes to

cBright.Say("Well,someone should to  do something!");
mouse.DisableMode(eModeWalkto);

i have a candle and a box of matches in my inventory.
i disabled walk to beacuse i want my action not to continue until i turn on the candle in my inventory with the matches

so,in use inventory with item i put:

function icandle_UseInv()
{
if (cJames.ActiveInventory == imatches)
{
cJames.Walk(475, 377, eBlock);
Wait(50);
object[0].Visible = true;
wait(80);

the visible object is a lighted candle he put on the floor.

the problem is:

When i put matches together with the candle,i see a waiting mode(sand watch in default)
and it stays like that,nothing else happens.(or rather,the game freezes itself)

If i put enoBlock,the object appears and then players walks to it,

plus,i would like the inventory screen to disappear the moment i put matches and candle together but it stays there

and i am sure he is on a walkable area

Title: Re: Use inventory on item
Post by: Trent R on Tue 30/12/2008 19:29:18
Quoteplus,i would like the inventory screen to disappear the moment i put matches and candle together but it stays there
Well, you never called for your inventory screen to disappear, so that should go before your walk call.

And have you tried using break points or Display calls to find out which line it actually freezes on?

And which script is this in? Global?



~Trent
PS-You can use the [code][/code] tags to keep it nice and clean on the forums. And also, your function lost two closing braces when you posted it.
Title: Re: Use inventory on item
Post by: limeTree on Tue 30/12/2008 23:34:46
 function icandle_UseInv()
{
if (cJames.ActiveInventory == imatches)
{
cJames.Walk(475, 377, eBlock);
Wait(50);
object[0].Visible = true;
object[0].SetView(31);
object[0].Animate(0, 5, eRepeat, eNoBlock, eForwards);
}
}


The game freezes the moment i use matches on the candle.
My cursor changes to a wait mode that lasts forever.
This is in the global script as you can see,for using inv on candle.

The problem with the screen is that i tried to find a code in the index but none were able to help me,they mostly remove the inventory screen from the GUI.Can you recommend me a code that can just turn off the inv window?
Title: Re: Use inventory on item
Post by: Trent R on Wed 31/12/2008 01:54:10
gInventoryGUI.Visible=false;

Or whatever you've called it.


Have you also tried using the objects name instead of the array?


~Trent
Title: Re: Use inventory on item
Post by: limeTree on Wed 31/12/2008 11:01:03
Quote from: Trent R on Wed 31/12/2008 01:54:10
gInventoryGUI.Visible=false;

Or whatever you've called it.


Have you also tried using the objects name instead of the array?


~Trent

Yes,your code  ginventory.visible = false;
helped. It turnd off the inventory screen,and it seems that
the appereance of the screen was the reason of the freeze,when i turn it off with the code the script runs smoothly,thank you!
Title: Re: [SOLVED] Use inventory on item
Post by: Shane 'ProgZmax' Stevens on Wed 31/12/2008 14:39:20
You may need to change your inventory screen to Normal mode.  It sounds like it is set to pause the game when it is visible.