Help with scheduler

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.
Post Reply
Message
Author
User avatar
mystique
Regular
Posts: 43
Joined: Sun Dec 28, 2014 3:19 am
Contact:

Help with scheduler

#1 Post by mystique »

So here's my scheduler...
My question is how can I choose up to 4 activities per day (since it's divided into Morning, Afternoon, Evening, & Night)? I tried to look on the cookbook and the dse engine but it doesn't really help me because it can only let you choose 1 task per day/week.
In total, the user must select 23 activities for that week.

Image

philat
Eileen-Class Veteran
Posts: 1926
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Help with scheduler

#2 Post by philat »

http://lemmasoft.renai.us/forums/viewto ... er#p105293

Just check all variables for mon_morning, mon_afternoon, etc.

FYI, PyTom's post is from a while ago: you can in fact make the Done button sensitive only if all are selected.

Code: Select all

textbutton "Done" action If(None in [list of all variables], false=Return())

User avatar
mystique
Regular
Posts: 43
Joined: Sun Dec 28, 2014 3:19 am
Contact:

Re: Help with scheduler

#3 Post by mystique »

I did as what you've told me but why can't I select the buttons? I expected the selected button to change its color to black (color of text when hovered) but it didn't. I tried selecting all (23 activities) but after clicking done it didn't redirect me to its events.

Here's my code...

Code: Select all

screen schedule:
    
    tag menu
    
    imagemap:
        
        ground "sched.png"
        hover "sched_hover.png"
        xalign .5
        yalign .5
        
        #MONDAY
        hotspot (55,70,70,20) action SetVariable("mon_morning","school1")
        hotspot (55,96,70,20) action SetVariable("mon_morning","stroll1")
        hotspot (55,122,70,20) action SetVariable("mon_morning","home1")

        hotspot (55,165,70,20) action SetVariable("mon_afternoon","school2")
        hotspot (55,197,70,20) action SetVariable("mon_afternoon","stroll2")
        hotspot (55,231,70,20) action SetVariable("mon_afternoon","home2")
        
        hotspot (55,284,70,20) action SetVariable("mon_evening","stroll3")
        hotspot (55,309,70,20) action SetVariable("mon_evening","home3")
    
        hotspot (55,381,70,20) action SetVariable("mon_night","study")
        hotspot (55,411,70,20) action SetVariable("mon_night","sleep")
        
        #TUESDAY
        hotspot (144,70,70,20) action SetVariable("tues_morning","school1")
        hotspot (144,96,70,20) action SetVariable("tues_morning","stroll1")
        hotspot (144,122,70,20) action SetVariable("tues_morning","home1")

        hotspot (144,165,70,20) action SetVariable("tues_afternoon","school2")
        hotspot (144,197,70,20) action SetVariable("tues_afternoon","stroll2")
        hotspot (144,231,70,20) action SetVariable("tues_afternoon","home2")
        
        hotspot (144,284,70,20) action SetVariable("tues_evening","stroll3")
        hotspot (144,309,70,20) action SetVariable("tues_evening","home3")
        hotspot (144,334,70,20) action SetVariable("tues_evening","work2")
    
        hotspot (144,381,70,20) action SetVariable("tues_night","study")
        hotspot (144,411,70,20) action SetVariable("tues_night","sleep")
        
        #WEDNESDAY
        hotspot (244,70,70,20) action SetVariable("wed_morning","school1")
        hotspot (244,96,70,20) action SetVariable("wed_morning","stroll1")
        hotspot (244,122,70,20) action SetVariable("wed_morning","home1")

        hotspot (244,165,70,20) action SetVariable("wed_afternoon","school2")
        hotspot (244,197,70,20) action SetVariable("wed_afternoon","stroll2")
        hotspot (244,231,70,20) action SetVariable("wed_afternoon","home2")
        
        hotspot (244,284,70,20) action SetVariable("wed_evening","stroll3")
        hotspot (244,309,70,20) action SetVariable("wed_evening","home3")
    
        hotspot (244,381,70,20) action SetVariable("wed_night","study")
        hotspot (244,411,70,20) action SetVariable("wed_night","sleep")
        
        #THURSDAY
        hotspot (338,70,70,20) action SetVariable("thurs_morning","school1")
        hotspot (338,96,70,20) action SetVariable("thurs_morning","stroll1")
        hotspot (338,122,70,20) action SetVariable("thurs_morning","home1")

        hotspot (338,165,70,20) action SetVariable("thurs_afternoon","school2")
        hotspot (338,197,70,20) action SetVariable("thurs_afternoon","stroll2")
        hotspot (338,231,70,20) action SetVariable("thurs_afternoon","home2")
        
        hotspot (338,284,70,20) action SetVariable("thurs_evening","stroll3")
        hotspot (338,309,70,20) action SetVariable("thurs_evening","home3")
        hotspot (338,334,70,20) action SetVariable("thurs_evening","work2")
    
        hotspot (338,381,70,20) action SetVariable("thurs_night","study")
        hotspot (338,411,70,20) action SetVariable("thurs_night","sleep")
        
        #FRIDAY
        hotspot (439,70,70,20) action SetVariable("fri_morning","school1")
        hotspot (439,96,70,20) action SetVariable("fri_morning","stroll1")
        hotspot (439,122,70,20) action SetVariable("fri_morning","home1")

        hotspot (439,165,70,20) action SetVariable("fri_afternoon","school2")
        hotspot (439,197,70,20) action SetVariable("fri_afternoon","stroll2")
        hotspot (439,231,70,20) action SetVariable("fri_afternoon","home2")
        
        hotspot (439,284,70,20) action SetVariable("fri_evening","stroll3")
        hotspot (439,309,70,20) action SetVariable("fri_evening","home3")
    
        hotspot (439,381,70,20) action SetVariable("fri_night","study")
        hotspot (439,411,70,20) action SetVariable("fri_night","sleep")
        
        #SATURDAY
        hotspot (532,116,70,20) action SetVariable("sat_morning","stroll1")
        hotspot (532,148,70,20) action SetVariable("sat_morning","home1")
        hotspot (532,184,70,20) action SetVariable("sat_morning","work1")
        
        hotspot (532,327,70,20) action SetVariable("sat_evening","stroll3")
        hotspot (532,364,70,20) action SetVariable("sat_evening","home3")
        
        #SUNDAY
        hotspot (629,217,70,20) action SetVariable("sun_morning","stroll1")
        hotspot (629,270,70,20) action SetVariable("sun_morning","home1")
        
        #DONE AND CANCEL BUTTON
        hotspot (500,458,74,32) action If(None in [mon_morning and mon_afternoon and mon_evening and mon_night and tues_morning and tues_afternoon and tues_evening and tues_night and wed_morning and wed_afternoon and wed_evening and wed_night and thurs_morning and thurs_afternoon and thurs_evening and thurs_night and fri_morning and fri_afternoon and fri_evening and fri_night and sat_morning and sat_evening and sun_morning], false=Return()), Hide("menu2")
        hotspot (596,458,100,32) action Hide("menu") 

#MORNING

label school1:
    
    "Morning plan: School"
    "blah blah blah"
    return 
    
label stroll1:
    
    "Morning plan: Stroll"
    "blah blah blah"
    return
    
label home1:
    
    "Morning plan: Home"
    "blah blah blah"
    return
    
label work1:
    
    "Morning plan: Work"
    "blah blah blah"
    return 

#AFTERNOON
....
#EVENING
....
#NIGHT
....
And then I inserted this in the dialogue part...

Code: Select all

 $ mon_morning = None
    $ mon_afternoon = None
    $ mon_evening = None
    $ mon_night = None
    
    $ tues_morning = None
    $ tues_afternoon = None
    $ tues_evening = None
    $ tues_night = None
    
    $ wed_morning = None
    $ wed_afternoon = None
    $ wed_evening = None
    $ wed_night = None
    
    $ thurs_morning = None
    $ thurs_afternoon = None
    $ thurs_evening = None
    $ thurs_night = None
    
    $ fri_morning = None
    $ fri_afternoon = None
    $ fri_evening = None
    $ fri_night = None
    
    $ sat_morning = None
    $ sat_evening = None
    
    $ sun_morning = None
   
    call screen schedule 

philat
Eileen-Class Veteran
Posts: 1926
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Help with scheduler

#4 Post by philat »

Well, you're no longer using a Jump code, you're using SetVariable, so you have to do something with the variables to run the code.

Also, imagemap has selected_idle and selected_hover for when the hotspot has been selected.

Code: Select all

screen schedule:
    
    tag menu
    
    imagemap:
        
        ground "sched.png"
        hover "sched_hover.png"
        ## define more images for the imagemap
        selected_idle "insert_here.png"
        selected_hover "insert_here2.png"
        xalign .5
        yalign .5
        
        #MONDAY
        hotspot (55,70,70,20) action SetVariable("mon_morning","school1")
        hotspot (55,96,70,20) action SetVariable("mon_morning","stroll1")
        hotspot (55,122,70,20) action SetVariable("mon_morning","home1")

        hotspot (55,165,70,20) action SetVariable("mon_afternoon","school2")
        hotspot (55,197,70,20) action SetVariable("mon_afternoon","stroll2")
        hotspot (55,231,70,20) action SetVariable("mon_afternoon","home2")
        
        hotspot (55,284,70,20) action SetVariable("mon_evening","stroll3")
        hotspot (55,309,70,20) action SetVariable("mon_evening","home3")
    
        hotspot (55,381,70,20) action SetVariable("mon_night","study")
        hotspot (55,411,70,20) action SetVariable("mon_night","sleep")
        
        #TUESDAY
        hotspot (144,70,70,20) action SetVariable("tues_morning","school1")
        hotspot (144,96,70,20) action SetVariable("tues_morning","stroll1")
        hotspot (144,122,70,20) action SetVariable("tues_morning","home1")

        hotspot (144,165,70,20) action SetVariable("tues_afternoon","school2")
        hotspot (144,197,70,20) action SetVariable("tues_afternoon","stroll2")
        hotspot (144,231,70,20) action SetVariable("tues_afternoon","home2")
        
        hotspot (144,284,70,20) action SetVariable("tues_evening","stroll3")
        hotspot (144,309,70,20) action SetVariable("tues_evening","home3")
        hotspot (144,334,70,20) action SetVariable("tues_evening","work2")
    
        hotspot (144,381,70,20) action SetVariable("tues_night","study")
        hotspot (144,411,70,20) action SetVariable("tues_night","sleep")
        
        #WEDNESDAY
        hotspot (244,70,70,20) action SetVariable("wed_morning","school1")
        hotspot (244,96,70,20) action SetVariable("wed_morning","stroll1")
        hotspot (244,122,70,20) action SetVariable("wed_morning","home1")

        hotspot (244,165,70,20) action SetVariable("wed_afternoon","school2")
        hotspot (244,197,70,20) action SetVariable("wed_afternoon","stroll2")
        hotspot (244,231,70,20) action SetVariable("wed_afternoon","home2")
        
        hotspot (244,284,70,20) action SetVariable("wed_evening","stroll3")
        hotspot (244,309,70,20) action SetVariable("wed_evening","home3")
    
        hotspot (244,381,70,20) action SetVariable("wed_night","study")
        hotspot (244,411,70,20) action SetVariable("wed_night","sleep")
        
        #THURSDAY
        hotspot (338,70,70,20) action SetVariable("thurs_morning","school1")
        hotspot (338,96,70,20) action SetVariable("thurs_morning","stroll1")
        hotspot (338,122,70,20) action SetVariable("thurs_morning","home1")

        hotspot (338,165,70,20) action SetVariable("thurs_afternoon","school2")
        hotspot (338,197,70,20) action SetVariable("thurs_afternoon","stroll2")
        hotspot (338,231,70,20) action SetVariable("thurs_afternoon","home2")
        
        hotspot (338,284,70,20) action SetVariable("thurs_evening","stroll3")
        hotspot (338,309,70,20) action SetVariable("thurs_evening","home3")
        hotspot (338,334,70,20) action SetVariable("thurs_evening","work2")
    
        hotspot (338,381,70,20) action SetVariable("thurs_night","study")
        hotspot (338,411,70,20) action SetVariable("thurs_night","sleep")
        
        #FRIDAY
        hotspot (439,70,70,20) action SetVariable("fri_morning","school1")
        hotspot (439,96,70,20) action SetVariable("fri_morning","stroll1")
        hotspot (439,122,70,20) action SetVariable("fri_morning","home1")

        hotspot (439,165,70,20) action SetVariable("fri_afternoon","school2")
        hotspot (439,197,70,20) action SetVariable("fri_afternoon","stroll2")
        hotspot (439,231,70,20) action SetVariable("fri_afternoon","home2")
        
        hotspot (439,284,70,20) action SetVariable("fri_evening","stroll3")
        hotspot (439,309,70,20) action SetVariable("fri_evening","home3")
    
        hotspot (439,381,70,20) action SetVariable("fri_night","study")
        hotspot (439,411,70,20) action SetVariable("fri_night","sleep")
        
        #SATURDAY
        hotspot (532,116,70,20) action SetVariable("sat_morning","stroll1")
        hotspot (532,148,70,20) action SetVariable("sat_morning","home1")
        hotspot (532,184,70,20) action SetVariable("sat_morning","work1")
        
        hotspot (532,327,70,20) action SetVariable("sat_evening","stroll3")
        hotspot (532,364,70,20) action SetVariable("sat_evening","home3")
        
        #SUNDAY
        hotspot (629,217,70,20) action SetVariable("sun_morning","stroll1")
        hotspot (629,270,70,20) action SetVariable("sun_morning","home1")
        
        #DONE AND CANCEL BUTTON
        ## the list should be of variables, separated with commas / I'm also pretty sure you don't need the Hide action here
        hotspot (500,458,74,32) action If(None in [mon_morning, mon_afternoon, mon_evening, . . . ], false=Return()) 
        hotspot (596,458,100,32) action Hide("menu") 


label start:
    call screen schedule

    ## check for monday morning
    if mon_morning == "school1":
        call school1
    if mon_morning == "stroll1":
        call stroll1

    ## check for monday afternoon
    if mon_afternoon == "school2":
        call school2
    if mon_afternoon == "stroll2":
        call stroll2
And so forth. Obviously this will be a lot of repetitive typing -- if you want to loop through a list or define a function to make things easier, knock yourself out.

User avatar
mystique
Regular
Posts: 43
Joined: Sun Dec 28, 2014 3:19 am
Contact:

Re: Help with scheduler

#5 Post by mystique »

Thank you so much! I'm going to try this now.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Ocelot