Simple Inventory.
Posted: Wed May 30, 2012 6:05 am
I apologize for the second thread. (I felt it would be easier for others with the same question to find if I made this one separate.)
I'm not sure if what I want to do is possible, or what information to provide. I've spent all night trying to figure something like this out and searching the forums, but I'm terrible with coding language and everything is just kind of complicated to me (even though once I understand it, I feel like an idiot.)
I figured out how to make this code work.
What I would like to do, though, is use this same basic code (simple to understand and use), except as a screen. As things are, the Inventory stays on screen (unless I hide it.) What I would like to do is make it so that the same styled inventory comes up, but only if the player presses a button to show the inventory.
Otherwise, I'd like the inventory to stay off screen.
I'd also like the option to 'view' inventory to only come up when there's 'something' in the inventory. For example, one of my characters obtains a sweatshirt, and it goes into the simple onscreen inventory in the left hand corner. What I would like instead is for an option to come up to 'view inventory', and they can be taken to a screen that lists all of the items they have.
I am not sure how to go about this, in the least. Screens confuse me. I'm not sure how to write them, or where to place what (or what variables to change, etc.) Any help would be greatly appreciated. Thank you for reading.
(On another note, I am also wondering if with the simple on screen inventory, it's possible to have the items show up going vertically instead of horizontally. This isn't really a big deal, but yeah...Thank you!)
I'm not sure if what I want to do is possible, or what information to provide. I've spent all night trying to figure something like this out and searching the forums, but I'm terrible with coding language and everything is just kind of complicated to me (even though once I understand it, I feel like an idiot.)
I figured out how to make this code work.
Code: Select all
init python:
showitems = True
def display_items_overlay():
if showitems:
inventory_show = "Inventory: "
for i in range(0, len(items)):
item_name = items[i].title()
if i > 0:
inventory_show += ", "
inventory_show += item_name
ui.frame()
ui.text(inventory_show)
config.overlay_functions.append(display_items_overlay)
##
$ items.append("stone") #when you want to add items
$ items.remove("stone")#when you want to remove items
$ showitems = False #when you don't want to show the inventory onscreen (cutscenes and the like)
$ showitems = True #when you want to reshow the inventory after the cutscene is over
Otherwise, I'd like the inventory to stay off screen.
I'd also like the option to 'view' inventory to only come up when there's 'something' in the inventory. For example, one of my characters obtains a sweatshirt, and it goes into the simple onscreen inventory in the left hand corner. What I would like instead is for an option to come up to 'view inventory', and they can be taken to a screen that lists all of the items they have.
I am not sure how to go about this, in the least. Screens confuse me. I'm not sure how to write them, or where to place what (or what variables to change, etc.) Any help would be greatly appreciated. Thank you for reading.
(On another note, I am also wondering if with the simple on screen inventory, it's possible to have the items show up going vertically instead of horizontally. This isn't really a big deal, but yeah...Thank you!)