Useful codes for demo used in IRL fest

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.
Post Reply
Message
Author
Ayael
Regular
Posts: 82
Joined: Fri Apr 07, 2017 2:17 pm
Projects: Imperial Grace (on going), Autumn Spirit, Ballads at Midnight
Contact:

Useful codes for demo used in IRL fest

#1 Post by Ayael »

Hello, here are a few useful codes if you participate to an IRL fest with your demo:
- Sign up for mailing list
- Return quickly to main menu
- Automatically lunch trailer after 2 minutes of activity in the main menu

Sign up for mailing list
Put this code at this end of your demo to retrieve mail in a .txt document (so it works even if internet is bad or not working). Make sure to be perfectly clear about what the mail will be used for. (The screen automatically goes back to main menu if nothing is done during 2 minutes)

1 - At your end of your demo add this lines:

Code: Select all

call screen sdemo_end()
    return
2 - Copy paste the mailing_list.rpy file attached to this post into your game folder
3 - Create a mail_list.txt document in your game folder.


Return to main menu
Some people will leave the computer without finishing the demo, to save time, set up a key touch to get back quickly on main menu for your next player.
1 - Create a screen with a key returning to the main menu, you can put it anywhere.

Code: Select all

screen keys():
    key "x" action MainMenu(confirm=False)
(Here the key "x" will return to the main menu, but you can use any key not used by renpy.)

2 - At the begining of your script call the key screen:

Code: Select all

label start: 
show screen keys()
3 - If your demo call other screen (for example a select character one) you can add the screen there too to make sure you can go back to main menu at any moment.

Code: Select all

 
 screen yourscreen(): 
 	use keys()

Automatically lunch the trailer
After two minutes of inactivity in the main menu, the game will play your trailer in loop (because movies attract more the attention of potential player).

1 - Add your trailer in your gui folder, make sure the video is in webm format and is named "trailer" (or change the path accordingly in step two.)
2 - Add anywhere (I put it just before the menu screen) this code:

Code: Select all

image movie = Movie(play="gui/trailer.webm")

label show_trailer:
    show screen key_trailer()
    show movie 
    pause
    return

#Allow you to stop the movie by clicking on x, on the space bar and on enter
screen key_trailer(): 
    key "x" action Return()
    key "K_RETURN" action Return()
    key "K_SPACE" action Return()

3 - In screen.rpy look for the "screen main_menu():" and add this line just after the tag menu

Code: Select all

 timer 120 action Start('show_trailer')


Hope it will be useful to someone!
Attachments
mailing_list.rpy
(2.12 KiB) Downloaded 26 times
Image Image

Post Reply

Who is online

Users browsing this forum: No registered users