init python: class Parcel(object): """ contents - Contents of the parcel, has to be a list of tuples containing an item object and integer quantity [ (lollipop_ITEM, 5) ]. wait - Wait time required for the item to be delivered. label - Call label called after the parcel was opened. func - A setup function called before the parcel contents is being shown to the player. Queue is universal for all instanced objects. """ def __init__(self, contents, wait=1, label=None, func=None): self.mailed = False self.delivered = False self.contents = contents self.wait = wait self.label = label self.func = func @property def queue(self): return mailbox.parcels def send(self): self.mailed = True if not self in self.queue: self.queue.append(self) def open(self, silent=False): self.mailed = True self.delivered = True if self in self.queue: self.queue.remove(self) if self.func: self.func() for i in self.contents: item, quantity = i if isinstance(item, Item): item.owned += quantity else: item.unlock() if not silent: renpy.call("parcel", self, self.label) def type(self): return self.contents[0][0].type def get_caption(self): if len(self.contents) == 1: item, quantity = self.contents[0] if isinstance(item, Item): icon = item.get_image() else: icon = item.image if quantity == 1: text = f"You have received one {item.name}." else: text = f"You have received {num_to_word(quantity)} pieces of {item.name}." else: items = ", ".join(f"{x[1]} {x[0].name}" for x in self.contents) icon = "interface/icons/box_brown_"+str(random.randint(1, 4))+".webp" text = "You have received your ordered items:\n{size=-4}"+items+"{/size}" return (text, icon) label parcel(parcel, lbl): show screen bld1 show screen blktone $ renpy.checkpoint() call give_reward(*parcel.get_caption()) hide screen blktone hide screen bld1 with d3 if lbl: call expression lbl return label parcel_open_all: while mailbox.get_parcels(): $ mailbox.get_parcels()[0].open() $ parcel_OBJ.hidden = True call tutorial("inventory") jump main_room_menu