using ATL commands with screen language?

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
SavedByZero
Newbie
Posts: 12
Joined: Tue Jun 16, 2020 11:56 am
Contact:

using ATL commands with screen language?

#1 Post by SavedByZero » Mon Aug 03, 2020 3:18 pm

I've got both the ATL page and the Screen Language page open, but this one is a head scratcher. I'm trying to have a custom screen display a looping timeline animation under certain conditions, like this:

Code: Select all

screen timeline(stage):
    if stage == "locked":
        window id "info_button_2_locked" background "info2_all_locked" xanchor 1.0 yanchor 1.0 xmaximum 218 ymaximum 50:
            xalign 0 
            yalign 0
            xpos 1248
            ypos 688
    if stage == "1":
        window id "info_button_2_1" background "info2_1_idle" xanchor 1.0 yanchor 1.0 xmaximum 218 ymaximum 50:
            xpos 1248
            ypos 688
            label start:
                image "timeline_btn_1_00.png" xanchor 0 yanchor 0 xpos 0 ypos 0
                pause 0.2
                image "timeline_btn_1_01.png"
                pause 0.2
                image "timeline_btn_1_02.png"
                pause 0.2 
                image "timeline_btn_1_03.png"
                pause 0.2 
                repeat
But Ren'py doesn't seem to recognize or allow anything starting with the first "pause" line downward. What am I doing wrong here? (also, I don't want the animating images to linger after the game reaches its conclusion screen)

nananame
Regular
Posts: 72
Joined: Fri Oct 13, 2017 1:40 pm
Contact:

Re: using ATL commands with screen language?

#2 Post by nananame » Tue Aug 04, 2020 3:25 am

You can't have labels inside a screen. Also, you can't use the start label somewehre else (the start label starts the game).

What you should do is define an image with atl somewhere else:

Code: Select all

image thisismyatlimage:
    "timeline_btn_1_00.png"
    0.2
    "timeline_btn_1_01.png"
    0.2
    "timeline_btn_1_02.png"
    0.2 
    "timeline_btn_1_03.png"
    0.2 
    repeat
and then simply use it in screen as an image (with add or background or whatever fits), calling "thisismyatlimage"

SavedByZero
Newbie
Posts: 12
Joined: Tue Jun 16, 2020 11:56 am
Contact:

Re: using ATL commands with screen language?

#3 Post by SavedByZero » Tue Aug 04, 2020 10:53 am

Okay thanks. I also found a workaround where I did this:

Code: Select all

screen timeline_btn(n,m): 
    image "gui/button/timeline btns/timeline_btn_"+m+"_0"+n+".png" xanchor 1.0 yanchor 1.0 xpos 1248 ypos 688
     
        
screen timeline_btn_show(n):
        timer 0.01 action [Hide("timeline_btn"),Show("timeline_btn",None,"0",n)]
        timer 0.2 action [Hide("timeline_btn"),Show("timeline_btn",None,"1",n)]
        timer 0.4 action [Hide("timeline_btn"),Show("timeline_btn",None,"2",n)]
        timer 0.6 action [Hide("timeline_btn"),Show("timeline_btn",None,"3",n)] 
        timer 0.8 action Hide("timeline_btn_show")
and then called it with

Code: Select all

 timer 1.0 action Show("timeline_btn_show",None,"1") repeat True
, but your way looks cleaner since with my way I have to tell the scripting person to hide a bunch of stuff at the end of each of her scripts to remove this.

EDIT: I think I found a bug in Ren'py, having to do with image maps. I used your example and I have this in my custom screens file calling it(idle "timeline_btn_2", where "timeline_btn_2" is my atl animation):

Code: Select all

 if stage == "2":
        window id "info_button_2_2" background None xanchor 1.0 yanchor 1.0 xmaximum 218 ymaximum 50:
            xalign 0 
            yalign 0
            xpos 1248
            ypos 688
            #timer 0.1 action Hide("timeline_btn_show")
            #timer 1.0 action Show("timeline_btn_show",None,"2") repeat True 
            imagemap:
                idle "timeline_btn_2"
                hotspot (0,0,48,48) action [Show('info_box2',None,persistent.timelineHeading1,persistent.timelineBody1),Play("sound","audio/sfx/timelinePopup.ogg")]
                hotspot (84,0,134,48) action [Show('info_box2',None,persistent.timelineHeading2,persistent.timelineBody2),Play("sound","audio/sfx/timelinePopup.ogg")]
Which works fine with only one hotspot. However, when I have both hotspots there as shown, and I close the window that either hotspot calls, the game crashes with the error 'NoneType' has no attribute 'append', and it isn't any of my code throwing that error. I don't use append anywhere -- the trace goes right from the main script to ast.py, and then to a bunch of other low level engine code.

Post Reply

Who is online

Users browsing this forum: Google [Bot], TioNick