How to call a function?

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
LiveTurkey
Regular
Posts: 109
Joined: Tue Dec 27, 2016 10:50 pm
Location: Brooklyn
Contact:

How to call a function?

#1 Post by LiveTurkey »

I know this is a very simple question but I tried searching around and I couldn't find the answer.

I have a function:

Code: Select all

init python:
    def hideScreens():
        renpy.hide_screen("homeroomOptions")
        renpy.hide_screen("hallwayOneOptions")
        renpy.hide_screen("englishClassroomOptions")
        renpy.hide_screen("map")
I know that to call it inside of on action block you just type the name like so,

Code: Select all

        hotspot (588, 343, 207, 186) action [increaseTime, hideScreens, Hide("map"), Jump("englishClassroom")]       
but how do I call it not within an action block but within a label like this

Code: Select all

label endGame:
 
######This is what I tried. Didn't work. ###################
    $ hideScreens       
######This is what I tried. Didn't work. ###################

######This is what I had to resort to. ####################
    $ renpy.hide_screen("homeroomOptions")
    $ renpy.hide_screen("hallwayOneOptions")
    $ renpy.hide_screen("englishClassroomOptions")
    $ renpy.hide_screen("map")
######This is what I had to resort to. ####################
    if(day > totalDays):
        p "Game Over"
        return
    else:
        jump homeroom

User avatar
Alex
Lemma-Class Veteran
Posts: 3093
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: How to call a function?

#2 Post by Alex »

Just add brackets, like

Code: Select all

$ hideScreens()

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], BBN_VN, decocloud, Google [Bot]