Showing inventory button, only if the inventory isn't empty?

This forum is meant for posting anything related to Adventure Maker that doesn't fit in the other forums.Please post technical questions in the Technical Support Forum!

Moderators: Vengeance66, Harvester, GM-Support, reneuend, Lyberodoggy, Candle, Mystery, ShadowHunter

Showing inventory button, only if the inventory isn't empty?

Postby Bzyk » Wed Mar 09, 2011 6:33 pm

Hello,

I use
1. Action.HideInventoryButton
2. Action.ShowInventoryButton.

Is there possible "show if"?

I mean, I get an item. Inventory button shows. Then by right-click I jump to the custom menu, where inventory button shouldn't appear. OK, I hide it by first command. When I leave menu and return to the game, I display button by the second command. But...

The problem is, when I haven't got any item. Then I jump to custom menu and leave it - and then inventory button appears, although inventory is empty. It's annoying... :(

I need some script, which shows inventory button, but only if the inventory isn't empty...
Luminous beings are we, not this crude matter...
User avatar
Bzyk
Frequent Poster
 
Posts: 140
Joined: Sat Feb 17, 2007 9:49 pm
Location: Poland

Postby Lyberodoggy » Wed Mar 09, 2011 10:37 pm

This should do the trick

Code: Select all
If InventoryItemObject.count>1 then
ShowInventoryButton
End If


And I 'll explain. The inventoryitemobject array stores information on your items. It has a normal count of 1, with 1 being inventoryitemobject(0), a secret, normally unused item placeholder, as happens with most objects in AM such as texts and hotspots. So, by checking if the items' count is greater than 1 which is the minimum you know if the player has one or more items. And you do that by utilizing the .count method of the array class.
User avatar
Lyberodoggy
Administrator
 
Posts: 2511
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens

Postby Bzyk » Wed Mar 09, 2011 10:45 pm

I'm such a noob in programming! Unfortunately I'm a classic humanist. :(

Lyberodoggy, many thanks! It works perfectly!
Luminous beings are we, not this crude matter...
User avatar
Bzyk
Frequent Poster
 
Posts: 140
Joined: Sat Feb 17, 2007 9:49 pm
Location: Poland

Postby Lyberodoggy » Wed Mar 09, 2011 10:49 pm

That's why we programmers exist :)
I 'm a noob at graphics :D
User avatar
Lyberodoggy
Administrator
 
Posts: 2511
Joined: Sat Feb 17, 2007 3:31 pm
Location: Athens


Return to Adventure Maker General Discussion

Who is online

Users browsing this forum: No registered users and 0 guests

cron