Your one stop shop for coding help in Ren'py. Send in the asks, and the help desk answers.
Last active 2 hours ago
Don't wanna be here? Send us removal request.
Note
Is there a way to change the screen size?
This is a matter of the configuration of Renpy itself. This is commonly changed though and can be accessed through an init python block and the “config” namespace.
To change the resolution of the game you’d just need to type:
init python: config.screen_width = new integer config.screen_height = new integer
This needs to be done before the game’s start label and can be accomplished at the beginning of the renpy.gui file for your game, for example. You could also put it in the main file for your game but uh, try to stay organized please?
That’s all for this one. Remember: If your code won’t compile, and you don’t know why; who ya gonna call? The Ren’Py Help Desk!
#RenPy#Ren'Py#thehelpdesk#Renpyhelpdesk#keyword: init python#configuration#gui#the great return continues
6 notes
·
View notes
Note
Hello! I'm not sure if this blog is still active, but it's worth a shot. When doing something with multiple endings, how would you do a dating sim with multiple endings for each character, like a Good one and a Bad one?
Heya Isaacie! Better late than never I hope?
I did an initial treatment of the idea of multiple endings here. I’d go about it a little differently now, so I’ll give more detail about architecture for a game below.
The basic substance of your question is “how do I make the game interpret the difference between different states?”. If you’re using variables to keep track of things, all you need to do is have the game test if the player has met certain conditions in order to determine an outcome.
For a game with multiple romance-ables, it might work best to separate the romance paths into different files. Then, at the end of each romance file, have the conditionals for if something is a good or bad end. You can bring the player back into the MAIN file for things that are the same across all runs, and then have the game check to see which character they are romancing to go decide where to go.
This would work something like:Main story line ~> romance path chosen ~> go to character’s romance file ~> romance interaction #1 ~> back to main file ~> romance interaction #2 ~> ect.
In that case, it would be simplest to CALL the new file’s first label, then RETURN at the end of the romance scene after choices are made. This will put you back into the main script right where you last left off to do general same story line things. Then you can call the next label in from the romance file and return back, ect.
If the story never intersects again once a main love interest is chosen(think something like Katawa Shoujo) then you can just continue the story in those romance files. (You’ll probably want to set a variable like Romance_X = True in your files too if it affect the main plotline minimally, but you still want ppl to reference it in dialogue or something!)
At the end of the romance files you need some way to determine if they’ve done “good” or “bad” to see what ending they should get. You can do this by keeping track of how many “affection points” they got and deciding if they have below a certain value they get a “Bad End”.
Example:
label determine_ending: if Leo_love <= 10: jump bad_ending elif Leo_love .... .....
Ect for each scenario. This only works if they can only romance one person at a time. They get locked into a romance path(whether or not the rest of the game has story beats in common between routes) and so only one person needs to be checked.
But what if you wanna let them romance multiple ppl at once and see which one they got the farthest with?
For something like that you’ll need to put the affections in a dictionary, determine which one is the largest and then do the good/bad ending logic above.The logic would look something like this:
init python: John_love = 0 Mike_love = 0 Jimmy_love = 0 Sasha_love = 0(game play where you add affection with variable_name += number amount)(then a python block right before the end of the game)python: affection_dict = {"John": John_love, "Mike": Mike_love, "Jim": Jimmy_love, "Sasha": Sasha_love} love_holder = [] winner = None
for x in affection_dict.values(): love_holder.append(x) love_max = max(love_holder) for x in affection_dict: if affection_dict[x] == love_max: winner = x
Then at the end of your main file you’d type something like this:
if winner == “Sasha”: jump Sasha_endingselif winner == “Mike”: jump Mike_endings ....
Ect for each romanceable. Then you once again determine if they got a good or bad ending with them or not based on affection, which is separate from who they had the most affection with.(they could theoretically have 0, 0, 5, 9 and need a minimum of 10 for any non-bad end, if can even check to see if the max of the list is bigger than 10 and if not just have them giga fail with an ultimate bad end or something. You’d just add a line after love_max = max(love_holder) to say:
if love_max < 10: jump ultra_fail
They won’t even get to the rest of the code to pick the winner because it doesn’t matter lol.)
All that being said, the basic principals are:-have conditions that are failable-figure out what level of failure justifies a bad ending based on how your game plays-test the state of the game based on those conditions-use the result of that state testing to produce an end state result
I know this was long, and a very delayed answer, but I hope this helps you and others! Remember: If your code won’t compile and you don’t know why; who ya gonna call? The Ren’Py Help Desk!
#RenPy#Ren'Py#thehelpdesk#Renpyhelpdesk#multiple endings#keyword: call#keyword: return#keyword: jump#conditionals#keyword: python#keyword: init python#coding design
18 notes
·
View notes
Note
In my game, I only want a certain choice option to display if the player chose a specific answer earlier in the game. I still want the menu to appear whether or not they answered a certain way earlier, but I only want one of the answer options to appear if they answered a certain way. How would I do this?
A simple way to do this is to create a variable set to either True or False at the beginning, most likely False would be easiest for you, and set a menu option to only appear IF this condition is true.So for example:
$ Secret_Heritage = False
This is at the start of the game. Then if they learn the information:
$ Secret_Heritage = True
An idea for your menu:
menu: “I know your secret!” if Secret_Heritage: jump revelation “How do you feel about pinapple on pizza?”: jump pizza_talk
This way it only shows up if they’ve learned the information.
I cover this in more detail in my tutorial about it here!
Remember: if you’re code won’t compile, and you don’t know why; who ya gonna call? The Ren’Py Help Desk!
#RenPy#Ren'Py#thehelpdesk#Renpyhelpdesk#keyword: menu#condtiional: if#Ren'Py: Conditionals#Python#I swear I will answer this question#until the end of my days!#it's the most popular thing to do with your game!
11 notes
·
View notes
Note
How do you define a character whos name starts with the same letter as another?
After the “define” keyword you pick the name of the variable, it doesn’t have to only be one letter. So you’re free to define them like this:
define Sam = Character(’Samantha’)define Seb = Character(′Sebatian’)
Remember, the characters after “define” is what you’re calling the variable, so you can call it anything, even unrelated nicknames related to their personality or history or plot points.
Remember: If your code won’t compile, and you don’t know why; who ya gonna call? The Ren’Py Help Desk!
10 notes
·
View notes
Note
this is probably a dumb question, but how do you do text box things without assigning them to a character? (like narration)
For Ren’Py it’s as easy as just writing a “say” statement without a character attached.
For Example:Sam “Here’s a say statement that’s attached to a character.”
“And this one is said only by the default narrator and will have no name attached.”
There’s one built into Ren’Py who is invoked whenever you write a statement without a character variable in front of it.
I hope this helps! Remember: If your code won't compile, and you don't know why; who ya gonna call? The Ren'Py Help Desk!
#RenPy#Ren'Py#thehelpdesk#Renpyhelpdesk#RenPy: Characters#RenPy: Narrator#RenPy: Say Statement#dialogue#this on is simple but still important#think of all the neglected narrators#whose voices are being silenced without this!
9 notes
·
View notes
Note
For the menu choices appearing and disappearing, does the coding you displayed work through multiple playthroughs? If creating a dating sim, and you want one of the character routes to be available only after the game has been played through at least once, will your tutorial work, or do you have to do something fancier?
Fancier things I’m afraid. In order to have things persist through playthroughs like that, you have to set persistent style variables that, well, persist through games.
It’s gone over here in the Ren’Py documentation, but I’ll do a tutorial on it myself one day because it involves more pure Python functionality.
#RenPy#Ren'Py#thehelpdesk#Renpyhelpdesk#Ren'Py: Persistent#I'll have to explain this some other time#yes it's possible#but you need persistent data
3 notes
·
View notes
Note
hey ren'py help desk! i'd love a patreon, that'd be super cool! i also have a question! How do you code a menu choice to disappear? Let's say you have a menu with 5 choices. If you choose 1 choice, when you return to the same menu it won't show up. How do you that? Thank you!!!!! And good luck with your patreon!!
^^;
One of the first tutorials I made friend. It’s a common question, and one of the fun things to add to your game to make it look more fancy.
If you, or anyone else! still has more questions not answered in this tutorial, please feel free to call back. If not, then yay!
Remember: If your code won’t compile, and you don’t know why; who ya gonna call? The Ren’Py Help Deck!
#RenPy#Ren'Py#thehelpdesk#Renpyhelpdesk#keyword: menu#I get to reference myself this time!#The Great Return continues
5 notes
·
View notes
Note
Hey!! Thanks for your time. So I was wondering how I would write the code for something where I want the chances of success to be based on a percentage. I'm trying to implement lottery tickets, and I need it to have a 0.09% chance of success. And also, how would I make it so you get a different response for each outcome? Like if you failed to get one, I want your buddy to say "aw that's too bad, maybe next time!" And if not I want everyone to freak out, plus the earnings to be added. Thank you!!
I return from the void now that everyone is migrating back from the land of the South African Muskrat! Yours is a rather involved answer to see all of it below the cut
The answer to your question, at least the percentage part, is a matter of the randint() function in the Python library. In this case, you want something to happen only 1 in so many times. For example, 1 in 10 is a 10% chance. To simulate this in code, you can have the interpreter pick a random(note this isn’t true randomness, but it’s good enough for a video game we aren’t making a cyber security system!) number between 1 and 10. If it comes out to one number and one number only, then you pass the check. This makes it a 10% chance, just like if you rolled a 10 sided die.
For your .09% chance(very rare!), it would be 1 in ~1,100 chance.(.090909...%). So if you have Python pick a number between 1 and 1,100 and check to see if it’s one specific number, then you’ll have your lottery win.
The easiest way to implement this in game is to record the results of the 1 in 1,100 chance inside a function wrapper so that you can call it multiple times and they can check lots of tickets.
init python: def Lottery_Ticket(): ticket_num = renpy.random.randint(1, 1100) return ticket_num
In order to use the randint() function from the random library, you just need to invoke it! It’s a part of Renpy’s library. So you’d type renpy.random.randint(1,1100) like above. :)
Once that is done in your game code itself you’ll put the logic for the winning number. Let’s say it’s 42, for meme reasons.
You could write in your game file:
label check_ticket: $ ticket = Lottery_Ticket() if ticket == 42: jump you_win else: jump you_lose
This simple logic sets the ticket equal to the result of the Lottery_Ticket function. It then checks if the number is exactly the winning number you chose. If so, it takes you to the winning section of your game code, if not, it falls through and says you lose.
Every time they buy a ticket, you can send them to this label, it will re-run the Lottery_Ticket function anew, picking a new random number, and see if they won.
Under your winning code, since you asked, this is where you’d put your characters reacting positively! Note the thing in brackets is the player character’s name as a variable being interpolated by the engine. If you let the player pick their own name, that’s how you’d get it into the script. If they have a set name, just type that instead.
label you_win: e “Oh my God! [PC_Name] you did it! e “It’s like a dream come true!” $ Inv.add(lottery_winnings) $ renpy.notify(”You added“ + str(lottery_winnings) + “ to your wallet!”)
As you see, I’m using to functions. One that comes with Ren’Py calls in the notify screen context through the function. It needs to be a string inside which is why I’ve turned the int representing the lottery winnings into a string here.(This assumes you have a variable called “lottery_winnings” that has a specific integer value! Please initialize one before the start of your game!) (example: $ lottery_winnings = 10000)
The second is me assuming that you have an Inventory class instance with a method called “add” that can add money into a wallet variable. To make something like that:
init python: class Inventory(python_object): def__init__(self, wallet = 0): self.wallet = wallet self.pocket = [] def add(num): self.wallet += num return self.wallet
Then you just need an instance of it:$ Inv = Inventory() (I wrote it with defaults, so you don’t need to pass any arguments to the instance when you make it, though you are welcome to pass an INTEGER to it when you instantiate it so that your character starts with a certain amount of money. :D )
Then you can call the method on the variable to add the earnings to their wallet. :)
There’s also an empty pockets list inside of the inventory you can use to store the string names of objects they also own. For something like that:
$ Inv.pocket.append(”apple”)
This will add a string called “apple” to the pocket list inside the inventory. Which you can use to check if they “own” an object by checking if it is in the list.
if ‘apple’ in Inv.pocket: .......
But that’s more detail for another time.
You need to put the class in an init python block before the game starts so that you can make an instance of it to manipulate later.
For not winning, just have the ‘you_lose’ label have the dialogue you wanted.
label you_lose: e “Aw, that’s too bad. Maybe next time!”
And then continue on with the rest of the game.
I hope everything here is clear and this helps. I know this ask came in ages ago, but I still think answering it will help Ren’Py users in the now. Remember: If your code won’t compile, and you don’t what to do; who you gonna call? The Ren’Py Help Desk!
#RenPy#Ren'Py#thehelpdesk#Renpyhelpdesk#keyword: python#keyword: init python#Python#Python Classes#Inventory Code#function: renpy.notify()#function: renpy.random.randint()#keyword: jump#keyword: label
14 notes
·
View notes
Text
Still Alive
Hey guys, I know I haven’t updated in a while, but I wanted to let you know this blog is still alive. With coronavirus going on, and everyone stuck indoors, I’ve had a lot of time on my hands.
There’s been a fair number of updates to Ren’Py since the last time I touched it, so I’ve spent the last few months re-familiarizing myself with the engine in preparation for restarting the blog.
That being said, the last two basic tutorials will be posted to reflect how the new engine version handles sounds and compiling, instead of how it was handled the last time I worked with it, so those blog posts will be delayed. After they are updated, I’ll go back and update the other basic tutorials as needed, before moving on to the exciting stuff: teaching basic python and Ren’Py screen language.
I’ve gotten a lot questions over the intervening quiet period, and I’ll be answering them starting from the newest ones and working back in time(as is still relevant). The hope is that I’m answering questions people still need help with that way.
All in all, I look forward to getting the helpdesk back in working shape, and hearing your phone calls blowing up the metaphorical phone.
Here’s to a coding summer and a wonderful rest of the year.
10 notes
·
View notes
Photo
Log Off Protest - Phase Two!
December 29, 2018 (12 am Est) - December 31, 2018. (12 am EST).
This time around - we’re not logging off. Instead, we’ll be banding together and pressuring corporations on social media and app stores. There are two steps to this Phase that are as follows:
1) Mass Tweeting.
For EVERY DAY of this Phase (So at least one tweet December 29, December 30, and December 31), tweet @ the following:
@verizon @yahoo @tumblr @jeffdonof
These are all corporations that own and are related to Tumblr. Jeff D'Onofrio is the CEO of Tumblr. Tweet at them saying WHAT is wrong with this ban, HOW it affects you, and WHAT you want to be done about it. Tag each tweet with #phasetwo2018!
2) Mass Reviews
Go to Tumblr on the app store of your choice (Apple or Google) and leave a negative review. Tell them WHY the ban is wrong, HOW it affects you and your experience, and WHAT you want to be done.
Post each review online with a screenshot. Tag each post with #phasetwo2018! We need to lower their rating, and show them we mean business. No longer will be ignored. We’ll make them listen.
Timezones
U.S.A
EST - December 29, 2018, at 12 am
CST - December 28, 2018, at 11 pm
MST - December 28, 2018, at 10 pm
PST - December 28, 2018, at 9 pm
International
GMT - December 29, 2018, at 5 am
CST - December 29, 2018, at 1 pm
JST - December 29, 2018, at 2 pm
AEDT - December 29, 2018, at 4 pm
Need your timezone? Use this time zone converter.
An F.A.Q will come as questions flood in. Please message me here, on Twitter, or join our Discord and ask questions there. Thanks for your support guys!
Let’s end this year with a bang, aye?
Note: please read the entire post before sending an ask!
7K notes
·
View notes
Photo
The Official “Log Off” Protest F.A.Q!
The “Log Off” protest is in response to the recent NSFW ban announced by Tumblr. The ban flags all content the filtering system detects as NSFW, reducing visibility to the community. The system has proven time and time again that is inefficient, oftentimes flagging SFW material as NSFW.
This SFW material includes art, memes and so on. This ban directly hurts the community and will not solve the actual problems at hand due to the poor flagging system. Because of this, the entire community will suffer.
So to respond, I propose that every user on Tumblr logs off of Tumblr for 24 hours on December 17th at 12 am EST.
Times are listed above depending on timezone!
This post responds to some very common questions about the protest. So make sure to read it over!
How to Export Your Blog:
https://tumblr.zendesk.com/hc/en-us/articles/360005118894-Export-your-blog
Alternative Sites:
Pillowfort
Mastodan
Wordpress
Twitter
There is also an official Tumblr blog (ironic, huh?) and Twitter for the protest! It’s at:
Twitter - https://twitter.com/logoffprotest
Tumblr - https://logoffprotest.tumblr.com/
There will be official updates on each account. Make sure to tag us in any posts, or use the hashtag #logoff2018 !
Thanks for your support guys. Let’s fight to make Tumblr better. Actually better.
62K notes
·
View notes
Note
So, I saw your post about multiple endings, but what if you want to make a visual novel, versus a dating simulation, and you want multiple endings?
Hey sorry to everyone for being silent on here. It’s uhhh a work in progress on getting myself active again.
However! Shira, this is a pretty simple answer. Instead of checking for specific points to send to each ending, you can simply set a series of true/false variables.
Set the variables before the game starts, and every time there is a significant specific milestone, have the variable go from false to true(or vice versa if needed). They can only change those variables in response to dialogue choices and only if they picked the right things at the right time.
So have a series of menus that they only visit once that has important decisions on it(even if they see other menus multiple times) that change variables to true/false.
When you get to the end, you check to see which ones are true. So like you start with: if Know_Secret_Origins: jump blah blahStarting at the top with the most plot relevant to the ending milestone and moving down the list as needed. And ending with a generic or even bad end if they don’t trigger anything specific. That’s the easiest way to get them to a specific ending. But you need to make sure that the endings are in order of relevance in the if/elif/else tree. It’s got to be the one that overrules the others, or else you’ll end up in a situation where you get to an ending when another was more relevant.
It’s the same basic process? You just have to adapt it with true/false instead of points(but you could still use points if you wanted!) So the code is the same really. :)
42 notes
·
View notes
Text
New Beginnings
Hey everyone thanks for hanging with me as I uh seemingly disappeared off the face of tumblr.
I’m back, and feeling pretty good. If you take a look at the blog, it’s actually had a major looks overhaul. A custom theme and everything. I also accept comments on posts from disque so there’s that!
The second thing I wanted to announce is that I’d love to be more active, much more active, but uh life and finances prevents me from doing so.
So I’d like to ask you followers if you’d be interested in me setting up a Patreon? I’d be able to update regularly again, answer questions promptly, and churn out tutorials. I’m open to suggestions on rewards too.
So Patreon?
9 notes
·
View notes
Note
Do you know how to change the scene to a pure white background? "scene black" works but if type "scene white", the background is grayish, which probably means "white" isn't a valid scene.
Hey there whiskeycharley, thanks for phoning in. I know this is an old message, but I figure you and plenty of others could use an explanation.
“White” isn’t a defined action/color on its own like black is. The way around this is to simply define an image you’ve saved(that is all white) as your white scene.
I’m sure you can figure out how to make an all white image in an image/art program, but here’s a refresher on how to get it into the program.
These days Ren’Py makes a new project with a default image folder, but if you’re working with an older version/project, this is how you’d do it:
Drop and drag the white image inside the game folder for the game you’re working on(make sure it’s in the GAME folder and not the BASE folder). Inside the script for the game, define a new background image with the pure white background. It should look like this:
Example:
image bg pure white = “yourimage.png”
Or jpeg, or any other format Ren’Py accepts. Then when you want the background to be pure white, just say “scene bg pure white”.
Make sure you define the image BEFORE the state label.
10 notes
·
View notes
Note
Hi! In my game, you can click on items and read the protags thoughts; as is, the game repeats the same message every time you click on it. How do I change this to a "I've already seen this" message? And make it stay? I tried to use click = 0 variables but they go back to the initial message if you click it too many times :{
Hey there, thanks for phoning in!
I’m going to assume you’re using an imagebutton in order to make those pretty clickable items in your game. It seems the best idea. If you aren’t then uh you might as well do so, since you know, you can use transformations on them and that will probably be best for an interactive image like yours. :3
So, anyway ignoring the states you already(or don’t! heh) have for your imagebutton, you likely have an Action attached to it that tells it to Jump to a label.
Now here comes the part that you really need. You can sent a “seen” variable to false at the start of the interaction. Then at the end you can change it to true and with a simple if statement decide if they see the original statement or a “you’ve already seen this message”.
Example:
label thecircle: if not seentwice: l “We’ve only seen this once. Hopefully.” $ seentwice = True jump thecircle else: l “You’ve seen this twice. Congrats!” jump somewhereelse
If the true/false variable doesn’t work, call back, and I’ll work up a more vigorous solution with some more of renpy’s obscure functions.
18 notes
·
View notes
Note
Is it actually possible to transfer a save file (with cache infomation and the like) into another game? Example: Mass Effect 2/3, how it grabs information from the previous games to unlock/lock content in this game based entirely on decisions made previously. Thanks!
Hey there anon, thanks for phoning in!
What you’re looking for is persistent data. Some things can be saved as persistent data and so exist not only between save files for the same game(and so can be used to unlock routes), but also between games. You can program your new game to look for information from its prequel and boot that into its programming to change its default states.
The specifics for how to use persistent data is found here: Persistent Data
I’ll give you a basic overview though so you can get started.
Persistent data is an object that is unrelated to specific parts of your game. A new object is called up using the keyword python to create a block(if you’re creating a bunch of persistent data at once) or a single dollar sign for a line of code. Then, you would tell the interpreter that this is an instance of the persistent data type. To do so you’d write it like this:
Example:
$ persistent.secret_agent = False
In this case, I’m using it as a flag that represents if the player chose the “career” of secret agent. Later in the game, if the player does chose to be a international man of mayhem, you’d change the flag like so:
Example:
$ persistent.secret_agent = True
You can then have it tested with a conditional somewhere else in the game or the next. Say they start out with different stats if they were a secret agent in the last game.
label initialstats: if not persistent.secret_agent: $ creation_stats = 15 jump creationscreen $ creation_stats = 25 jump creationscreen
You can scale this of course, such that people who played the game through before with any archetype get more points. This only works though between saves of a single game. If you want to have it work between two different games though, you have to use Multi-persistent Data. The Multipersistent data has to go in an initial python block.
Example:
init python: mp = MultiPersistent(”007″)
$ mp.secret_agent = True$ mp.save()
The stuff in parenthesis after the new instance of the MultiPersistent Class is the “key”. Everything saved to this particular MultiPersistent is attached to that key. The save function also saves the data to the local computer’s disk, it has to be used or it won’t save.
In the next game when you want to load in the old data you’d create a new MultiPersistent instance with the same key. This way the computer can not only access what’s already there, but add to it new stuff from the current game.
Example:
init python: mp = MultiPersistent(”007″)label start: …
label charactercreation: if mp.secret_agent: jump loadoldcharacter else: jump makenewcharacter
Easy peasy! I hope this answered your question. Remember Ren’Py fans, if your code won’t compile and you don’t know why. Who ya’ gonna call? The Ren’Py Help Desk!
#Anonymous#Ren'Py#RenPy#thehelpdesk#renpyhelpdesk#keyword: python#init python#persistent data#multipersistent data
23 notes
·
View notes
Note
Say, how do I make characters default to two-window mode without having to put "show_two_window=True" in the definition for every single one?
Hey there Anon thanks for phoning in!
This is actually an easier fix than you think! If you go over to the screens file of your game you’ll see the default styles and settings of the screens that come pre-defined when you start any new project.
The screen you’re looking for is “Say” and it should be the first screen at the top of the file. Under the comments that say “Defaults for side_image and two_window” simply set the default two-window to “True”.
That’s all there is to it! You can do the side for side images. It’s a common thing so it’s already programmed inside.
Just make sure if you set side image to default true you always assign a side image for the game to use for each character when making the new instance of the Character class.
I hope this was helpful and remember, if your code won’t compile and you don’t know why. Who ya’ gonna call? The Ren’Py Help Desk!
4 notes
·
View notes