[SOLVED] About store module(probably)
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.
[SOLVED] About store module(probably)
So I started with renpy recently and found this store thing (that I'm GUESSING it's a module) in a cookbook recipe and can't find out more details about it in the documentation . Actually (And I have the strong feeling that I'm just being extremaly dumb here) I coudn't find any detailed information about renpy modules itself. If anyone could provide at least an explanation of what is this store module and how it works, or share a link to an page that give me some help I'd REALLY apreciate.
The code in question:
init -1 python:
import renpy.store as store
import renpy.exports as renpy
inv_page = 0
item = None
class Player(renpy.store.object):
The code in question:
init -1 python:
import renpy.store as store
import renpy.exports as renpy
inv_page = 0
item = None
class Player(renpy.store.object):
Last edited by couto886 on Sat Feb 09, 2019 3:39 pm, edited 1 time in total.
- isobellesophia
- Miko-Class Veteran
- Posts: 979
- Joined: Mon Jan 07, 2019 2:55 am
- Completed: None
- Projects: Maddox and Friends! (AI Teacher friend), Friendly Universities! (Soon)
- Organization: Friendly Teachers series
- Deviantart: SophBelle
- itch: Child Creation
- Location: Philippines, Mindanao
- Contact:
Re: About store module(probably)
I think the store module is a app in purchase nor a error, because it shows on the list i searched.
https://www.renpy.org/doc/html/python.h ... ed-stores
https://www.renpy.org/doc/html/iap.html ... chasing
https://www.renpy.org/doc/html/python.h ... ed-stores
https://www.renpy.org/doc/html/iap.html ... chasing
Re: About store module(probably)
Thanks for the help, but from what I've found until now it's not related with In-App Purchasing. From the little I have found until now (mostly from this link viewtopic.php?t=23050 ) it's probably something related to rollback, but how exactly works, or when and how should I use it I have no idea...
-
- Miko-Class Veteran
- Posts: 758
- Joined: Tue Jun 22, 2010 12:54 am
- Completed: Christmas
- IRC Nick: DragoonHP
- Location: Zion Island, Solario
- Contact:
Re: About store module(probably)
So renpy.store in esssence is basically a class/object which stores game variables and objects. So when in script you write default my_int = 1, it gets stored in renpy.store and can be accessed via store.my_int
But for all intent and purposes, you don't need to touch the store object. What exactly are you trying to do?
But for all intent and purposes, you don't need to touch the store object. What exactly are you trying to do?
Re: About store module(probably)
This is my doubt right now. I've found this code in a cookbook, so I'm actually trying to understand what he was doing, so I can edit without messing everything up.What exactly are you trying to do?
So I could do the same code without the need of import/inherit store?? If this is the case, why had the coder imported the store??But for all intent and purposes, you don't need to touch the store object
-
- Miko-Class Veteran
- Posts: 758
- Joined: Tue Jun 22, 2010 12:54 am
- Completed: Christmas
- IRC Nick: DragoonHP
- Location: Zion Island, Solario
- Contact:
Re: About store module(probably)
Link what code you are talking about please
Re: About store module(probably)
Code: Select all
init -1 python:
import renpy.store as store
import renpy.exports as renpy
from operator import attrgetter
inv_page = 0
item = None
class Player(renpy.store.object):
def __init__(self, name, max_hp=0, max_mp=0, element=None):
self.name=name
self.max_hp=max_hp
self.hp=max_hp
self.max_mp=max_mp
self.mp=max_mp
self.element=element
player = Player("Derp", 100, 50)
class Item(store.object):
def __init__(self, name, player=None, hp=0, mp=0, element="", image="", cost=0):
self.name = name
self.player=player
self.hp = hp
self.mp = mp
self.element=element
self.image=image
self.cost=cost
def use(self):
if self.hp>0:
player.hp = player.hp+self.hp
if player.hp > player.max_hp:
player.hp = player.max_hp
inventory.drop(self)
elif self.mp>0:
player.mp = player.mp+self.mp
if player.mp > player.max_mp:
player.mp = player.max_mp
inventory.drop(self)
else:
player.element=self.element
-
- Miko-Class Veteran
- Posts: 758
- Joined: Tue Jun 22, 2010 12:54 am
- Completed: Christmas
- IRC Nick: DragoonHP
- Location: Zion Island, Solario
- Contact:
Re: About store module(probably)
You don't need both of the import lines.
Also, you can just replace renpy.store.object and store.object with object
Also, you can just replace renpy.store.object and store.object with object
Re: About store module(probably)
Thanks dude. Really helped me.
Who is online
Users browsing this forum: Ocelot