Ren'Py QuickStart [Gallery, Codex, Scheduler, Tutorials etc]

A place for Ren'Py tutorials and reusable Ren'Py code.
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.
Message
Author
User avatar
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: Ren'Py QuickStart [Gallery, Codex, Scheduler, Tutorials

#61 Post by noeinan »

Could you give an example of what code you are using to "set" the event? The code you show above just sets what day the game starts on. For example, this is the code I use:

Setting the Event Trigger:

Code: Select all

#This is an example of how to set a trigger to a specific day using the calendar.
    if calendar.month == "September" and calendar.day == 30:
        jump Harvest_Festival
The Event:

Code: Select all

label Harvest_Festival:
    
    "It's the harvest festival!"
Image

Image
Image

Mii
Newbie
Posts: 11
Joined: Thu Feb 19, 2015 9:26 am
Contact:

Re: Ren'Py QuickStart [Gallery, Codex, Scheduler, Tutorials

#62 Post by Mii »

that is the code i used for testing purposes. i did have it all set up with my own events and code but as it didn't work i have changed the code several times and tried many different methods (no of those worked either) i eventually deleted the setup i made with your code but if i can get it to work i'd revert to this method again. i thought i'd try again and simply test the framework and event you provided (if that makes sense) to see if that event would trigger but it didn't. the only thing i changed in your provided code was what i listed (the date) so the event would happen two days in, so that way i wouldn't have to test play many days

Mii
Newbie
Posts: 11
Joined: Thu Feb 19, 2015 9:26 am
Contact:

Re: Ren'Py QuickStart [Gallery, Codex, Scheduler, Tutorials

#63 Post by Mii »

i managed to fix the problem, i hope i don't upset you but i actually think there may be a slight bug in your framework as events wouldn't trigger straight out of the box for me (am mentioning this in case it helps you or someone else)
i will share below an example of how i changed it to make it work for me

using your code the selected day planner event is edited as shown

Code: Select all

label Art:
    
    $ calendar.next() #This will causes the calendar to advance by one day
    show screen calendar #Shows the date in the top right corner of the screen
    
    "You go to the forest in the back of the school to draw."
    
    #call check_events #check to see if any events have been triggered. # I removed this
    jump next_turn # i added this   
    hide screen calendar

    return
and added this to the main script file

Code: Select all

label next_turn:
    call check_events
    return
i don't know how or why it is now working or why it didn't work before but if it helps someone else out then i am glad. but i am ecstatic it is now working for me as i can proceed with creating the game i wanted.

edit

okay it is not working again but i have narrowed down the issue to the scheduler part of the code, as when i remove that part the calendar events trigger. if you have any input into what could fix this i would much appreciate it. also it is not the call_event part of your code that is bugged and i am sorry for saying it was but there is something up with the schedule part (whether your set up or mine)

User avatar
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: Ren'Py QuickStart [Gallery, Codex, Scheduler, Tutorials

#64 Post by noeinan »

Hmmm, good to know of the bug I will take a look. Last time I used my code it worked, but after a few RenPy Updates I did find some places that didn't work anymore. I fixed a few in the latest version I'm working on (haven't released yet) but this specific bug wasn't one of the issues I found. I'll see if I'm getting that error on my end and go from there.
Image

Image
Image

User avatar
AsHLeX
Miko-Class Veteran
Posts: 556
Joined: Wed Dec 25, 2013 1:09 pm
Completed: Starlight Dreamers, Mysterious Melody, Town of Memories, Marked, To Fly, The Change, Him From The Past, A Forgotten Memory
Projects: Cafe Mysteria
Location: Malaysia
Contact:

Re: Ren'Py QuickStart [Gallery, Codex, Scheduler, Tutorials

#65 Post by AsHLeX »

Hey, this is awesome! Thanks a lot! I'll definitely need it in one of my future games :D I really appreciate it :)

User avatar
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: Ren'Py QuickStart [Gallery, Codex, Scheduler, Tutorials

#66 Post by noeinan »

Glad that it's been helpful! I'm going to need to do another big update for this at some point, because there may be some errors after the new Ren'Py release. I've had a lot of my plate lately, but I'll try to get to it when I can. :)
Image

Image
Image

User avatar
Alitza
Newbie
Posts: 7
Joined: Fri Jun 07, 2013 7:32 am
Contact:

Re: Ren'Py QuickStart [Gallery, Codex, Scheduler, Tutorials

#67 Post by Alitza »

Hello. any chance for add at this awesome fw basic or advanced clothing system like doll model ? This will be great addition for invertory and consume system.

User avatar
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: Ren'Py QuickStart [Gallery, Codex, Scheduler, Tutorials

#68 Post by noeinan »

Alitza wrote:Hello. any chance for add at this awesome fw basic or advanced clothing system like doll model ? This will be great addition for invertory and consume system.
Yes, I definitely have plans to add a "dress up" section for this guide. It might take me a while, though, because I still need to do a huge update to the GUI and tutorial to make sure they are accurate with the newest version of Ren'Py.
Image

Image
Image

User avatar
Jae
Regular
Posts: 192
Joined: Sun Sep 13, 2015 5:41 pm
Projects: Pokémon Academy Life
Location: New York, NY
Contact:

Re: Ren'Py QuickStart [Gallery, Codex, Scheduler, Tutorials

#69 Post by Jae »

By the way, I looked through this and broke it almost immediately :D

1. Start game
2. Click Schedule
3. Click "Done" without selecting anything
4. Game says, "Please pick an activity for every week this month"
5. Game returns to Schedule menu
6. Click "Cancel"
7. Stuck.

User avatar
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: Ren'Py QuickStart [Gallery, Codex, Scheduler, Tutorials

#70 Post by noeinan »

Thanks for the heads up, I'm not ready to release a newer version of this yet but that bug is an easy fix.

Open the "schedule.rpy" file, then go to line 51. Replace this line:

Code: Select all

textbutton "Cancel" action Hide("menu")
With this:

Code: Select all

textbutton "Cancel" action [Show ("home"), Hide("menu")]
That should work.
Image

Image
Image

User avatar
Jae
Regular
Posts: 192
Joined: Sun Sep 13, 2015 5:41 pm
Projects: Pokémon Academy Life
Location: New York, NY
Contact:

Re: Ren'Py QuickStart [Gallery, Codex, Scheduler, Tutorials

#71 Post by Jae »

@daikiraikimi

Question. I'm currently working on my own codex and right now I have a navigation menu that has the standard preferences, but also a spot that opens up the codex.

Since character information will be different depending on save files and the player's progress, is there a way to disable the codex while the player is accessing the navigation menu from the main menu? In other words, the codex should only be accessible while the player is in-game.

One potential solution that I'm thinking about, but haven't tried is making a duplicate nav menu just for blocking out the codex. Just wondering if there's a more efficient and intuitive method.

Edit: Or maybe I'll just go and explore this instead: http://lemmasoft.renai.us/forums/viewto ... 04#p309867

User avatar
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: Ren'Py QuickStart [Gallery, Codex, Scheduler, Tutorials

#72 Post by noeinan »

If you don't want players to be able to access the codex from the main menu, all you have to do is remove the codex button. It's super easy, in the screens.rpy file, go to the section labeled "Main Menu":

Code: Select all

##############################################################################
# Main Menu 
#
# Screen that's used to display the main menu, when Ren'Py first starts
# http://www.renpy.org/doc/html/screen_special.html#main-menu

screen main_menu:

    # This ensures that any other menu screen is replaced.
    tag menu

    # The background of the main menu.
    window:
        style "mm_root"

    # The main menu buttons.
    frame:
        style_group "mm"
        xalign .98
        yalign .98

        has vbox

        textbutton _("Start Game") action Start()
        textbutton _("Codex") action ShowMenu("codex")
        textbutton _("CG Gallery") action ShowMenu("cg_gallery")
        textbutton _("BG Gallery") action ShowMenu("bg_gallery")
        textbutton _("Load Game") action ShowMenu("load")
        textbutton _("Preferences") action ShowMenu("preferences")
        textbutton _("Help") action Help()
        textbutton _("Quit") action Quit(confirm=False)

init -2 python:

    # Make all the main menu buttons be the same size.
    style.mm_button.size_group = "mm"
And remove the line with the Codex button:

Code: Select all

textbutton _("Codex") action ShowMenu("codex")
Then make sure that you have the game's "quick menu" activated. You'll have a section like this at the end of the screens.rpy:

Code: Select all

##############################################################################
# Game Menu
#
# Screen that appears when the player presses the escape button.

image logo = "logo.jpg"

screen game_menu:
    tag menu
    
    add "logo"
    
    frame: 
        xalign .5
        yalign .33
        
        has vbox spacing 5
   
        textbutton _("Continue") action Return()
        textbutton _("Save Game") action ShowMenu("save")
        textbutton _("Load Game") action ShowMenu("load")
        textbutton _("Codex") action ShowMenu("codex")
        textbutton _("Preferences") action ShowMenu("preferences")
        textbutton _("Main Menu") action MainMenu()
        textbutton _("Help") action Help()
        textbutton _("Quit") action Quit()
And then you need to activate it after label start:

Code: Select all


label start:
    
    $ _game_menu_screen = "game_menu" # This code activates the "pause menu" in screens.rpy

This is already done by default in the Quickstart, but pasting in case you're trying to use or edit other code. These will be the sections you want to grab if that is the case.

Now, if you want the codex to only be available *after* the player has experienced a certain event, you'll need to work with persistent data. However, I don't have a lot of experience with that so far, so I'd recommend searching around the Questions thread and you should find a lot of posts about it.
Image

Image
Image

User avatar
bloodyhair
Regular
Posts: 61
Joined: Tue Aug 11, 2015 7:20 am
Deviantart: Takada-Wang
Contact:

Re: Ren'Py QuickStart [Gallery, Codex, Scheduler, Tutorials

#73 Post by bloodyhair »

I didn't found codex code whether in script.rpy, option.rpy or screen.rpy. Can you help me please?

User avatar
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: Ren'Py QuickStart [Gallery, Codex, Scheduler, Tutorials

#74 Post by noeinan »

Yes, the codex code is in its own file called "codex.rpy". To help organize my code, I have separate files for the calendar, codex, events, gallery, home screen, inventory, scheduler, and weeks.
Image

Image
Image

User avatar
bloodyhair
Regular
Posts: 61
Joined: Tue Aug 11, 2015 7:20 am
Deviantart: Takada-Wang
Contact:

Re: Ren'Py QuickStart [Gallery, Codex, Scheduler, Tutorials

#75 Post by bloodyhair »

I found it. Thank you <3

and if you don't mind I want to ask several things about the gallery code too.

1.

Code: Select all

gallery_cg_items = ["cg1", "cg2", "cg3", "cg4", "cg5", "cg6", "cg7", "cg8", "cg9", "cg10", "cg11"
is the "cg1" is the name of file? is that fine to just putting name without tag .jpg and such?

2.

Code: Select all

for gal_item in gallery_cg_items:
        g_cg.button(gal_item + " butt")
        g_cg.image(gal_item)
        g_cg.unlock(gal_item)
    g_cg.transition = fade
    cg_page=0
what is the "butt" mean?

3.

Code: Select all

 'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/screens.rpy", line 586, in <module>
    renpy.image(gal_item + "butt", im.Scale(ImageReference(gal_item), thumbnail_x, thumbnail_y))
Exception: Expected an image, but got a general displayable.
I got this error code. I wonder what is wrong with the code so I can fix it?

Thank you very much

Post Reply

Who is online

Users browsing this forum: No registered users