Join GitHub today
3 contributors
#@PydevCodeAnalysisIgnore |
# This file is part of Ren'Py. The license below applies to Ren'Py only. |
# Games and other projects that use Ren'Py may use a different license. |
# Copyright 2004-2019 Tom Rothamel <[email protected]> |
# |
# Permission is hereby granted, free of charge, to any person |
# obtaining a copy of this software and associated documentation files |
# (the 'Software'), to deal in the Software without restriction, |
# including without limitation the rights to use, copy, modify, merge, |
# publish, distribute, sublicense, and/or sell copies of the Software, |
# and to permit persons to whom the Software is furnished to do so, |
# subject to the following conditions: |
# |
# The above copyright notice and this permission notice shall be |
# included in all copies or substantial portions of the Software. |
# |
# THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, |
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
from__future__import print_function |
import os |
import sys |
import warnings |
# Functions to be customized by distributors. ################################ |
# Given the Ren'Py base directory (usually the directory containing |
# this file), this is expected to return the path to the common directory. |
defpath_to_common(renpy_base): |
return renpy_base +'/renpy/common' |
# Given a directory holding a Ren'Py game, this is expected to return |
# the path to a directory that will hold save files. |
defpath_to_saves(gamedir, save_directory=None): |
import renpy # @UnresolvedImport |
if save_directory isNone: |
save_directory = renpy.config.save_directory |
save_directory = renpy.exports.fsencode(save_directory) |
# Makes sure the permissions are right on the save directory. |
deftest_writable(d): |
try: |
fn = os.path.join(d, 'test.txt') |
open(fn, 'w').close() |
open(fn, 'r').close() |
os.unlink(fn) |
returnTrue |
except: |
returnFalse |
# Android. |
if renpy.android: |
paths = [ |
os.path.join(os.environ['ANDROID_OLD_PUBLIC'], 'game/saves'), |
os.path.join(os.environ['ANDROID_PRIVATE'], 'saves'), |
os.path.join(os.environ['ANDROID_PUBLIC'], 'saves'), |
] |
for rv in paths: |
if os.path.isdir(rv) and test_writable(rv): |
break |
print('Saving to', rv) |
# We return the last path as the default. |
return rv |
if renpy.ios: |
from pyobjus import autoclass |
from pyobjus.objc_py_types import enum |
NSSearchPathDirectory = enum('NSSearchPathDirectory', NSDocumentDirectory=9) |
NSSearchPathDomainMask = enum('NSSearchPathDomainMask', NSUserDomainMask=1) |
NSFileManager = autoclass('NSFileManager') |
manager = NSFileManager.defaultManager() |
url = manager.URLsForDirectory_inDomains_( |
NSSearchPathDirectory.NSDocumentDirectory, |
NSSearchPathDomainMask.NSUserDomainMask, |
).lastObject() |
# url.path seems to change type based on iOS version, for some reason. |
try: |
rv = url.path().UTF8String().decode('utf-8') |
except: |
rv = url.path.UTF8String().decode('utf-8') |
print('Saving to', rv) |
return rv |
# No save directory given. |
ifnot save_directory: |
return gamedir +'/saves' |
# Search the path above Ren'Py for a directory named 'Ren'Py Data'. |
# If it exists, then use that for our save directory. |
path = renpy.config.renpy_base |
whileTrue: |
if os.path.isdir(path +'/Ren'Py Data'): |
return path +'/Ren'Py Data/'+ save_directory |
newpath = os.path.dirname(path) |
if path newpath: |
break |
path = newpath |
# Otherwise, put the saves in a platform-specific location. |
if renpy.macintosh: |
rv ='~/Library/RenPy/'+ save_directory |
return os.path.expanduser(rv) |
elif renpy.windows: |
if'APPDATA'in os.environ: |
return os.environ['APPDATA'] +'/RenPy/'+ save_directory |
else: |
rv ='~/RenPy/'+ renpy.config.save_directory |
return os.path.expanduser(rv) |
else: |
rv ='~/.renpy/'+ save_directory |
return os.path.expanduser(rv) |
# Returns the path to the Ren'Py base directory (containing common and |
# the launcher, usually.) |
defpath_to_renpy_base(): |
renpy_base = os.path.dirname(os.path.realpath(sys.argv[0])) |
renpy_base = os.path.abspath(renpy_base) |
return renpy_base |
############################################################################## |
# Doing the version check this way also doubles as an import of ast, |
# which helps py2exe et al. |
try: |
import ast; ast |
except: |
raise |
print('Ren'Py requires at least python 2.6.') |
sys.exit(0) |
android = ('ANDROID_PRIVATE'in os.environ) |
# Android requires us to add code to the main module, and to command some |
# renderers. |
if android: |
__main__ = sys.modules['__main__'] |
__main__.path_to_renpy_base = path_to_renpy_base |
__main__.path_to_common = path_to_common |
__main__.path_to_saves = path_to_saves |
os.environ['RENPY_RENDERER'] ='gl' |
defmain(): |
renpy_base = path_to_renpy_base() |
# Add paths. |
if os.path.exists(renpy_base +'/module'): |
sys.path.append(renpy_base +'/module') |
sys.path.append(renpy_base) |
# This is looked for by the mac launcher. |
if os.path.exists(renpy_base +'/renpy.zip'): |
sys.path.append(renpy_base +'/renpy.zip') |
# Ignore warnings that happen. |
warnings.simplefilter('ignore', DeprecationWarning) |
# Start Ren'Py proper. |
try: |
import renpy.bootstrap |
exceptImportError: |
print('Could not import renpy.bootstrap. Please ensure you decompressed Ren'Py', file=sys.stderr) |
print('correctly, preserving the directory structure.', file=sys.stderr) |
raise |
renpy.bootstrap.bootstrap(renpy_base) |
if__name__'__main__': |
main() |
Copy lines Copy permalink
Original author(s) | Tom 'PyTom' Rothamel |
---|---|
Developer(s) | Tom 'PyTom' Rothamel[1] |
Initial release | August 24, 2004; 14 years ago |
Stable release | Ren'Py 7.3.0 / June 16, 2019; 12 days ago |
Repository | |
Written in | Python, Cython |
Operating system | Windows, Mac OS X, Linux, FreeBSD, OpenBSD, Android, IOS |
Size | 60 MB |
Available in | English for the engine - UTF-8 use for resulting programs |
Type | Game engine (visual novel) |
License | MIT License[2] |
Website | www.renpy.org |
Features[edit]
Reception[edit]
See also[edit]
References[edit]
- ^Lin, Maria (December 2005). 'Returning the Love: Three Fans Taking the Next Step'. Animefringe. ISSN1705-3692. Retrieved 4 May 2019.
- ^'License'. Ren'Py. Retrieved 4 May 2019.
- ^'Ren'Py Games List'. Ren'Py. Retrieved 4 May 2019.
- ^QJ Staff (24 November 2007). 'Ren'Py Visual Novel Engine: make your own visual novel, dating sim'. QuickJump. Archived from the original on 9 June 2017. Retrieved 4 May 2019.
- ^ ab'The Ren'Py Visual Novel Engine'. Ren'Py. Retrieved 4 May 2019.
- ^'Installing Ren'Py on Gentoo Linux'.
- ^'Ren'Py 6.99'. Ren'Py. Retrieved 4 May 2019.
- ^D., Konstantinos (8 May 2012). 'Indie Tools: Ren'Py'. Indie Games Plus. Retrieved 4 May 2019.
- ^Wiesehan, Robert (7 July 2014). 'Learn To Make Your Own Visual Novels With Ren'Py, Or Play One Of These'. MakeUseOf. Retrieved 4 May 2019.
- ^Stuart, Keith (20 March 2014). 'How to get into the games industry – an insiders' guide'. The Guardian. Retrieved 4 May 2019.
- ^'Experimental Game Design'. mycours.es. Retrieved 4 May 2019.
- ^Sullivan, Dean; Critten, Jessica (2014-11-01). 'Adventures in Research Creating a video game textbook for an information literacy course'. College & Research Libraries News. 75 (10): 570–573. ISSN0099-0086.
External links[edit]
- Official website
- You use the same type of network (such as Ethernet) at work and at home, but the settings you use at work don't allow your Mac to automatically connect to the same type of network at home.
- Your Mac connects to more than one type of network service (such as both Wi-Fi and Ethernet) at work and at home, but at work you want your Mac to try connecting to the Ethernet network first, and at home you want your Mac to try connecting to the Wi-Fi network first. In other words, you want to set a different service order for each location.
- Your Mac isn't connecting to your network and you want to quickly reset your network settings for testing purposes, without losing your current network settings.
How to add or remove a network location
- Choose Apple menu () > System Preferences, then click Network.
- The Location pop-up menu shows the name of your currently selected set of network settings. The default location is named Automatic. Choose Edit Locations from this menu.
- Click the Add (+) button below the list of locations, then type a name for the new location, such as Work or Home or Mobile. (To remove a location, use the Remove (–) button below the list.)
- Click Done. The Location menu should now show the name of your new location. Any changes you now make to your Wi-Fi, Ethernet, or other network settings will be saved to that location when you click Apply. The network settings in your previous location remain as you left them, so you can use the Location menu to switch back at any time.
- Click Apply to save your settings and complete the switch from the previous location to the new one. Your Mac then automatically tries to determine the correct settings for each type of network. If you need to change the settings manually, remember to click Apply again after making your changes.
How to switch between network locations
- Use the Location pop-up menu in Network preferences, as described above. Remember to click Apply after choosing a location.
- Or choose Apple menu > Location from the menu bar, then choose your location from the submenu.
How to change the network service order
- Choose Apple menu > System Preferences, then click Network.
- Use the Location menu to choose the location you want to modify.
- Click below the list of services, then choose Set Service Order.
- Drag services within the list to change their order. Your Mac will try to connect to the service at the top of the list first, then continue in descending order until a connection is successful.
Virtual private network (VPN) connections can't be reordered, because they always take priority over other connections. - Click OK, then click Apply to make the updated service order active.
How to prevent a network service from being used
- Choose Apple menu > System Preferences, then click Network.
- Use the Location menu to choose the location you want to modify.
- Click below of the list of services, then choose Make Service Inactive.
- Click Apply.
AutoRecover, a feature that is available in some Office applications, attempts to recover files automatically in the event of an application or system crash. It does this by periodically saving a copy of the file in the background. By default, AutoRecover saves a recovery file every 10 minutes.
You can set how frequently these AutoRecover files are saved. For example, if you set AutoRecover to save every 5 minutes, you may recover more information in the event of unexpected shutdown — such as from a power outage — than if it's set to save every 10 or 15 minutes.
If you manually save your file, the previous AutoRecover files are removed because you've just saved your changes.
AutoSave is a different feature which automatically saves your file as you work - just like if you save the file manually - so that you don't have to worry about saving on the go. On the Mac, AutoSave is available in Excel, Word, and PowerPoint for Office 365 subscribers. When AutoSave is turned on AutoRecover files are rarely needed.
For more information see: What is AutoSave?
Recover a file saved by AutoRecover
Excel | /Users/<username>/Library/Containers/com.microsoft.Excel/Data/Library/Application Support/Microsoft |
PowerPoint | /Users/<username>/Library/Containers/com.Microsoft.Powerpoint/Data/Library/Preferences/AutoRecovery |
Word | /Users/<username>/Library/Containers/com.Microsoft/Data/Library/Preferences/AutoRecovery |
- The AutoRecovery folder is a hidden folder, so you probably won't see it if you just try to navigate to it in Finder. Use the Go To Folder tool and enter the full path to get around this.
- If you close a file and click Don't Save, the AutoRecover file will be deleted because Office assumes that everything is ok and the AutoRecover file isn't needed.
Change how frequently AutoRecover files are automatically saved in Word, PowerPoint, or Excel
- On the Word, PowerPoint, or Excel menu, click Preferences.
- Click Save .
- In the Save AutoRecover info box, enter how frequently you want the program to save documents.
Change where to save AutoRecover files in Word
- On the Word menu, click Preferences.
- Under Personal Settings, click File Locations .
- Under File locations, click AutoRecover files, and then click Modify.
- Find the location where you want to automatically save files, and then click Open.
Recover text from a damaged file in Word
- On the Word menu, click Preferences.
- Under Authoring and Proofing Tools, click General .
- Make sure that the Confirm file format conversion at Open check box is selected, and then close the General dialog box.
- Click File, Open.
- On the Open menu towards the bottom right select Recover Text.
- Open the document.
Find an automatically saved or recovered file
Word
- On the Word menu, click Preferences.
- Under Output and Sharing, click Save .
- In the AutoSave or AutoRecover info every box, enter how frequently you want Word to save documents.
- On the Word menu, click Preferences.
- Under Personal Settings, click File Locations .
- Under File locations, click AutoRecover files, and then click Modify.
- Find the location where you want to automatically save files, and then click Choose.
- On the Word menu, click Preferences.
- Under Authoring and Proofing Tools, click General .
- Make sure that the Confirm conversion at Open check box is selected, and then click OK.
- On the Standard toolbar, click Open .
- On the Enable pop-up menu, click Recover Text from Any File.
- Open the document.
PowerPoint
- On the PowerPoint menu, click Preferences.
- Click Save , select the AutoSave or AutoRecover info every check box, and then enter how frequently you want PowerPoint to save presentations.
Excel
- On the Excel menu, click Preferences.
- Under Sharing and Privacy, click Save .
- Select the AutoSave or AutoRecover info every check box, and then enter how frequently you want Excel to save workbooks.
See Also
Join GitHub today
Ren Py Tutorial
Comments
commented Dec 28, 2013
I've got my program set up to load all of the written contents of the game from a text document located within the game's directory. It works fine on windows systems, but on mac ones the game can't find the file location. It seems to be searching from the root directory rather then the game's directory. |
commented Dec 28, 2013
How are you accessing the data? You probably want to use renpy.file(), which opens a file-like object in read-only mode, rather than using open() or file() directly. The latter two choices will open the file relative to the current directory, which may vary based on where the OS chooses to run Ren'Py from. I don't think this is a bug, so I'm closing the issue. But if you still have problems, feel free to reply and we can sort them out. |
commented Dec 28, 2013
I'm currently using Python code to access the file in read-only mode, since I then parse it and split the contents into two lists, one for tags and one for data. Here is my current reading function: python: fi = open(fileName, 'r') |
Renpy Save Location Mac
commented Dec 28, 2013
Oh, and the call for the function is: call fileReader('game/localisation/english.txt', englishScriptVars, englishScriptLines) |
commented Dec 29, 2013
You want to replace with |
commented Dec 29, 2013
I had to change the path to 'localisation/english.txt' as well in order for it to work, however now all my lines end in some kind of rectangle. I'm assuming this is a special character that the renpy file system has added in, how do I get rid of that? |
commented Dec 29, 2013
That's probably the 'r' character. Ren'Py didn't add it - but it is opening the file in binary mode, which is why you're seeing it. You'll have to ignore it. |
commented Dec 29, 2013
Thank you, that fixed the issue. I didn't realize that if the file was opened in binary mode (which I also didn't know that was what Ren'Py did) then all the lines would end in both r and n. |
commented Dec 29, 2013
Just BTW, I noticed your'e writing your own localization system. Did you know that Ren'Py has one? It's documented here: It might not work for all use-cases, though. I'm curious as to if you've seen it, and if there's something it's not giving you. |
commented Dec 29, 2013
Someone did point that out to me, but it just wouldn't work for what I want. I wanted to make something that has the actual written content from the game completely separated from the code, while also learning how to write a localization system in future projects that aren't written in Ren'Py. This way someone could supply me with a localization file and I'd then code it into the game. If the localization file had spelling errors or other mistakes in it, all that would need to be changed is the text file, the game itself wouldn't have to be recompiled. |