So I'm new to coding and still in the very experimental stage with what I hope to do, I was wondering if it's possible to set up a lotto that draws from a list of flagged names. Basically certain actions would place these names into the pool and be drawn at random at some point, but I'm not at all sure how to manage that.
I've been mostly experimenting with sugar cube 2 so far.
Comments
That is incredibly vague; without knowing what your end goals are, or how/why you want to implement them, it's hard to know what exactly might be the best way. Are these names already in the code or will they be entered by a player? If the flagged names are included, does the end user choose the names or will you set them up with some sort of function?
What you could do is create two arrays, one of which will contain all of the names, and another which will include the 'flagged' names. You can then use the random method to select a name from the latter list while still having both lists in the code.
I'm not sure what conditions determine which names are flagged, so the code below will need that information added:
Depending on what you need to do, there's a good chance you won't necessarily need two arrays. If the flagging of the names needs to be based on user input, the <<checkbox>> macro is probably the best way to handle that.
Since I'm still only just trying to figure out how to do the whole coding thing I initially tried to cobble something together based off flagging certain variables as "True" or adding the text names into it as things go along.
That said what you put up helps greatly, so thank you.
Generally when you are first learning to code and are designing a new feature it is a good idea to forget about how you are going to program/code it and focus instead on describing in some detail what you want the new feature to do. Keep working on that detail until it clearly describes (the majority of) the new feature.
Once you have that detailed description you can then break it down into it's (logical) individual components, doing this will help you understand what each part does, which in turn helps determine how to implement it using code.
The above technique is used by many experienced programmers to design things.