Coding assistance please

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
johannes89
Newbie
Posts: 7
Joined: Sun Oct 07, 2018 9:34 am
Contact:

Coding assistance please

#1 Post by johannes89 »

Hey guys and girls today im here asking some assistance who can help me with my code for some reason I just cant get the imagemap to work ive just added some random text on my images will still change it once I get the coding right in the room I need to go to the livingroom and bed and waredrobe, but when I use the following code it skip the bedroom scene and go straight to the livingroom

Code: Select all

label bedroom:
    screen menu_bedroom():
    
        if bedroom:
            imagemap:
                ground "images/bedroom_idle.png"
                hover "images/bedroom_hover.png"

                hotspot (560,3,1200,550) clicked Jump("livingroom")
                hotspot (1150,0,1500,650) clicked Jump("waredrobe")
                hotspot (0,0,850,1150) clicked Jump("bed")
show screen menu_bedroom()

so im not really sure whats wrong with above code when I use the following code it does work but everyone say I must use the imagemap code

Code: Select all

#$result=renpy.imagemap("bedroom_idle.png","bedroom_hover.png",[(560,3,1200,550,"livingroom"),(1150,0,1500,650,"waredrobe"),(0,0,850,1150,"bed")])
will there be any coder who can assist me to get the futures to work im not sure what im doing wrong and if someone can help me how do I make a code for a day even so this one im working on is day 1 then there will be day 2 etc I hope I dont ask to much for assistance this is my first game im trying to code.

Code: Select all

label start:
scene wakeupasleep
et"Elly is fast asleep but need to wake up any moment."
scene wakeup asleep2
et"she really look so peacfull when asleep."
scene wakingup
et"Elly have a really busy day ahead of her."
scene wakingup3
e"Oh what a lovely night rest."
scene wakeup4
e"I should stand up and get ready for the day."
scene standupp
e"Its time to get up and go and get ready for the day."
scene standuppawake
e"this is such a lovely morning."
scene standuppawake walking
e"wow amazing"
scene bedrooom2 with fade

label bedroom:
    screen menu_bedroom():
    
        if bedroom:
            imagemap:
                ground "images/bedroom_idle.png"
                hover "images/bedroom_hover.png"

                hotspot (560,3,1200,550) clicked Jump("livingroom")
                hotspot (1150,0,1500,650) clicked Jump("waredrobe")
                hotspot (0,0,850,1150) clicked Jump("bed")
show screen menu_bedroom()

#$result=renpy.imagemap("bedroom_idle.png","bedroom_hover.png",[(560,3,1200,550,"livingroom"),(1150,0,1500,650,"waredrobe"),(0,0,850,1150,"bed")])
#this is the livingroom area where you will be able to choose to go to the shower or kitchen

label livingroom:
scene livingroomcouch2 with fade
e"wow amazing"
"..." 
screen menu_kitchen():
    
    if kitchen:
        imagemap:
            ground "images/kitchen_idle.png"
            hover "images/kitchen_hover.png"

            hotspot (6,3,600,1078) clicked Jump("kitchen")
            hotspot (1381,14,1917,1078) clicked Jump("shower")
show screen menu_bedroom()
#$result=renpy.imagemap("kitchen_idle.png","kitchen_hover.png",[(6,3,600,1078,"kitchen"),(1381,14,1917,1078,"shower")])
label kitchen:
        scene kitchen with fade
        et"hmmm lets go to the kicthen and make some coffee"
        scene coffee with dissolve
        et"This coffee machine is the best thing i have invested in."
        scene coffee1 with dissolve
        et"Its really fast and make my coffee nice and hot just like i want it."
        scene coffee2 with dissolve
        et"this see thru glass is really amazing if you can keep it clean ofcourse."
        scene coffee3 with dissolve
        et"And woalla the coffee is done and enjoyable."
        scene coffee4 with dissolve
        et"this is really the best thing to start the day with."
        scene coffee5 with fade
        et"every sip is delicious and wish not to end."
        scene kitchendone done with dissolve
        e"i should head over to the shower to get ready for today."
        "..."
jump shower 

label shower:
    scene shower2  with fade
    et"every sip is delicious and wish not to end."
    scene shower 
    et"every sip is delicious and wish not to end."
    scene showerdoor 
    et"every sip is delicious and wish not to end."
    scene shower3 
    et"every sip is delicious and wish not to end."
    scene showerundress 
    et"every sip is delicious and wish not to end."
    scene showerundressundresspants 
    et"every sip is delicious and wish not to end."
    scene showerundressundress 
    et"every sip is delicious and wish not to end."
    scene showetbeg
    et"every sip is delicious and wish not to end."
    scene showetbegzoom
    et"every sip is delicious and wish not to end."
    scene showetbegzoom2
    et"every sip is delicious and wish not to end."
    scene showetbegzoom3
    et"every sip is delicious and wish not to end."
    scene showetbegzoom4
    e"The shower was just what i needed to get the day started."
    scene showering with fade
    et"Heading to the bedroom rapped in a towel."
    "..."
jump aftershower
       
#this is the waredrobe where you can choose what to wear
if result == "waredrobe":
    label waredrobe:
     menu:

        "My corporate outfit.":
            jump outfit

        "Just something sexy and light.":
            jump sexy

label outfit: #this will be a normal corporate outfit
    e "Because of the interviews i really need to dress like a boss."
    scene closet with fade
    "tests"
    scene closet7 with fade
    "tests"
    scene closet654 with fade
    "tests"
    scene corporatedress2 with fade
    "tests"
    scene corporatedress22 with fade
    "tests"
    scene corporatedress with fade
    "tests"
    scene corporatedresoutfit with fade
    "tests"
jump livingroom2
label sexy: #this should be a sexy outfit
    e "Im feeling really good and happy and dont want to get dressed to heavily so ill just go with something light and sexy."
    scene closet with fade
    "tests"
    scene closet7 with fade
    "tests"
    scene closet654 with fade
    "tests"
    scene dressedsexy with fade
    "tests"
    scene dressedsexy2 with fade
    "tests"
    scene corporatedresoutfit2 with fade
    "tests"
    scene corporatedresoutfit22 with fade
    "tests"
jump livingroom2

label aftershower:
    et"what will i be wearing today"
    scene bathroomtowl
    et"what will i be wearing today"
    scene bathroomtowl2
    et"what will i be wearing today"
    scene bathroomtowl3
    et"what will i be wearing today"
    scene bathroomtowl4
    et"what will i be wearing today"
    scene bathroomtowl45
    et"what will i be wearing today"
jump waredrobe
#this is where you can go to bed 
if result == "bed":
    scene liveingroom00
    e"wow amazing"
    scene livingroomcouch2 with fade
    e"wow amazing"
    "..." 
    scene wakeup4
    "lets go to bed"
    "..."  
# here you will be going to the shower 

# ...after you took a shower you will walk back to the room 


# ... the game continues here.
label livingroom2:
scene liveingroom00 with fade

johannes89
Newbie
Posts: 7
Joined: Sun Oct 07, 2018 9:34 am
Contact:

Re: Coding assistance please

#2 Post by johannes89 »

I want to remove the shower scene and add it in shower.rpy but im struggling to do that im not sure how to do the coding to recall it on the main page same with the kitchen scene and the following events that will follow with it

User avatar
Per K Grok
Miko-Class Veteran
Posts: 882
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1-3, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

Re: Coding assistance please

#3 Post by Per K Grok »

johannes89 wrote: Thu Oct 11, 2018 2:21 pm Hey guys and girls today im here asking some assistance who can help me with my code for some reason I just cant get the imagemap to work ive just added some random text on my images will still change it once I get the coding right in the room I need to go to the livingroom and bed and waredrobe, but when I use the following code it skip the bedroom scene and go straight to the livingroom

Code: Select all

label bedroom:
    screen menu_bedroom():
    
        if bedroom:
            imagemap:
                ground "images/bedroom_idle.png"
                hover "images/bedroom_hover.png"

                hotspot (560,3,1200,550) clicked Jump("livingroom")
                hotspot (1150,0,1500,650) clicked Jump("waredrobe")
                hotspot (0,0,850,1150) clicked Jump("bed")
show screen menu_bedroom()

---------
There are a lot of stuff to comment on in your post.

The first thing would be on indenting (the empty space before a line of code). In python you need to get that right or your code will not work.

In the code above you have a label which is the start of a block of code. Everything that belongs to that block should be indented.

In this block of code that looks fine, except for the last line where the screen is shown. That line is not indented and it should be. In the code text you have that I have not included in this post there are a lot of indenting errors. I will not go into that now however.

In this code block you define your screen ( menu_bedroom()) and then you show it. I would separate those two things. I would put all the definitions of screens in a different place and only have the show screen part under the label.

In the definition of the screen you have an "if bedroom:" statement. I don't see what that would be good for. Get rid of that. Instead of "clicked" I would use "action".

So if we put the definition of the screen before the start label, we now have;

Code: Select all

screen menu_bedroom():
    imagemap:
        ground "images/bedroom_idle.png"
        hover "images/bedroom_hover.png"

        hotspot (560,3,1200,550) action Jump("livingroom")
        hotspot (1150,0,1500,650) action Jump("waredrobe")
        hotspot (0,0,850,1150) action Jump("bed")
        
        
 label start:
     ----
     ----
     
 label bedroom:
     show screen menu_bedroom()

Your problem now is that the program just moves on to the next line of code and you end up in the "livingroom".
You need to put in a pause to stop the code to go on, until you have clicked a hotspot. I would recommend a hard pause so clicking a hotspot is the only way to go on. That would give you the following code under the label bedroom

Code: Select all

 
 label bedroom:
     show screen menu_bedroom()
     $ renpy.pause(hard=True)

I'll stop here for now.

johannes89
Newbie
Posts: 7
Joined: Sun Oct 07, 2018 9:34 am
Contact:

Re: Coding assistance please

#4 Post by johannes89 »

wow this really helped thank you soooo much I really do appreciate it I thank you for not judging me and instead helping me right

Post Reply

Who is online

Users browsing this forum: arewar, Rhapsy