Screen stats in imagemap don't work, why?

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
Cana
Newbie
Posts: 2
Joined: Tue Dec 04, 2018 1:36 pm
Contact:

Screen stats in imagemap don't work, why?

#1 Post by Cana »

Hello, all day I can't solve the problem...please help me..


1. Why the process doesn't stop on the map, and goes on to the first label (forest)
2. I do not understand why the screen "stats" disappears if I announced it and did not hide?

Code: Select all


define qtime = 8
define currency = 500
define energy = 100

screen stats:
    text "{size=60}{color=#ffffff}[qtime]:00{/color}{/size}" xalign 0.5 
    text "{size=20}{color=#ffffff}Money:[currency]{/color}{/size}" xalign 0.9
    text "{size=20}{color=#ffffff}Energy:[energy]/100{/color}{/size}" xalign 1.0

label start:
    
scene black



show text "{size=+20}Hi all.{/size}" at truecenter with dissolve
pause
hide text
menu:
    "Want play"
    "Yes":
        show text "Good." at truecenter with dissolve
        pause
        jump near_forest
    "No":
        return
        
label near_forest:
    
    show forest with dissolve
    show screen stats
    call screen forest
     
    screen forest: 
        
        
        default quick_menu = False
        
        default tt = Tooltip("")

        imagemap:
            
            ground "forest"
            hover "forest"
            
            hotspot (95, 331, 357, 556) clicked Jump("forest") hovered tt.Action("Forest")
        
        if tt.value:
            frame:
                xpos 0.35
                ypos 0.9
                xsize 600
                ysize 67
                
                
                vbox:
                    xalign 0.5
                    yalign 0.5
                    text tt.value
                    
label forest:
    scene forest
    "Good job"
return
    
    

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: Screen stats in imagemap don't work, why?

#2 Post by Per K Grok »

Cana wrote: Tue Dec 04, 2018 2:15 pm Hello, all day I can't solve the problem...please help me..


1. Why the process doesn't stop on the map, and goes on to the first label (forest)
2. I do not understand why the screen "stats" disappears if I announced it and did not hide?

Code: Select all


define qtime = 8
define currency = 500
define energy = 100

screen stats:
    text "{size=60}{color=#ffffff}[qtime]:00{/color}{/size}" xalign 0.5 
    text "{size=20}{color=#ffffff}Money:[currency]{/color}{/size}" xalign 0.9
    text "{size=20}{color=#ffffff}Energy:[energy]/100{/color}{/size}" xalign 1.0

label start:
    
scene black



show text "{size=+20}Hi all.{/size}" at truecenter with dissolve
pause
hide text
menu:
    "Want play"
    "Yes":
        show text "Good." at truecenter with dissolve
        pause
        jump near_forest
    "No":
        return
        
label near_forest:
    
    show forest with dissolve
    show screen stats
    call screen forest
     
    screen forest: 
        
        
        default quick_menu = False
        
        default tt = Tooltip("")

        imagemap:
            
            ground "forest"
            hover "forest"
            
            hotspot (95, 331, 357, 556) clicked Jump("forest") hovered tt.Action("Forest")
        
        if tt.value:
            frame:
                xpos 0.35
                ypos 0.9
                xsize 600
                ysize 67
                
                
                vbox:
                    xalign 0.5
                    yalign 0.5
                    text tt.value
                    
label forest:
    scene forest
    "Good job"
return
    
    


2. I think the stats screen is shown. It is just that it is behind screen forest so you can not see it.

Add "zorder 0" to forest and "zorder 1" to stats and that should sort that out.

I would move up the definition of screen forest to above label start. More easy to get an overview of the script that way.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3791
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Screen stats in imagemap don't work, why?

#3 Post by Imperf3kt »

Also consider using default for your variables instead of define, if you ever plan to change them.
Tooltip the way you are using it, has been deprecated, it's probably worth updating that.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

Cana
Newbie
Posts: 2
Joined: Tue Dec 04, 2018 1:36 pm
Contact:

Re: Screen stats in imagemap don't work, why?

#4 Post by Cana »

Thanks for answers, the output is found by cutting out a part of the picture.

Post Reply

Who is online

Users browsing this forum: Google [Bot]