Maybe removing the sorting buttons?LabaroDD wrote:Here is the way to disable sorting?
Encyclopaedia / Bestiary Framework
Forum rules
Do not post questions here!
This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
Do not post questions here!
This forum is for example code you want to show other people. Ren'Py questions should be asked in the Ren'Py Questions and Announcements forum.
- noeinan
- Eileen-Class Veteran
- Posts: 1153
- Joined: Sun Apr 04, 2010 10:10 pm
- Projects: Ren'Py QuickStart, Crimson Rue
- Organization: Statistically Unlikely Games
- Deviantart: noeinan
- Github: noeinan
- Location: Washington State, USA
- Contact:
Re: Encyclopaedia / Bestiary Framework
Re: Encyclopaedia / Bestiary Framework
It wasn't enough just remove it... So I commented up parts of "SortingMode" in encyclopaedia.rpy and script.rpy and left this part (in script.rpy either):daikiraikimi wrote:Maybe removing the sorting buttons?LabaroDD wrote:Here is the way to disable sorting?
Code: Select all
screen encyclopaedia_list:
tag menu
use encyclopaedia_navigation
vbox:
style_group "mm_root"
viewport:
scrollbars "vertical"
mousewheel True
draggable True
vbox:
# text encyclopaedia.sortingMode xalign 0.5 #Flavour text to display the current sorting mode.
python:
for x in range(encyclopaedia.entry_list_size):
generateEntryButton(x,encyclopaedia)
Another one, more important question: is it anyhow possible to separate entries by themes on different screens, like on different pages?
For example:
Characters ► list of the characters (entries' subject marked as "Characters")
Items ► list of the items (entries' subject marked as "Items")
etc
I really can't get it.
- noeinan
- Eileen-Class Veteran
- Posts: 1153
- Joined: Sun Apr 04, 2010 10:10 pm
- Projects: Ren'Py QuickStart, Crimson Rue
- Organization: Statistically Unlikely Games
- Deviantart: noeinan
- Github: noeinan
- Location: Washington State, USA
- Contact:
Re: Encyclopaedia / Bestiary Framework
Hm, again this is just my best guess, but here is where I would start. First, looking at the main entries, en1/2/3/etc. are stored in "encyclopaedia" while sub-entries are stored in en1/2/3/etc. My thoughts are you could make encyclopedia1, encyclopedia2, etc.
Seems to me like you would basically be creating a three tiered encyclopedia instead of a 2 tiered one. So, you would have multiple encyclopedias, each with their own entries and sub-entries. You would need to flat out copy the encyclopedia list screen and make a duplicate. Then each screen would need to have buttons leading to each other (like "tabs" or whichever, saying "characters", "Items", etc.)
^Right now the list of all base entries takes enc, or individual entries. Maybe you can tweak this so it will instead list encyclopedias? Alternatively, you could make your own, new screen where each button points to a different encyclopedia list (character_list, item_list, etc.) corresponding to the various types you want.
Code: Select all
# Define an encyclopaedia object.
encyclopaedia1 = Encyclopaedia(
sorting_mode = Encyclopaedia.SORT_NUMBER,
show_locked_buttons=True,
show_locked_entry=True,
entry_screen="encyclopaedia_entry"
# Define an encyclopaedia object.
encyclopaedia2 = Encyclopaedia(
sorting_mode = Encyclopaedia.SORT_NUMBER,
show_locked_buttons=True,
show_locked_entry=True,
entry_screen="encyclopaedia_entry"
Code: Select all
en1 = EncEntry(
encyclopaedia1,
1,
"First Character",
[
"Character Name. Lorem ipsum dolor sit amet, consectetur adipiscing elit. ",
"Vivamus in nisl magna. Fusce nec bibendum magna, sed venenatis erat. ",
"Sed non dapibus augue, quis hendrerit diam. ",
"Quisque bibendum turpis vitae orci iaculis volutpat. ",
"Proin venenatis, nunc quis tempus convallis, lectus eros ultrices sem, eu condimentum tellus nisi sed magna. ",
"Curabitur laoreet posuere orci eu eleifend. ",
"Vivamus sed dui dignissim, egestas lorem eu, lobortis arcu. ",
"Duis venenatis sem eu ipsum condimentum adipiscing. ",
"Ut vel augue ut velit bibendum varius pharetra nec ligula. ",
"Duis eu sollicitudin mauris. ",
"Praesent vestibulum ligula vel ligula condimentum dignissim. ",
"Ut risus velit, laoreet sed pellentesque sed, suscipit in massa. ",
"Etiam posuere fringilla purus.",
],
"Love Interests",
viewed=persistent.new_status["new_01"],
locked=False,
image=en1_image,
)
Code: Select all
screen encyclopaedia_list(enc):
tag menu
modal True
Re: Encyclopaedia / Bestiary Framework
Thanks for advice, I'll try to do it right now!
...Well, I have a first problem here:
Where exactly I should define an encyclopaedia1, etc?
...Well, I have a first problem here:
Code: Select all
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.
File "game/enc_data.rpy", line 9: is not terminated with a newline. (Check strings and parenthesis.)
encyclopaedia1 = Encyclopaedia(
Ren'Py Version: Ren'Py 6.99.11.1749
- noeinan
- Eileen-Class Veteran
- Posts: 1153
- Joined: Sun Apr 04, 2010 10:10 pm
- Projects: Ren'Py QuickStart, Crimson Rue
- Organization: Statistically Unlikely Games
- Deviantart: noeinan
- Github: noeinan
- Location: Washington State, USA
- Contact:
Re: Encyclopaedia / Bestiary Framework
So, in general you will probably have to be really careful about making sure you replace everywhere in the script that uses "encyclopaedia" with "encyclopaedia1" (and that you duplicate those sections for the second encyclopaedia, too.) Regarding your error, that looks to me like it has nothing to do with adding the one and instead is a problem with spaces or parenthesis.LabaroDD wrote:Thanks for advice, I'll try to do it right now!
...Well, I have a first problem here:
Where exactly I should define an encyclopaedia1, etc?Code: Select all
I'm sorry, but errors were detected in your script. Please correct the errors listed below, and try again. File "game/enc_data.rpy", line 9: is not terminated with a newline. (Check strings and parenthesis.) encyclopaedia1 = Encyclopaedia( Ren'Py Version: Ren'Py 6.99.11.1749
On my screen, this is what that code looks like:
Code: Select all
# Define an encyclopaedia object.
encyclopaedia = Encyclopaedia(
sorting_mode = Encyclopaedia.SORT_NUMBER,
show_locked_buttons=True,
show_locked_entry=True,
entry_screen="encyclopaedia_entry"
)
Re: Encyclopaedia / Bestiary Framework
Thank you, daikiraikimi, it works!
The last one question and I'll finally leave you: could you help me with sub-entry text? After unlocking sub-entries appears in the next pages by default, but I want them appearing in the end of main entry's text block, without any pages. Like this:
"Main entry, blablabla"
+
"Sub-entry, blablabla"
I have boxes with scrolling, and sub-entries in pages looks pretty strange.
The last one question and I'll finally leave you: could you help me with sub-entry text? After unlocking sub-entries appears in the next pages by default, but I want them appearing in the end of main entry's text block, without any pages. Like this:
"Main entry, blablabla"
+
"Sub-entry, blablabla"
I have boxes with scrolling, and sub-entries in pages looks pretty strange.
- noeinan
- Eileen-Class Veteran
- Posts: 1153
- Joined: Sun Apr 04, 2010 10:10 pm
- Projects: Ren'Py QuickStart, Crimson Rue
- Organization: Statistically Unlikely Games
- Deviantart: noeinan
- Github: noeinan
- Location: Washington State, USA
- Contact:
Re: Encyclopaedia / Bestiary Framework
No problem at all, I'm glad I could help. So, regarding what you're describing, it seems like you want the ability to add more text to main entries after they are unlocked in gameplay? I think there is a better way of doing this that doesn't deal with sub-entries, actually. Instead it just adds text onto the end of the main entry block.LabaroDD wrote:Thank you, daikiraikimi, it works!
The last one question and I'll finally leave you: could you help me with sub-entry text? After unlocking sub-entries appears in the next pages by default, but I want them appearing in the end of main entry's text block, without any pages. Like this:
"Main entry, blablabla"
+
"Sub-entry, blablabla"
I have boxes with scrolling, and sub-entries in pages looks pretty strange.
I have not personally done this myself, so I won't be able to give a definite answer until I try it out. However, Human Bolt Diary made a post about this earlier in the thread, maybe that will help you out: viewtopic.php?f=51&t=25204#p368351
I think a way to do this could be storing entry text as a list instead of a variable, and then appending (adding) the new text to the end of the list when you reach certain points in the game. That would look something like this:
Code: Select all
# Herb Identification vol. 1
en1 = EncEntry(
encyclopaedia,
1,
"Herb Identification vol. 1",
[
"Thistle. Lorem ipsum dolor sit amet, consectetur adipiscing elit. ",
"Vivamus in nisl magna. Fusce nec bibendum magna, sed venenatis erat. ",
"Sed non dapibus augue, quis hendrerit diam. ",
"Quisque bibendum turpis vitae orci iaculis volutpat. ",
"Proin venenatis, nunc quis tempus convallis, lectus eros ultrices sem, eu condimentum tellus nisi sed magna. ",
"Curabitur laoreet posuere orci eu eleifend. ",
"Vivamus sed dui dignissim, egestas lorem eu, lobortis arcu. ",
"Duis venenatis sem eu ipsum condimentum adipiscing. ",
"Ut vel augue ut velit bibendum varius pharetra nec ligula. ",
"Duis eu sollicitudin mauris. ",
"Praesent vestibulum ligula vel ligula condimentum dignissim. ",
"Ut risus velit, laoreet sed pellentesque sed, suscipit in massa. ",
"Etiam posuere fringilla purus.",
],
"Herb Identification",
viewed=persistent.new_status["new_01"],
locked=False,
image=en1_image,
)
-
- Regular
- Posts: 111
- Joined: Fri Oct 11, 2013 12:46 am
- Contact:
Re: Encyclopaedia / Bestiary Framework
You can swap out the entire text in an entry by doing:LabaroDD wrote:Thank you, daikiraikimi, it works!
The last one question and I'll finally leave you: could you help me with sub-entry text? After unlocking sub-entries appears in the next pages by default, but I want them appearing in the end of main entry's text block, without any pages. Like this:
"Main entry, blablabla"
+
"Sub-entry, blablabla"
I have boxes with scrolling, and sub-entries in pages looks pretty strange.
Code: Select all
your_entry.text = ["An entirely new set of text for the entry."]
Code: Select all
your_entry._text.append("A new line of text.")
You could also rewrite the screen that shows an entry to show all the text from every sub-entry.
- noeinan
- Eileen-Class Veteran
- Posts: 1153
- Joined: Sun Apr 04, 2010 10:10 pm
- Projects: Ren'Py QuickStart, Crimson Rue
- Organization: Statistically Unlikely Games
- Deviantart: noeinan
- Github: noeinan
- Location: Washington State, USA
- Contact:
Re: Encyclopaedia / Bestiary Framework
I actually have a question of my own! I'm using this code in conjunction with sanguaro's inventory/craft/store code (link: viewtopic.php?f=51&t=25579&start=30 )
I am attempting to make an item that unlocks an entry in the encylcopedia. The idea is that you get a book, and when you click it you "read" it and gain access to the information inside. Since each entry is a "book" all the sub-entries are pages, and they all get unlocked at once instead of one at a time. I added the following code:
In EncEntry.py
In action.py:
The inventory code takes in these variables:
And I need to define items *after* the start label like so:
The problem I am running into is that when I run my game, as soon as inventory items are defined it crashes, telling me that "UnlockEncEntry" is not defined. As far as I understand, act should take anything that goes with action-- and EncyclopaediaAction is a subclass of Action, so it should take.
My best guess is that the code in the encyclopaedia folder is not being run until after the start label. It's in a .py file as opposed to a .rpy file, so I'm not 100% sure how to control when it gets read. Normally, I would put it in an init python block. The classes for my items and inventory are defined in one. Since it's a .py file, seems to me that it's already in a python (no block needed) but is there a way to make sure it is read before the game start, similar to init?
I am attempting to make an item that unlocks an entry in the encylcopedia. The idea is that you get a book, and when you click it you "read" it and gain access to the information inside. Since each entry is a "book" all the sub-entries are pages, and they all get unlocked at once instead of one at a time. I added the following code:
In EncEntry.py
Code: Select all
def unlock_entry(self):
self.locked = False
self.viewed = False
if entry.has_sub_entry:
for subent_data in entry.sub_entry_list:
subent_data[1].locked = False
self.add_entry(subent_data[1])
self.viewed = False
Code: Select all
class UnlockEncEntry(EncyclopaediaAction):
def __init__(self, entry):
self.entry = entry
def __call__(self):
entry.unlock_entry()
Code: Select all
class Item(store.object):
def __init__(self, name, desc, icon=False, value=0, act=Show("inventory_popup", message="Nothing happened!"), type="item", recipe=False):
global cookbook
self.name = name
self.desc = desc
self.icon = icon
self.value = value
self.act = act # screen action
self.type = type # type of item
self.recipe = recipe # nested list of [ingredient, qty]
if recipe:
cookbook.append(self)
cookbook.sort(key=lambda i: i.name) #alpha order
Code: Select all
$ book = Item("Herb Identification Guide", "A book of herbs", "inv/book.png", 5000, act=UnlockEncEntry(en1))
My best guess is that the code in the encyclopaedia folder is not being run until after the start label. It's in a .py file as opposed to a .rpy file, so I'm not 100% sure how to control when it gets read. Normally, I would put it in an init python block. The classes for my items and inventory are defined in one. Since it's a .py file, seems to me that it's already in a python (no block needed) but is there a way to make sure it is read before the game start, similar to init?
- noeinan
- Eileen-Class Veteran
- Posts: 1153
- Joined: Sun Apr 04, 2010 10:10 pm
- Projects: Ren'Py QuickStart, Crimson Rue
- Organization: Statistically Unlikely Games
- Deviantart: noeinan
- Github: noeinan
- Location: Washington State, USA
- Contact:
Re: Encyclopaedia / Bestiary Framework
My friend told me I might need to import EncyclopaediaActions in the code where I define my items and I got it working! Here is the code for anyone else who wants to implement something like this! I'm using saguaro's inventory/crafting/store code which you can find here: viewtopic.php?f=51&t=25579
So, first I had to change the name of the folder that stores the encyclopaedia code. If I didn't, then the fact that the module and the actual encyclopaedia had the same name was giving me errors. I changed it to enc_code, and changed everywhere that the module was imported to reflect that.
In EncEntry (enc_code.encentry) I added this function:
Then, in enc_code.actions I changed the import to reflect the module name change:
Then I added this new action, which I needed so that I could use it as an item action:
In the base item code, all items are defined after the start label. I made item definition and inventory definition labels so that I could jump to them and save space in the start label. In the item definition label, I imported EncEntry and EncyclopaediaActions. I had to import the whole thing instead of "from enc_code.actions import EncEntryUnlock" or else I got an error.
Then I made my items!
I will probably polish this up but this code is functional! (I eventually want to make it so that when you click on the item it gives you a little popup saying "you read the book" and also that reading a book consumes time, but I will figure that out later. For now, this is working and I wanted to share it with folks in case anyone else wanted to do something similar at some point. :3 )
So, first I had to change the name of the folder that stores the encyclopaedia code. If I didn't, then the fact that the module and the actual encyclopaedia had the same name was giving me errors. I changed it to enc_code, and changed everywhere that the module was imported to reflect that.
In EncEntry (enc_code.encentry) I added this function:
Code: Select all
def unlock_entry(self):
#Changes the locked status of an entry and all sub-entries
self.locked = False
self.viewed = False
if self.has_sub_entry:
for subent_data in self.sub_entry_list:
subent_data[1].locked = False
self.add_entry(subent_data[1])
self.viewed = False
Code: Select all
import enc_code.encentry
Code: Select all
class UnlockEncEntry(EncyclopaediaAction):
#Calls EncEntry.unlock_entry, can be assigned to a button
def __init__(self, entry):
self.entry = entry
def __call__(self):
enc_code.encentry.EncEntry.unlock_entry(self.entry)
Code: Select all
label define_items:
$ import enc_code.encentry
$ import enc_code.actions
"Encyclopaedia Actions have been imported."
######### DEFINE ITEM OBJECTS ##########
### The format is name, description, icon image (if applicable), value (if applicable, selling/buying value), action (screen language action to be performed when icon is clicked on inventory screen), and recipe (if craftable).
Code: Select all
#Books
#This is currently broken. It says UnlockEncEntry is not defined.
#Need to investigate when the action code for encyclopedia runs.
$ herbID1 = Item("Herb Identification vol. 1", "A book of herbs", "inv/book.png", 5000, act=enc_code.actions.UnlockEncEntry(en1))
$ herbID2 = Item("Herb Identification vol. 2", "A book of herbs", "inv/book.png", 5000, act=enc_code.actions.UnlockEncEntry(en2))
$ herbID3 = Item("Herb Identification vol. 3", "A book of herbs", "inv/book.png", 5000, act=enc_code.actions.UnlockEncEntry(en3))
Re: Encyclopaedia / Bestiary Framework
Thank you, Human Bolt Diary!
Oh, one more problem... I got an error when I came back from the Encyclopaedia to game. It pops up when I click on "Return" button.
Oh, one more problem... I got an error when I came back from the Encyclopaedia to game. It pops up when I click on "Return" button.
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "renpy/common/00gamemenu.rpy", line 173, in script
$ ui.interact()
File "renpy/common/00gamemenu.rpy", line 173, in <module>
$ ui.interact()
File "game/encyclopaedia.rpy", line 298, in __call__
self.enc_dict[self.tag_string + str(x)] = self.enc.all_entries[x][1].status
TypeError: 'NoneType' object does not support item assignment
Re: Encyclopaedia / Bestiary Framework
I found the answer myself. I used a line of code right below the label start:
so it conflicted to this:
I simply deleted the first line.
Code: Select all
$ persistent._clear(progress=True)
Code: Select all
self.enc_dict[self.tag_string + str(x)] = self.enc.all_entries[x][1].status
Re: Encyclopaedia / Bestiary Framework
For those that want to add more than one encyclopaedia, shown on different screens... (done today, streamlined process).
STEP A
Create the data of the second ency, after an init, like that.
I called this extra dictionary 'encyguide'.
Please notice that, CONTRARY TO COMMENT ON THE ORIGINAL SCRIPT, you had to set "new" as master_key and name here too, or an error will stop everything.
STEP B
Create a COPY of the full generateEntryButton(x,enc) function in an init -1 block. The same exact function, just changing the name.
In my game, I called it ExtragenerateEntryButton.
That's because there's a couple of hardcoded lines you need to change.
Scroll the new replicated function until you read something like:
And change it this way:
'encyclopedia_entry" is the screen that show a single voice. If you don't change it, you'll got an error or strange behaviors. So change it as "extra_encyclopedia_entry" every time appear in your new renamed function. It appear more than once.
That's my result, with some style too.You can copy/paste it where you want.
STEP C
Now for the screen... paste this. Don't forget to add a menu voice in the navigation to reach "extra_encyclopaedia_list". Please notice where "encyguide", my new ency, is used:
That's all. With the same process you can add infinite numbers of different encys to your game (I've done one at title for setting lore, and one for game mechanics at game menu).
STEP A
Create the data of the second ency, after an init, like that.
I called this extra dictionary 'encyguide'.
Code: Select all
init:
whatsabout = "Yes"
kimassen= "Hopefully"
encyguide = Encyclopaedia(showLockedButtons=True, showLockedEntry=False)
encyguide.setPersistentStatus(entries_total=2, master_key="new", name="new")
encyguide.addSubjects("Tutorial")
gd1 = EncEntry(1,"Medicine",whatabout, "Tutorial", status=persistent.new_dict["new_00"], locked=False)
gd2 = EncEntry(2,"Voodoo",whatstime, "Tutorial", status=persistent.new_dict["new_01"],locked=False)
encyguide.addEntries(gd1,gd2)
STEP B
Create a COPY of the full generateEntryButton(x,enc) function in an init -1 block. The same exact function, just changing the name.
In my game, I called it ExtragenerateEntryButton.
That's because there's a couple of hardcoded lines you need to change.
Scroll the new replicated function until you read something like:
Code: Select all
Show("encyclopaedia_entry")] )
Code: Select all
Show("extra_encyclopaedia_entry")] )
That's my result, with some style too.You can copy/paste it where you want.
Code: Select all
init -1 python:
#Function that creates the buttons for each entry.
#It makes one button, based on the value "x", associated to the given encyclopaedia "enc".
#Used in a "for loop" on a screen to generate the correct buttons for every entry
def ExtragenerateEntryButton(x,enc):
ui.hbox()
if enc.showLockedButtons:
if enc.all_entries[x][1].locked == False: #If the entry is unlocked, make the button to go to it. If it's locked, make an inactive "???" button
if enc.all_entries[x][1].status == None or enc.all_entries[x][1].status == False:
ui.textbutton ("{color=#ff0}New!{/color}", xsize=60, color="#f0f", size=16)
else:
ui.null(width=60)
ui.textbutton(enc.all_entries[x][1].name, clicked= [ enc.ChangeStatus(x), enc.SetEntry(x), Show("extra_encyclopaedia_entry")] )
else: #If locked entries should be shown in the list, the "???" button should go to the entry. If not, it's an inactive button
if enc.showLockedEntry:
ui.null(width=60)
ui.textbutton("{color=#666}???{/color}", clicked=[ enc.ChangeStatus(x), enc.SetEntry(x), Show("extra_encyclopaedia_entry")])
else:
ui.null(width=60)
ui.textbutton("{color=#666}???{/color}")
if enc.showLockedButtons == False: #Only showing unlocked entries in this case, no need for the "???" button
ui.textbutton(enc.unlocked_entries[x][1].name, clicked= [ enc.ChangeStatus(x), enc.SetEntry(x), Show("extra_encyclopaedia_entry")] )
if enc.unlocked_entries[x][1].status == None or enc.unlocked_entries[x][1].status == False:
ui.textbutton ("New!")
ui.close()
Now for the screen... paste this. Don't forget to add a menu voice in the navigation to reach "extra_encyclopaedia_list". Please notice where "encyguide", my new ency, is used:
Code: Select all
screen extra_encyclopaedia_list:
tag menu
use game_menu(_("Guides"), scroll="viewport"):
vbox:
spacing 10
frame:
style_prefix "guide"
xmargin 10
yfill True
xmaximum 400
bottom_margin 10
vbox: #viewport:
#scrollbars "vertical"
#mousewheel True
#draggable True
vbox:
python:
for x in range(len(encyguide.subjects) ):
ui.text(encyguide.subjects[x])
for y in range(encyguide.entry_list_size):
if encyguide.getEntry(y).subject == encyguide.subjects[x]:
ExtragenerateEntryButton(y,encyguide) ### <-notice this!
ui.null(height=16)
######################
### ENC. single entry ##################################################################
# ================== #
######################
screen extra_encyclopaedia_entry():
tag menu
use game_menu(_("Guides"), scroll="viewport"):
vbox:
spacing 10
frame:
id "entry_nav"
style_prefix "guidenavi"
xfill True
hbox:
xfill True
textbutton "Previous Entry" xalign .02 action encyguide.PreviousEntry() #Relative to the sorting mode
$page_indicator = encyguide.getEntryData()[1].getName() # Flavour text to indicate which page we're current on
text page_indicator size 36 color "#c00"
textbutton "Next Entry" xalign .98 action encyguide.NextEntry() #Relative to the sorting mode
hbox:
$ddd = config.screen_width
$dd = config.screen_width/2
$pp = config.screen_height/2
if encyguide.getEntryData()[1].hasImage: #If the entry or sub-entry has an image, add it to the screen
frame:
xmargin 10
yfill True
xfill True
xmaximum dd
ymaximum pp
$current_image = encyguide.getEntryData()[1].getImage()
add current_image crop (0,10,dd-30,pp-10)
window:
id "entry_window"
xmargin 10
xfill True
yfill True
xalign 0.5
xmaximum ddd
ymaximum pp
background None
vbox:
spacing 15
for item in encyguide.entry_text: #entry_text is a list of paragraphs from what whatever the current entry is
text item
frame:
style_group "mm_root"
xfill True
yfill False
xmargin 10
hbox:
xfill True
if encyguide.getEntryData()[1].hasSubEntry: #If there's a sub-entry, add Prev/Next Page buttons
textbutton "Previous Page" xalign .02 action encyguide.PreviousPage()
text "Page %d / %d" % (encyguide.sub_current_position, encyguide.getEntryData()[1].pages) #Flavour text to indicate which sub-page is being viewed
textbutton "Next Page" xalign .98 action encyguide.NextPage()
else:
text("")
hbox:
xfill True
yalign .98
textbutton "Close Entry" id "close_entry_button" xalign .5 clicked [encyguide.ResetSubPage(), Show("extra_encyclopaedia_list")] #<---notice this
If you want to debate on a reply I gave to your posts, please QUOTE ME or i'll not be notified about. << now red so probably you'll see it.
10 ? "RENPY"
20 GOTO 10
RUN
10 ? "RENPY"
20 GOTO 10
RUN
- noeinan
- Eileen-Class Veteran
- Posts: 1153
- Joined: Sun Apr 04, 2010 10:10 pm
- Projects: Ren'Py QuickStart, Crimson Rue
- Organization: Statistically Unlikely Games
- Deviantart: noeinan
- Github: noeinan
- Location: Washington State, USA
- Contact:
Re: Encyclopaedia / Bestiary Framework
daikiraikimi wrote:My friend told me I might need to import EncyclopaediaActions in the code where I define my items and I got it working! Here is the code for anyone else who wants to implement something like this!
Just wanted to add a follow-up on this! So, I did eventually figure out how to make it so clicking an item gives you a popup saying "you read the book" or similar and I also made it consume one unit of time, and change picture that shows the time of day. For those interested:
Code: Select all
$ herbID1 = Item("Herb Identification vol. 1", "A book of herbs", "inv/book.png", 5000, act=[enc_code.actions.UnlockEncEntry(en1),Show("inventory_popup", message="New Herbs Unlocked"), SetVariable('time_cnt',time_cnt+1), Function(renpy.call, "time_img")])
Second thing is, I discovered a bug in my code which unlocks entries. I haven't fixed it yet, but basically unlocking entries through a button seems to break how the code displays entries. Like, the button in the encyclopedia list will lock/unlock, but when you click it you get an error message.
Dunno if unlocking entries through other means changes other things, but I'm looking into it. Under the current code I made, if you click "next entry" it skips the newly unlocked entry all together, and if you click on the unlocked entry directly from the encyclopedia list you get an error message:
Code: Select all
File "enc_code/actions.py", line 33, in __call__
ValueError: EncEntry: 02: Herb Identification vol. 2 is not in list
-
- Regular
- Posts: 111
- Joined: Fri Oct 11, 2013 12:46 am
- Contact:
Re: Encyclopaedia / Bestiary Framework
In response to a lot of the difficulties people were having, I've been working on a version 2 of the Encyclopaedia Framework. I've kept most of the core concepts similar, but this is a hard break for quite a bit of the behaviour. Overall, it should be much more user-friendly and easier to customize.
The beta for v2 is available at:
https://github.com/jsfehler/renpy-encyc ... a/releases
and documentation at:
http://renpy-encyclopaedia.readthedocs. ... index.html
Getting v2 out of beta is going to take a lot more manual testing (I've tested it a lot, but I'm sure there's things I've missed.), more work on the documentation, and more unit tests.
The beta for v2 is available at:
https://github.com/jsfehler/renpy-encyc ... a/releases
and documentation at:
http://renpy-encyclopaedia.readthedocs. ... index.html
Getting v2 out of beta is going to take a lot more manual testing (I've tested it a lot, but I'm sure there's things I've missed.), more work on the documentation, and more unit tests.
Who is online
Users browsing this forum: No registered users