Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Problems with disabling the inventory  (Read 3854 times)

0 Members and 1 Guest are viewing this topic.

Mikael

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 127
    • View Profile
    • MDNA Games
Problems with disabling the inventory
« on: June 29, 2007, 04:46:43 PM »

I have this little problem that I hope that someone can help me with. Try to follow me here:

To be able to disable the inventory in certain scenes I have done the following:

Changed the line in the data/scripts/game_daemon.script file which reads

Code: [Select]
if(Game.Interactive && Game.MouseY < 45 &&! Game.ResponsesVisible &&! WinMenu.Visible) Game.InventoryVisible = true;
to

Code: [Select]
if(Game.Interactive && Game.MouseY < 45 &&! Game.ResponsesVisible &&! WinMenu.Visible && InventoryActive) Game.InventoryVisible = true;
Added the line

Code: [Select]
global InventoryActive;
in data/scripts/base.inc.

Added the line

Code: [Select]
InventoryActive = true;
in data/scripts/game.script.

I then enabled/disabled the inventory by setting the global variable InventoryActive in the scene_init.script files.

So far so good. Then, in order to make the inventory slide down when an item is picked up, I added the following piece of code to game.script.

Code: [Select]
method TakeItem(var ItemName)
{
// call the original method we have just overriden
this.TakeItem(ItemName);

global InventoryHint = true;
Sleep(1000);
InventoryHint = false;
}

And modified the inventory-showing condition in game_daemon.script to:

Code: [Select]
global InventoryHint;
if(InventoryHint;
(Game.Interactive && Game.MouseY < 45 && !Game.ResponsesVisible && !WinMenu.Visible))

The inventory slides down when an item is picked up now, BUT it overrides the enable/disable inventory settings. Is there a way around this?

Thanks in advance!
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Problems with disabling the inventory
« Reply #1 on: June 29, 2007, 05:27:15 PM »

Code: [Select]
global InventoryHint;
if(InventoryHint;
(Game.Interactive && Game.MouseY < 45 && !Game.ResponsesVisible && !WinMenu.Visible))
Ummm, is that really what you have in your script, or is that some kind of typo?

I think the condition should look something like this:

Code: [Select]
if(InventoryActive && (InventoryHint || (Game.Interactive && Game.MouseY < 45 && !Game.ResponsesVisible && !WinMenu.Visible)))
  Game.InventoryVisible = true;

It gets kind of complicated, doesn't it?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Mikael

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 127
    • View Profile
    • MDNA Games
Re: Problems with disabling the inventory
« Reply #2 on: June 29, 2007, 07:03:46 PM »

Yes, it was a typo of course. I usually type my posts in Notepad, and sometimes it plays tricks on my with the line breaks. I messed up when I tried to correct it.

Yes, it gets very complicated here, but it works now, so I'm terribly happy (since I would never have figured it out myself). Thanks a lot!
Logged

Mikael

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 127
    • View Profile
    • MDNA Games
Re: Problems with disabling the inventory
« Reply #3 on: June 30, 2007, 03:13:28 AM »

Complicated was the word. But ... while risking to get myself thrown out of the forum,  ;) I will try to take this even one step further.

The thing is, that when an item in my inventory is right clicked, a full screen image of the object is displayed. The full screen image leads to the previous scene when clicked. This is why I want to disable the inventory in the full screen images. If I didn't, and the player would right click a new object while another is displayed, the new full screen image would only lead him back to the previous full screen image, and he would be "stuck".

The only (minor) problem that I have now is when an object is right clicked, and a full screen image is brought up, the inventory won't disappear until the player moves his mouse pointer below the upper 76 pixels (that's the height of my inventory). So, even though I've hidden the inventory while the full screen images are displayed, the player still has a chance of right clicking another object. As it is now, I've circumvened this through variables, so that the player is transported to the previous screen instead of a new close up.

So, my question is, is it possible to hide the inventory as soon as the abovementioned InventoryActive variable is set, even if the mouse cursor is in the inventory area?

I am sorry for being a pain in the neck.

Mikael
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Problems with disabling the inventory
« Reply #4 on: June 30, 2007, 09:07:05 AM »

Ok, let's siplify the condition a little :)

Code: [Select]
if(InventoryHint || (Game.Interactive && Game.MouseY < 45 && !Game.ResponsesVisible && !WinMenu.Visible))
  Game.InventoryVisible = true;
else
  ...

// no matter what, if InventoryActive is false, hide the inventory
if(!InventoryActive) Game.InventoryVisible = false;
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Mikael

  • Supporter
  • Regular poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 127
    • View Profile
    • MDNA Games
Re: Problems with disabling the inventory
« Reply #5 on: June 30, 2007, 11:12:31 AM »

My inventory interface couldn't possibly be better now. Thanks a million!

Mikael
Logged
 

Page created in 0.038 seconds with 19 queries.