I'm looking to use the RenPy functions in my python script. Something like this in it's own separate function.py file:
I'm just curious as I'm not well versed in python. I just ended up copying the renpy.py file from the renpy directory into my script folder and I can't follow it all that well to see where it's getting all it's functions from. More of a python question then a RenPy question.
P.S: I'm wondering if just doing this and not even bothering would be better:
Importing renpy functions?
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.
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.
-
- Newbie
- Posts: 2
- Joined: Wed May 30, 2018 1:14 am
- Contact:
- xavimat
- Eileen-Class Veteran
- Posts: 1461
- Joined: Sat Feb 25, 2012 8:45 pm
- Completed: Yeshua, Jesus Life, Cops&Robbers
- Projects: Fear&Love
- Organization: Pilgrim Creations
- Github: xavi-mat
- itch: pilgrimcreations
- Location: Spain
- Discord: xavimat
- Contact:
Re: Importing renpy functions?
From rpy files you have access to all renpy functions. There is no need to import.
Your second example is the way to go, use init python to define your functions
Your second example is the way to go, use init python to define your functions
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)
- Remix
- Eileen-Class Veteran
- Posts: 1628
- Joined: Tue May 30, 2017 6:10 am
- Completed: None... yet (as I'm still looking for an artist)
- Projects: An un-named anime based trainer game
- Contact:
Re: Importing renpy functions?
Note though:
Ren'py exposed all functions from renpy/exports.py in the global namespace (which in turn imports a couple of modules and a host of named functions and classes)
Only those functions can be referenced through renpy.reference_name ( e.g. renpy.roll_forward_info() is valid whereas renpy.LiveComposite() is not )
To reference a function or class from one of the non-exports-exposed modules, just full dot path naming ( e.g. renpy.display.layout.LiveComposite() )
Basically, if you cannot reference it just with renpy.reference_name, find it and use full path ...
Ren'py exposed all functions from renpy/exports.py in the global namespace (which in turn imports a couple of modules and a host of named functions and classes)
Only those functions can be referenced through renpy.reference_name ( e.g. renpy.roll_forward_info() is valid whereas renpy.LiveComposite() is not )
To reference a function or class from one of the non-exports-exposed modules, just full dot path naming ( e.g. renpy.display.layout.LiveComposite() )
Basically, if you cannot reference it just with renpy.reference_name, find it and use full path ...
Frameworks & Scriptlets:
- Speech Bubble dialogue system
- Multiple Notify with ATL and history
- (WIP) Radial Masking - needs updating to use Shader
- 7.4 - Smooth Tinting using ATL and matrixcolor
- Several other repositories there too
Who is online
Users browsing this forum: AWizardWithWords, piinkpuddiin