Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to make basic inventory setup in python

"""
-==basic inventory setup=--
"""


from math import ulp
import os
import keyboard
import time

#starter
os.system('cls' if os.name == 'nt' else 'clear')
inventory = 1

#discriptions
print("1)press e to open your inventory
2)press the number dat you wont to print
3)press p to print
4)press left or right keys to go btwin 1 to 9
(press d to delete all)")

while True:
    #key detecter
    inputer = keyboard.read_key()
    time.sleep(0.2)

    #inventory print
    if inputer == "p":
        if inventory == 1:
            print("-")
        else:
            if inventory == 2:
                print("--")
            else:
                if inventory == 3:
                    print("---")
                else:
                    if inventory == 4:
                        print("----")
                    else:
                        if inventory == 5:
                            print("-----")
                        else:
                            if inventory == 6:
                                print("------")
                            else:
                                if inventory == 7:
                                    print("-------")
                                else:
                                    if inventory == 8:
                                        print("--------")
                                    else:
                                        if inventory == 9:
                                            print("---------")

    #inventory show

    if inputer == "e":
        print("[1] -
[2] --
[3] ---
[4] ----
[5] -----
[6] ------
[7] -------
[8] --------
[9] ---------
[selected] %s" % inventory)

    #print deliter
    if inputer == "d":
        os.system('cls' if os.name == 'nt' else 'clear')

    #inventory selecter
    if inputer == "left":
        inventory -= 1
    if inputer == "right":
        inventory += 1

    if inventory == 10:
        inventory = 1
    if inventory == 0:
        inventory = 9

    if inputer == "1":
        inventory = 1
    if inputer == "2":
        inventory = 2
    if inputer == "3":
        inventory = 3
    if inputer == "4":
        inventory = 4
    if inputer == "5":
        inventory = 5
    if inputer == "6":
        inventory = 6
    if inputer == "7":
        inventory = 7
    if inputer == "8":
        inventory = 8
    if inputer == "9":
        inventory = 9
 
PREVIOUS NEXT
Tagged: #basic #inventory #setup #python
ADD COMMENT
Topic
Name
5+5 =