Ren'Py debug List?

ApatiaMax

Newbie
Sep 9, 2022
43
25
Just to ask if there's a way to display an element from a List array, because when I try
Code:
Places[0]
the console reply with
Code:
<store.Place object at 0x00000000057837f0>
EDIT: Oh sure because the object inside is another class... but How I debug it? :unsure:

Code:
init python:
    # MAP PLACES
    class Place(object):
        def __init__(self, x, y, name, isHome, owned, price, IsActive):
            self.x = x
            self.y = y
            self.name = name
            self.isHome = isHome
            self.owned = owned
            self.price = price
            self.IsActive = IsActive
        @property
        def placeIcon(self):
            if self.isHome == True and self.owned == False:
                icon = "map/House_Rentable.png"
            elif self.isHome == True and self.owned == True:
                icon = "map/House_Rented.png"
            else:
                icon = "map/" + self.name.lower() + "_icon.png"
            return(icon)
    Places = []
    Places.append(Place(843,264, "RAE Office", False, False, 0, True))
    Places.append(Place(80, 750, "Cheapest House", True, False, 50, False))
    Places.append(Place(1292, 840, "Cheap House", True, False, 250, False))
    Places.append(Place(872, 789, "Tech House", True, False, 500, False))
Because when I start a new game Places[1] still active when it should not and I still wonder WTF is going on o_O
 
Last edited:

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,964
16,210
EDIT: Oh sure because the object inside is another class... but How I debug it? :unsure:
In the console, Places[0].name.


Code:
init python:
[...]
    Places = []
    Places.append(Place(843,264, "RAE Office", False, False, 0, True))
    Places.append(Place(80, 750, "Cheapest House", True, False, 50, False))
    Places.append(Place(1292, 840, "Cheap House", True, False, 250, False))
    Places.append(Place(872, 789, "Tech House", True, False, 500, False))
Because when I start a new game Places[1] still active when it should not and I still wonder WTF is going on o_O
Well, it's the expected behavior for structures declared at init time. You should create the "Places" list through the default statement :
Python:
default Places = [ Place(843,264, "RAE Office", False, False, 0, True),
            Place(80, 750, "Cheapest House", True, False, 50, False),
            Place(1292, 840, "Cheap House", True, False, 250, False),
            Place(872, 789, "Tech House", True, False, 500, False) ]
More regarding this in 79flavors how-to.
 
  • Heart
Reactions: ApatiaMax