Choosing more than one out of a list of several choices
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.
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.
- sempersapiens
- Regular
- Posts: 47
- Joined: Mon Jun 30, 2014 4:31 pm
- Location: Canada
- Contact:
Choosing more than one out of a list of several choices
I want to have a feature in my game where the the player chooses the character's schedule for the week, like in Long Live the Queen and other such games. I've been following Aleema's tutorial on using imagemaps, and I think I've gotten the hang of the hotspots and everything. But what I can't figure out how to do is allow the player to choose multiple hotspots on the map before it leads to the result, and also restrict which choices can and can't be selected at the same time.
Here is the ground file of my imagemap (I know it's kind of messy, but it's just for practice): I want the player to be required to choose one of the two options for Monday during the day, one of the two options for Monday during the night, one of the two options for Tuesday during the day, etc. I want to make sure that you can't select both of one time period's options at once (e.g. you can't attend class on Monday morning while relaxing on Monday morning at the same time), and that you have to select one for each before continuing. Does anyone know how I should code this?
Here is the ground file of my imagemap (I know it's kind of messy, but it's just for practice): I want the player to be required to choose one of the two options for Monday during the day, one of the two options for Monday during the night, one of the two options for Tuesday during the day, etc. I want to make sure that you can't select both of one time period's options at once (e.g. you can't attend class on Monday morning while relaxing on Monday morning at the same time), and that you have to select one for each before continuing. Does anyone know how I should code this?
- akemicchi
- Veteran
- Posts: 465
- Joined: Mon Dec 31, 2007 11:22 pm
- Projects: Magicians of Delphine, Panaderia: Ensaimada, SweetTooth!, XOXO Droplets
- Deviantart: littlebabyshoes
- Contact:
Re: Choosing more than one out of a list of several choices
Just wondering, but do you already have a working system for imagemaps with just one choice? Like, one action per day, as opposed to two actions per day?
The simplest way I can think of would be-- instead of returning results immediately-- you using SetVariable to change the values of certain variables. Once all the variables have values, you have a button appear to confirm and continue on to the next screen. You evaluate the variables as opposed to the Return.
Monday's hotspots, for example, would have variables monday_day, which would have the value of either 'Lit Class' or 'Relax', and monday_night, with the possible values of 'Study', and 'Relax'. You'd do this for all the days. You have a conditional statement evaluating that the variables monday_day, monday_night, tuesday_day, etc all don't return a value other than None, and have a button appear to continue. Hmm, let whip something up really fast.
Like something like this, maybe? That's the general gist of it, anyway; I haven't tested it. If you already have a working system, though, it might be easier to think of more suitable code.
The simplest way I can think of would be-- instead of returning results immediately-- you using SetVariable to change the values of certain variables. Once all the variables have values, you have a button appear to confirm and continue on to the next screen. You evaluate the variables as opposed to the Return.
Monday's hotspots, for example, would have variables monday_day, which would have the value of either 'Lit Class' or 'Relax', and monday_night, with the possible values of 'Study', and 'Relax'. You'd do this for all the days. You have a conditional statement evaluating that the variables monday_day, monday_night, tuesday_day, etc all don't return a value other than None, and have a button appear to continue. Hmm, let whip something up really fast.
Code: Select all
hotspot (740, 232, 75, 73) clicked SetVariable("monday_day", "Lit Class")
hotspot (832, 232, 75, 73) clicked SetVariable("monday_day", "Relax")
hotspot (1074, 232, 75, 73) clicked SetVariable("monday_night", "Study")
hotspot (1166, 232, 75, 73) clicked SetVariable("monday_night", "Study")
if monday_day and monday_night: # If there's a value for monday_day and monday_night, show the button to continue
window:
xalign 0.8 yalign 0.8
textbutton "Continue" action Return()- sempersapiens
- Regular
- Posts: 47
- Joined: Mon Jun 30, 2014 4:31 pm
- Location: Canada
- Contact:
Re: Choosing more than one out of a list of several choices
I didn't have a working system yet, so that seems to be exactly what I'm looking for! I'm getting an error message when I try it, though. Do you know what this means the problem is?
- akemicchi
- Veteran
- Posts: 465
- Joined: Mon Dec 31, 2007 11:22 pm
- Projects: Magicians of Delphine, Panaderia: Ensaimada, SweetTooth!, XOXO Droplets
- Deviantart: littlebabyshoes
- Contact:
Re: Choosing more than one out of a list of several choices
Ahh, it's not supposed to be clicked, but action.
It should work now. :)
Code: Select all
hotspot (85, 105, 70, 90) action SetVariable("monday_day", "Lit Class")- sempersapiens
- Regular
- Posts: 47
- Joined: Mon Jun 30, 2014 4:31 pm
- Location: Canada
- Contact:
Re: Choosing more than one out of a list of several choices
Oh of course! That makes sense. Thanks so much for your help!
Edit: Oh dammit. Changed that, and I'm still getting "'StoreModule' object has no attribute 'monday_day'."
Edit2: Figured it out, I was being an idiot and not setting the variables to 0 before calling the imagemap! It's working now! Thanks again.
Edit: Oh dammit. Changed that, and I'm still getting "'StoreModule' object has no attribute 'monday_day'."
Edit2: Figured it out, I was being an idiot and not setting the variables to 0 before calling the imagemap! It's working now! Thanks again.
Who is online
Users browsing this forum: Google [Bot]

