I wasn't sure how to search for what I wanted to know, or even how to ask this.
Is there a way to set it up so new variables or "objects" are made with some sort of serial number attached?
Let us pretend I have a game that involves collecting Easter Eggs.
If I already have:
$ eggcol = ["pink", "yellow", "blue", "purple", "green"]
$ eggsfound = []
$ Egg1 = "pink"
$ Egg2 = "blue"
$ Egg3 = "yellow"
But then what if I wanted the Easter bunny to randomly lay more eggs, or have an event that triggers laying more unique eggs? So that I don't have to type in a long list of egg1, egg2, egg3, it makes egg4, egg5, and egg6 for me when it is needed? And that it will also assign one of the listed colours to this new, unique egg? And perhaps other attributes, like "sparkly" or "hatchable" or something...
So something like... um...
Code: Select all
label search:
"You search for eggs."
call find
if find = True:
"AHA!"
call newegg
"You found an egg!"
else:
jump nofind
label find:
$find = renpy.random.randint(1,100)
if find >= 50:
return True
else:
return False
label newegg:
(Code for generating egg# then appending it to list of collected eggs)
label nofind:
"You fail to find an egg. Try again?"
menu tryagain:
"Yes.":
jump search
"No.":
jump stop
label stop
etc etc
Is this possible?
Would the following work?
$ egg%(serial)d = renpy.random("eggcol")
where $ serial is defined by a counter that constantly adds one each time there is a successful find?