Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
label start:
$ inventory = Inventory()
$ inventory.add_item("dog")
$ inventory.add_item("cat")
"Things on the list: [inventory.items]"
return
When I execute my code, the script fail and return me an AttributeError:'unicode' object has no attribute 'append'
But when I delete the line self.items = ", ".join(self.items) from the inventory class and I put the line $ inventory.items = ", ".join(inventory.items) in the script file it works !!! I don't understand why because for me it looks the same... How can I fix it ?
Thanks
Last edited by renardjap on Sat Feb 29, 2020 4:21 am, edited 1 time in total.
The first call to add_item adds the item and then converts the self.item attribute into a string (that's the "join" part). So the second call tries to add an item to a string.
Try using two different attributes.
I didn't know that the .join() turned a list into a string... Yes, it's logical that doesn't work...
I made what you said and it's work perfectly now ! Thanks