I got a newbie question?

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Message
Author
User avatar
DragonKnight
Regular
Posts: 51
Joined: Sun Nov 12, 2017 10:16 am
Projects: Taboo Hearts
Contact:

I got a newbie question?

#1 Post by DragonKnight »

How to you make another .rpy file. Say you have main file( which is your script file) and say you have a day by day vn. How do you make a day1.rpy file and so on and so on??
Currently working on Taboo Hearts :D
Currently working on Forbidden :D

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2400
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: I got a newbie question?

#2 Post by Ocelot »

Create a text file in the same folder where script.rpy is. Rename it to day1.rpy. Done.

https://i.imgur.com/hSWMnEp.gifv
< < insert Rick Cook quote here > >

User avatar
IrinaLazareva
Veteran
Posts: 399
Joined: Wed Jun 08, 2016 1:49 pm
Projects: Legacy
Organization: SunShI
Location: St.Petersburg, Russia
Contact:

Re: I got a newbie question?

#3 Post by IrinaLazareva »

And don't forget, that a text file must be saved in UTF-8 coding.

User avatar
DragonKnight
Regular
Posts: 51
Joined: Sun Nov 12, 2017 10:16 am
Projects: Taboo Hearts
Contact:

Re: I got a newbie question?

#4 Post by DragonKnight »

Thank you, now for my next question, how you can make so nobody can read your script file or anything you create??
Currently working on Taboo Hearts :D
Currently working on Forbidden :D

User avatar
DragonKnight
Regular
Posts: 51
Joined: Sun Nov 12, 2017 10:16 am
Projects: Taboo Hearts
Contact:

Re: I got a newbie question?

#5 Post by DragonKnight »

IrinaLazareva wrote: Fri Feb 23, 2018 3:50 pm And don't forget, that a text file must be saved in UTF-8 coding.
And how do you do that??
Currently working on Taboo Hearts :D
Currently working on Forbidden :D

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: I got a newbie question?

#6 Post by rayminator »

when you are ready to build your game move the .rpy files outside of the game folder don't move the .rpyc files keep them there

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2400
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: I got a newbie question?

#7 Post by Ocelot »

Never release you game to anyone. THis is the only way. THink about it: game needs to read your script to function, so as long as someone uses same method, the game uses, they will read it. It applies to everything, actually.

There are ways to hide scripts and make it harder for curious person to get them.
Main one is making use of .rpa archive building as part of distribution. That way your resourses will be bundled in a single (or several) .rpa files. It is possible to extract files from it, but it is requires some work.
Next is for script files only and consist of archiving only compiled .rpyc files, without corresponding .rpy. Though decompilers exist, it would deter majority of just curious people.
And how do you do that??
If you start with completely empty file and use editra, as your editor, you do not need to do anything.
< < insert Rick Cook quote here > >

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: I got a newbie question?

#8 Post by xavimat »

rayminator wrote: Fri Feb 23, 2018 4:05 pmwhen you are ready to build your game move the .rpy files outside of the game folder don't move the .rpyc files keep them there
No need to move the files manually. You can tell the builder to exclude the .rpy files. See https://renpy.org/doc/html/build.html#c ... ring-files

Code: Select all

build.classify("**.rpy", None)
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
DragonKnight
Regular
Posts: 51
Joined: Sun Nov 12, 2017 10:16 am
Projects: Taboo Hearts
Contact:

Re: I got a newbie question?

#9 Post by DragonKnight »

Alright, so I got day1.rpy built, so how do I use it. Jump to day1 and use a label. Does it remember in your script file like images, or varible.?
Currently working on Taboo Hearts :D
Currently working on Forbidden :D

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2400
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: I got a newbie question?

#10 Post by Ocelot »

The same way as you use your script.rpy file. THere is no difference between script.rpy, screes.rpy, gui.rpy, day1.rpy, config.rpy and others. You can define screens in script.rpy, write game script in gui.rpy, redefine confir variables in script.rpy, etc. You can move all content of screens.rpy to script.rpy, delete former and everything would work, for example. All rpy files are loaded together.
< < insert Rick Cook quote here > >

User avatar
DragonKnight
Regular
Posts: 51
Joined: Sun Nov 12, 2017 10:16 am
Projects: Taboo Hearts
Contact:

Re: I got a newbie question?

#11 Post by DragonKnight »

Thank you!!
Currently working on Taboo Hearts :D
Currently working on Forbidden :D

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: I got a newbie question?

#12 Post by xavimat »

As Ocelot says, all rpy files are loaded together, so you organize them as you need.
I like to have a definitions.rpy file with all my defaults, defines, classes and functions, and sometimes a file with specific parts of my program.
It depends on you and how you like to organize things.

Only two points to note:
1. Better avoid naming your rpy files with a 00 at the start. Renpy uses that for its internal files and can lead to wrong order in initialization.
2. If you change drastically four files among versions (for example, create a new file and move there parts of the script), old saves opened with the new version could have problems. (New saves don't, though).
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

User avatar
Donmai
Eileen-Class Veteran
Posts: 1960
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question, To The Girl With Sunflowers
Projects: Slumberland
Location: Brazil
Contact:

Re: I got a newbie question?

#13 Post by Donmai »

To create a new rpy file the easiest way, click the 'Navigate Script' button under 'Actions' on the Launcher screen. Click the '+Add script file' button. Type a name for your file, and save it. Click 'Return' and, under 'Edit File' click the 'All Script Files' button. There you go.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

darckshame
Newbie
Posts: 23
Joined: Sun Feb 25, 2018 11:39 pm
Contact:

Re: I got a newbie question?

#14 Post by darckshame »

Guys I also have a newbie question:
So i want to have a way to let the player to input a number and then add that number to another number but I don't know how. For example, so that you understand my question better, the player is in a shop and wants to buy item1 but he wants to buy lets say '110' of it, he must press a button and then something like the input name appears and asks him "how many do you want to buy", then he inputs the number and he has in hes bag '2' of item, so after imputing a number, that number adds to the number he has in his bag

code example:

$ bag_item1 = 2

Label xBuy:
scene store

menu:
"Buy more of [item1]!":
$ buy_item1 = renpy.input ("How many do you want to buy?")
$ buy_item1 = buy_item1.strip()

if x_item1 >= 0:
$ bag_item1 = $ bag_item1 + buy_item1
or
$ bag_item1 += buy_item1
else:
$ bag_item1 = $ bag_item1
jump buy_menu


I know that the input command is to input a name but i want input a numeric value and add it to another value that it's preset.

Thanks for the time that you spend helping me and I hope that you understood what i want.

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: I got a newbie question?

#15 Post by xavimat »

Hi, darkshame.
Please, next time, ask your new question in a new thread, (and use a more descriptive title).

Code: Select all

label xBuy:  # <- Don't use "Label" but "label". python and renpy are case-sensitive.
    scene store

    menu:
        "Buy more of [item1]!":
            $ buy_item1 = renpy.input("How many do you want to buy?", allow="0123456789") or 0
            $ buy_item1 = int(buy_item1)
            $ bag_item1 += buy_item1
What you need is easy. The renpy.input() function can be used for any input, not only a name (that's maybe the simplest use, used in the examples).
- We use "allow" inside the function, so only numbers will be accepted in the input.
- We don't use .strip(), because there is no way that the user has inputed useless spaces.
- We use int() to convert the string (made of numbers) to a numeric variable.
- Note the "or 0" part. This avoids an error if the user does not enter any number.
- Your complicated (and wrong) if/elif/else it's not necessary.

And an unnecessary edit: Funny thing, you can do all of this in a single line: (not really useful, because you can't know how many items have been bought, so you can't check if money should be spent)

Code: Select all

$ bag_item1 += int(renpy.input("How many?", allow="0123456789") or 0)
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: No registered users