Way to hide inventory if not drop-down?

This forum is meant for requesting technical support or reporting bugs.

Moderators: time-killer-games, Vengeance66, Candle, reneuend, GM-Support

Way to hide inventory if not drop-down?

Postby CBSection31 » Sun Jan 24, 2010 8:35 pm

Hi all,

Several of my beta testers are complaining a bit about the inventory system. They want the inventory to always be visible during gameplay, instead of using the drop down system.

That's fine, I thought. I turned off the drop down inventory. The problem is, now the Action.HideInventoryButton command doesn't work, and the inventory is ALWAYS visible...even during cutscenes and puzzles, where I don't want the inventory to be accessible.

Is there any other way to hide the inventory, or am I stuck using the drop down system?

Thanks! :)
CBSection31
Code Master
 
Posts: 564
Joined: Tue Jun 10, 2003 4:00 am

Postby Lyberodoggy » Sun Jan 24, 2010 9:45 pm

Try using this code:
Code: Select all
InventoryCanvasObject.visible=false
InventoryBackgroundObject.visible=false
for each x in inventoryobject
x.visible=false
next


reverse it for the oposite effect (change false to true)
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby CBSection31 » Sun Jan 24, 2010 10:22 pm

Thanks, I'll try it. :D

Assuming it works, I have to scour EVERY frame of my game (over 1500) to make sure the inventory disappears every place I used the HideInventoryButton command. Eep! :shock:
CBSection31
Code Master
 
Posts: 564
Joined: Tue Jun 10, 2003 4:00 am

Postby CBSection31 » Sun Jan 24, 2010 10:28 pm

Hmm...is there a way to override the default Action.HideInventoryButton and ShowInventoryButton commands with new subroutines that encompass the code you wrote above? That way, I wouldn't have to change every frame of my game, just add in the subroutines.
CBSection31
Code Master
 
Posts: 564
Joined: Tue Jun 10, 2003 4:00 am

Postby Lyberodoggy » Mon Jan 25, 2010 4:11 pm

yes, there actually is one: create a new sub for each command named exactly the same and put your own code in there. But then again, it will only work as long as you haven't got the "Action." part in your commands. (well I 'm not sure about that)
User avatar
Lyberodoggy
Administrator
 
Posts: 2526
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby CBSection31 » Mon Jan 25, 2010 8:22 pm

I'll have to test it, since the code does have action in every command. I'll report back after testing it.
CBSection31
Code Master
 
Posts: 564
Joined: Tue Jun 10, 2003 4:00 am

Postby CBSection31 » Mon Jan 25, 2010 8:38 pm

Yes, you were right: the "Action." part stops it from working. Thanks anyway! :)
CBSection31
Code Master
 
Posts: 564
Joined: Tue Jun 10, 2003 4:00 am

Postby Mystery » Mon Jan 25, 2010 9:31 pm

Hmmm, I'm wondering why that Action.HideInventoryButton command doesn't work... Is this a bug in the new beta version of AM, or a Windows 7 issue :?:
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby mercedes » Tue Jan 26, 2010 5:11 pm

Mystery wrote:Hmmm, I'm wondering why that Action.HideInventoryButton command doesn't work... Is this a bug in the new beta version of AM, or a Windows 7 issue :?:


I noticed that a long time ago as well...with this version..4.5.2
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby Mystery » Tue Jan 26, 2010 5:40 pm

Hmmm, just tested, and for me it works with version 4.5.2 (on Vista).
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby CBSection31 » Tue Jan 26, 2010 8:41 pm

It works for you if the inventory is set to always be visible, instead of a drop-down inventory? Because for me, it doesn't...odd.

In any case, I pooled together ideas by Lyberodoggy and Shadowhunter to create a solution. Shadowhunter linked me to a wonderful piece of software that will scan files of a certian extension in bulk and replace text A with text B.

So, I will be replacing every instance of Action.HideInventoryButton with a new subroutine that calls Lyberdoggy's code! :)
CBSection31
Code Master
 
Posts: 564
Joined: Tue Jun 10, 2003 4:00 am

Postby Mystery » Tue Jan 26, 2010 9:11 pm

Sorry, I missed that point :oops:

But in this case it's clear that it's not working: If you are using a static inventory, there is no inventory button (and thus nothing to hide or to show) ;)
User avatar
Mystery
Forum Admin and Games Page admin
 
Posts: 2990
Joined: Sat Feb 04, 2006 8:12 am
Location: Switzerland

Postby CBSection31 » Wed Jan 27, 2010 12:47 am

Good point. :lol:
CBSection31
Code Master
 
Posts: 564
Joined: Tue Jun 10, 2003 4:00 am

Postby CBSection31 » Fri Jan 29, 2010 7:29 pm

Okay, I finally tried Lyberdoggy's code. Unfortunately, it doesn't work.

Code: Select all
Sub HideInventoryButton
   InventoryCanvasObject.visible=false
   InventoryBackgroundObject.visible=false
   For Each x in inventoryobject
      x.visible=false
   Next
End Sub


When I call HideInventoryButton, the inventory doesn't disappear. Instead, I get an error message: "Object not a collection". Any ideas?
CBSection31
Code Master
 
Posts: 564
Joined: Tue Jun 10, 2003 4:00 am

Postby mercedes » Fri Jan 29, 2010 9:04 pm

I changed it to this...I'm not sure if this is what u want..? Are u wanting the button to disappear or the items..or both..?

Code: Select all
Sub HideInventoryButton
   InventoryCanvasObject.visible=false
   InventoryBackgroundObject.visible=false
   For Each x in InventoryItemObject
      x.visible=false
   Next
End Sub
User avatar
mercedes
VIP
 
Posts: 2460
Joined: Sun Mar 09, 2008 10:43 pm
Location: Canada..~

Postby CBSection31 » Sat Jan 30, 2010 8:01 pm

I'm using a static inventory, where there is no button. I want the items to disappear. I'll try your code. Thanks! :)
CBSection31
Code Master
 
Posts: 564
Joined: Tue Jun 10, 2003 4:00 am

Postby CBSection31 » Sun Jan 31, 2010 8:08 pm

Okay, I just tested it and it works...except, when I make the inventory reappear using this code, a weird-looking debug panel appears on-screen. It's a black box with a blue wrench icon. If I click on it, the debug menu opens up. :lol:

Can I assume this will only be visible in the engine, and not during runtime?
CBSection31
Code Master
 
Posts: 564
Joined: Tue Jun 10, 2003 4:00 am

Postby ShadowHunter » Sun Jan 31, 2010 8:49 pm

Hi,

It will also appear when compiled... remove "InventoryCanvasObject.visible=true" to fix the problem.

Let me know if it solved your issue, if not we need to dig deeper...

With best regards,

ShAdOwHuNtEr
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium

Postby CBSection31 » Sun Jan 31, 2010 9:07 pm

Worked perfectly. Thanks! :D
CBSection31
Code Master
 
Posts: 564
Joined: Tue Jun 10, 2003 4:00 am

Postby ShadowHunter » Sun Jan 31, 2010 9:23 pm

Excellent :D
User avatar
ShadowHunter
Forum Admin and Games Page admin
 
Posts: 1304
Joined: Fri Jun 06, 2003 10:37 pm
Location: Belgium

Postby JasonMc » Fri Jul 09, 2010 10:39 pm

Any way I can set a hotspot to hide and show a static inventory? This is a part of a game toolbar that I will be merging with almost all the pages using Runtime Frames Merging.

In the project inventory settings, I have "Use drop-down inventory instead of static" unchecked (that is, inventory is set to static)

I have a script set for that same hotspot's VBScript code.

Below is the current code I am attempting to use, and the error message I'm getting.

"inven" is a global integer variable I set up, and the hotspot is set to invert the variable every time it is clicked.

Sub HideInventory
If inven = 0 then InventoryCanvasObject.visible=false
InventoryBackgroundObject.visible=false
For Each x in inventoryobject
x.visible=false
Next
End Sub

Sub ShowInventory
If inven = 1 then InventoryCanvasObject.visible=true
InventoryBackgroundObject.visible=true
For Each x in inventoryobject
x.visible=false
Next
End Sub


Error executing script.

The scripting message returned the following message.

Syntax error


I click "OK" and get this...

Error executing script.

The scripting message returned the following message.

Object doesn't support this property or method.


I know there is some problem with my own code, but I don't know what it is. Can anyone help?

-----------

EDIT: Ha ha ha!! I figured this one out, too. Boy, I tell you, I keep answering my own questions...

This is what the respective codes should read:

Code: Select all
InventoryCanvasObject.visible=false
InventoryBackgroundObject.visible=false
For Each x in inventoryobject
x.visible=false
Next


Code: Select all
InventoryBackgroundObject.visible=true
For Each x in inventoryobject
x.visible=true
Next


Do NOT use the "Sub" or "End Sub", and make sure there are no spaces before each line.[/code]
-Jason McDonald
Manager, Programmer
MousePaw Games

--
PocketWatch 1.0 Plugin now available in the Plugins Corner!
User avatar
JasonMc
Active Member
 
Posts: 99
Joined: Sun Jul 04, 2010 10:27 pm
Location: Pacific Northwest, USA


Return to Adventure Maker Technical Support and Bug Reports

Who is online

Users browsing this forum: No registered users and 0 guests

cron