[SOLVED] Use inventory on item

Started by limeTree, Tue 30/12/2008 13:29:59

Previous topic - Next topic

limeTree

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


Trent R

#1
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.
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

limeTree

 
Code: ags
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?

Trent R

gInventoryGUI.Visible=false;

Or whatever you've called it.


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


~Trent
To give back to the AGS community, I can get you free, full versions of commercial software. Recently, Paint Shop Pro X, and eXPert PDF Pro 6. Please PM me for details.


Current Project: The Wanderer
On Hold: Hero of the Rune

limeTree

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 
Code: ags
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!

Shane 'ProgZmax' Stevens

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.

SMF spam blocked by CleanTalk