Making an auto read button

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
Endorphin
Veteran
Posts: 366
Joined: Mon Nov 22, 2010 10:52 am
Location: Germany
Contact:

Making an auto read button

#1 Post by Endorphin » Mon Nov 22, 2010 2:55 pm

Good evening~

Okay, first of all:
I'm really sorry for asking two questions a day.
I just tried so many ways at this thing and didn't find the right one that I'm really desperate now.

However, this is the code:

Code: Select all

show_auto_button = True
    
    def auto_button():
        
        if show_auto_button:
            
            ui.hbox(xpos=690, xalign=0, ypos=559, yalign=0)
            ui.imagebutton("auto1.png", "auto2.png", clicked=dunnowhattoinserthere)
            ui.close()
                
    config.overlay_functions.append(auto_button)     
I know the code for changing the auto read speed, but I don't know the one for activating it.
[I also found the one for skipping, which was toggle_skipping, but I'm afrait I overlooked this one. x_x"]

Thank you for your patience~

- Ryouko

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Making an auto read button

#2 Post by PyTom » Mon Nov 22, 2010 2:59 pm

Code: Select all

screen auto_button:
     button xpos 690 ypos 559 action Preference("auto-forward mode", "toggle")
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Endorphin
Veteran
Posts: 366
Joined: Mon Nov 22, 2010 10:52 am
Location: Germany
Contact:

Re: Making an auto read button

#3 Post by Endorphin » Mon Nov 22, 2010 3:18 pm

I'm sorry, I'm afrait I don't quite get it.
Where do I have to insert it?
Instead of the code I posted? =o
[Because it's missing the clickable area then.]
Would there be a way to keep the used pictures?

Well, thank you for your help anyway. ♥
I might get it someday.
(The day when I finally start to understand logical thinking.)

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Making an auto read button

#4 Post by PyTom » Mon Nov 22, 2010 4:51 pm

No, you're right, it is. I brain-farted, and forgot to make it an imagebutton:

Code: Select all

screen auto_button:
     imagebutton: 
         idle "auto1.png"
         hover "auto2.png"
         xpos 690 ypos 559 
         action Preference("auto-forward mode", "toggle")
To show it, use:

Code: Select all

show screen auto_button
To hide it, use:

Code: Select all

hide screen auto_button
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Endorphin
Veteran
Posts: 366
Joined: Mon Nov 22, 2010 10:52 am
Location: Germany
Contact:

Re: Making an auto read button

#5 Post by Endorphin » Tue Nov 23, 2010 11:18 am

Oh, so it is possible, huh?
Ren'Py sure is amazing. *-*

However, this kinda gets me an error.

Code: Select all

I'm sorry, but an uncaught exception occurred.

Exception: Preference('auto-forward mode', 'toggle') is unknown.

While running game code:
 - script at line 124 of C:\Dokumente und Einstellungen\Ryouko\Desktop\Projekte\My Mind Is My Story/game/main.rpy
 - python at line 108 of C:\Dokumente und Einstellungen\Ryouko\Desktop\Projekte\My Mind Is My Story/game/main.rpy.
 - python at line 1415 of renpy-6.11.2/common/00screen.rpy.
I wonder why it doesn't know it?

User avatar
PyTom
Ren'Py Creator
Posts: 15893
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Making an auto read button

#6 Post by PyTom » Tue Nov 23, 2010 12:53 pm

Grr... serves me right for trying to go for memory. It's

Code: Select all

Preference("auto-forward", "toggle")
Sorry about that.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Endorphin
Veteran
Posts: 366
Joined: Mon Nov 22, 2010 10:52 am
Location: Germany
Contact:

Re: Making an auto read button

#7 Post by Endorphin » Wed Nov 24, 2010 1:39 pm

Thank you! x3
Still, it's amazing that you know all of this by memory! =)
(I always forget codes. xD)

There aren't errors now. ♥
But there also happens nothing when I press the button - the message doesn't change. =o
(It looks like making an auto read button is pretty complicated. >.<)

Post Reply

Who is online

Users browsing this forum: No registered users