Page 1 of 1

List item system. How do i mark item as picked?

Posted: Wed May 05, 2021 11:34 pm
by Psion
I'm making item system. It working alright, but you can pick item as many times as you want. How do i mark item as picked?

Code: Select all

init python:
   class ITEMS (object):
        def __init__ (self, location, isActive, icon, func):
            self.location = location
            self.isActive = isActive
            self.icon = icon
            self.func = func

    Objects = []

    Objects.append(ITEMS("2nd Floor Hallway", True, "items/pawn.png", "pawn_00"))

screen items():
    for q in Objects:
        if q.location.lower() == location and q.isActive:
            imagebutton:
                idle q.icon
                hover q.icon
                focus_mask True
                action SetVariable("clickType", "items"), Return(q.func)

label start:
        if clickType == "items":
            call expression UIreturn

label pawn_00:
    "I took a pawn"
    return

As i think i should put somewhere after "action" in "screen items" something like q.isActive=False to make object not active anymore. But i dont know syntax good enough :( Help pls.

Re: List item system. How do i mark item as picked?

Posted: Thu May 06, 2021 7:36 pm
by Alex
Try SetField action - https://www.renpy.org/doc/html/screen_a ... l#SetField

Code: Select all

action [SetField(q, "isActive", False), SetVariable("clickType", "items"), Return(q.func)]

Re: List item system. How do i mark item as picked?

Posted: Thu May 06, 2021 8:35 pm
by Psion
Working nicely, thank you very much.