I'm kinda new to programming and I love using Renpy so I was looking forward to make my final assignment with it. But I need to make 3 databases in the game and I'm not sure if it is possible with Python or exporting the apk in Android Studio.
I can't find anything in the documentation so I'm here for help.
Thanks in advance.
Is there a way to make a Database?
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.
- m_from_space
- Eileen-Class Veteran
- Posts: 1011
- Joined: Sun Feb 21, 2021 3:36 am
- Contact:
Re: Is there a way to make a Database?
I mean a simple class can be a database. I am not sure how complex your database structure has to be. What I can tell you is, that Renpy sadly does not ship with sqlite3 (which is part of the Python standard library). But you can actually create a subprocess that invokes another python binary, that will then import sqlite3. I don't recommend doing this being new to programming though. Maybe there are other python database packages out there, that you can simply install into the game's "python-packages" folder and then import.
But again, what are you actually hoping to store inside those databases?
Re: Is there a way to make a Database?
I needed because this game is my final project in my school and it's obligatory. But I already solved, thanks!m_from_space wrote: ↑Mon Jan 15, 2024 8:54 amI mean a simple class can be a database. I am not sure how complex your database structure has to be. What I can tell you is, that Renpy sadly does not ship with sqlite3 (which is part of the Python standard library). But you can actually create a subprocess that invokes another python binary, that will then import sqlite3. I don't recommend doing this being new to programming though. Maybe there are other python database packages out there, that you can simply install into the game's "python-packages" folder and then import.
But again, what are you actually hoping to store inside those databases?
Re: Is there a way to make a Database?
Only the old renpy python version used to make a base like this.
Download and install python 2.7.10 (https://www.python.org/downloads/release/python-2710/)
Copy:
C:\Program Files (x86)\Python\Python 2.7.10\Lib\sqlite3
C:\Program Files (x86)\Python\Python 2.7.10\DLLs\_sqlite3.pyd
C:\Program Files (x86)\Python\Python 2.7.10\DLLs\sqlite3.dll.
In the folder:
C:\Program Files (x86)\RenPy\renpy-*.**.**.*-sdk\lib\windows-i686\Lib
To check, add the following code to the beginning of script.py:
init:
python:
import sqlite3
conn = sqlite3.connect(config.basedir+'/example.db')
cur = conn.cursor()
cur.execute("insert into npc values ('snake', 'python')")
cur.execute("select npc_type, npc_name from npc where id='snake'")
result = cur.fetchone()
Example of working with Sqlite3:
cur.execute("select * from airlines limit 5;")
results = cur.fetchall()
print results
BerkeleyDB can be added in the same simple way:
Copy:
C:\Program Files (x86)\Python\Python 2.7.10\Lib\bsddb
C:\Program Files (x86)\Python\Python 2.7.10\DLLs\_bsddb.pyd.
In the folder:
C:\Program Files (x86)\RenPy\renpy-*.**.**.*-sdk\lib\windows-i686\Lib
To check, add the following code to the beginning of script.py:
init:
python:
import bsddb
db = bsddb.btopen(config.basedir+'/spam.db')
Example of working with BerkeleyDB:
db['player'] = '123'
print db
Download and install python 2.7.10 (https://www.python.org/downloads/release/python-2710/)
Copy:
C:\Program Files (x86)\Python\Python 2.7.10\Lib\sqlite3
C:\Program Files (x86)\Python\Python 2.7.10\DLLs\_sqlite3.pyd
C:\Program Files (x86)\Python\Python 2.7.10\DLLs\sqlite3.dll.
In the folder:
C:\Program Files (x86)\RenPy\renpy-*.**.**.*-sdk\lib\windows-i686\Lib
To check, add the following code to the beginning of script.py:
init:
python:
import sqlite3
conn = sqlite3.connect(config.basedir+'/example.db')
cur = conn.cursor()
cur.execute("insert into npc values ('snake', 'python')")
cur.execute("select npc_type, npc_name from npc where id='snake'")
result = cur.fetchone()
Example of working with Sqlite3:
cur.execute("select * from airlines limit 5;")
results = cur.fetchall()
print results
BerkeleyDB can be added in the same simple way:
Copy:
C:\Program Files (x86)\Python\Python 2.7.10\Lib\bsddb
C:\Program Files (x86)\Python\Python 2.7.10\DLLs\_bsddb.pyd.
In the folder:
C:\Program Files (x86)\RenPy\renpy-*.**.**.*-sdk\lib\windows-i686\Lib
To check, add the following code to the beginning of script.py:
init:
python:
import bsddb
db = bsddb.btopen(config.basedir+'/spam.db')
Example of working with BerkeleyDB:
db['player'] = '123'
print db
Renpy textbook (in Russian). https://disk.yandex.ru/i/httNEajU7iFWHA (all information is out of date) Update 22.06.18
Sawa - a game of the Drow Nation
Honest Critique
Poses in visual novels, or how to hold a character properly in the frame
Help save articles to the webarchive. [/color]
Sawa - a game of the Drow Nation
Honest Critique
Poses in visual novels, or how to hold a character properly in the frame
Help save articles to the webarchive. [/color]
Re: Is there a way to make a Database?
Renpy textbook (in Russian). https://disk.yandex.ru/i/httNEajU7iFWHA (all information is out of date) Update 22.06.18
Sawa - a game of the Drow Nation
Honest Critique
Poses in visual novels, or how to hold a character properly in the frame
Help save articles to the webarchive. [/color]
Sawa - a game of the Drow Nation
Honest Critique
Poses in visual novels, or how to hold a character properly in the frame
Help save articles to the webarchive. [/color]
Who is online
Users browsing this forum: No registered users