Some Command Questions with Ren'Py

A place to discuss things that aren't specific to any one creator or game.
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Post Reply
Message
Author
HAXLION
Regular
Posts: 29
Joined: Tue Apr 29, 2008 10:05 am
Projects: "Everything"
Location: New York~
Contact:

Some Command Questions with Ren'Py

#1 Post by HAXLION »

I do apologize if these have been answered somewhere before. I'm not particularly good with forum searching, and I haven't been around in a while, so....

Anyway. My questions relating to Ren'Py are as follows.

1) As for the "Pause" command, is there a way to make it so that it pauses and prevents the reader from skipping through it? In other words, a pause that can't be overridden with a key press.

2) Next, the "punch" commands. Is there another way to make the screen shake, and to toy with the force it shakes with and the duration? I know that in ONScripter there is a Quakex and Quakey, but I haven't seen anything like that in Ren'Py.

3) Lastly, text. Is it possible to add blank lines to a screen? For example, if I wanted the text to display lower in the window as opposed to starting from the top.

I haven't used anything aside from "novel mode" up until now.

I do appreciate any help!

User avatar
sake-bento
Eileen-Class Veteran
Posts: 1909
Joined: Sat Jan 26, 2008 5:58 pm
Completed: http://sakevisual.com/games.html
Projects: Every Sunrise, Shinsei
Organization: sakevisual
Tumblr: sakevisual
Deviantart: sakevisual
itch: sakevisual
Contact:

Re: Some Command Questions with Ren'Py

#2 Post by sake-bento »

HAXLION wrote: 3) Lastly, text. Is it possible to add blank lines to a screen? For example, if I wanted the text to display lower in the window as opposed to starting from the top.
Use "\n" (minus the quotes) to make a blank line.

Not sure about the others. >.> Someone smarter will have to fill in here. ^_^;;

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Some Command Questions with Ren'Py

#3 Post by PyTom »

HAXLION wrote:1) As for the "Pause" command, is there a way to make it so that it pauses and prevents the reader from skipping through it? In other words, a pause that can't be overridden with a key press.

Code: Select all

renpy.pause(1.0, hard=True)
This will prevent the user from clicking through it, or hitting enter or space to go through it. IIRC, control or tab will skip it in accordance with the fast skip mode... but you probably want that.

Code: Select all

2) Next, the "punch" commands. Is there another way to make the screen shake, and to toy with the force it shakes with and the duration? I know that in ONScripter there is a Quakex and Quakey, but I haven't seen anything like that in Ren'Py. 
The vpunch and hpunch commands are just instances of Move, with absolute offsets.

Code: Select all

init python:
    vpunch = Move((0, 10), (0, -10), .10, bounce=True, repeat=True, delay=.275)
    hpunch = Move((15, 0), (-15, 0), .10, bounce=True, repeat=True, delay=.275)
3) Lastly, text. Is it possible to add blank lines to a screen? For example, if I wanted the text to display lower in the window as opposed to starting from the top.
Use \n to represent a blank line. (Depending on what you want to do, margins, padding, or box spacing may also be appropriate.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

HAXLION
Regular
Posts: 29
Joined: Tue Apr 29, 2008 10:05 am
Projects: "Everything"
Location: New York~
Contact:

Re: Some Command Questions with Ren'Py

#4 Post by HAXLION »

Hmm. Another couple of issues seem to be coming up.

When I put that improvised Pause line in the script in the "init" section and use the same Pause command it gives me an error and the game won't start. The same is true for the "\n".

Here's what I've coded.

init:
# Declare images below this line, using the image statement.
# eg. image eileen happy = "eileen_happy.png"

# Declare characters used by this game.
$ n = Character(kind=nvl, color="#c8ffc8")
image black = "#000000"
image room = "bg/room.png"
image hallway = "bg/hallway.png"
image bird = "bg/bird.png"



# The game starts here.
label start:
scene room
with fade
play music "bgm/rainfall.ogg"
n "----------------------"
extend "----------------------"

n "---------------------- "
extend "---------------------- "
extend "----------------------"
nvl clear
n "----------------------."
nvl clear
n "----------------------"
\n
Pause
n "............. How much longer?"

It lists both the "pause" and "\n" as being incorrect. ;_;

User avatar
killdream
Veteran
Posts: 325
Joined: Wed Nov 05, 2008 1:05 pm
Projects: EVūL (WIP), insilo (WIP), Cute Demon Crashers!
Deviantart: robotlolita
Github: robotlolita
Location: World's End (aka Brazil)
Contact:

Re: Some Command Questions with Ren'Py

#5 Post by killdream »

1. Post codes inside [ code ][ /code ] (without the spaces)
2. You can post Ren'Py related stuffs... well, in Ren'Py section =D
3. Instead of using "n" in every line, it's better to override the narrator character of Ren'Py:

Code: Select all

init python:
    narrator = Character(kind='nvl')
4. "\n" are interpreted as a new line character (like "#10" in Object Pascal), so you _have_ to put it inside strings

Code: Select all

"this is a dialog\nwith a forced line break"
5. Pause is a transition, so you have to use the statement with before it:

Code: Select all

with Pause(1) # a function should always have the parenthesis, even if it has no arguments

HAXLION
Regular
Posts: 29
Joined: Tue Apr 29, 2008 10:05 am
Projects: "Everything"
Location: New York~
Contact:

Re: Some Command Questions with Ren'Py

#6 Post by HAXLION »

killdream wrote:1. Post codes inside [ code ][ /code ] (without the spaces)
2. You can post Ren'Py related stuffs... well, in Ren'Py section =D
3. Instead of using "n" in every line, it's better to override the narrator character of Ren'Py:

Code: Select all

init python:
    narrator = Character(kind='nvl')
4. "\n" are interpreted as a new line character (like "#10" in Object Pascal), so you _have_ to put it inside strings

Code: Select all

"this is a dialog\nwith a forced line break"
5. Pause is a transition, so you have to use the statement with before it:

Code: Select all

with Pause(1) # a function should always have the parenthesis, even if it has no arguments
Hmmm, here's where I start to get confused.

What part of the game does the "renpy stuff" go in to? Secondly, the "init python" stuff to change the narrator?

I've done a lot of writing, but programming is new to me. Forgive my ignorance~

User avatar
killdream
Veteran
Posts: 325
Joined: Wed Nov 05, 2008 1:05 pm
Projects: EVūL (WIP), insilo (WIP), Cute Demon Crashers!
Deviantart: robotlolita
Github: robotlolita
Location: World's End (aka Brazil)
Contact:

Re: Some Command Questions with Ren'Py

#7 Post by killdream »

Oh, not, I mean, it's better to make threads about Ren'Py in Ren'Py section (that's the bad thing about trying to do lots of things at the same time .-.)

And well, when you ommit the character before a dialog, Ren'Py uses a default character, and this character is stored inside the variable narrator, so to change this default character you just have to change the variable.

HAXLION
Regular
Posts: 29
Joined: Tue Apr 29, 2008 10:05 am
Projects: "Everything"
Location: New York~
Contact:

Re: Some Command Questions with Ren'Py

#8 Post by HAXLION »

Uh, still not following you with the narrator thing. Where does that go? In the Options part?

If possible, I'd like to know exactly what to type in.

Guest

Re: Some Command Questions with Ren'Py

#9 Post by Guest »

http://www.renpy.org/wiki/Character

Look at the example. Basically each style of expression can be defined as a separate Character... even if in your story it's the same person. You can have an NVL style for his thoughts, for example, and another style when he actually speaks.

User avatar
killdream
Veteran
Posts: 325
Joined: Wed Nov 05, 2008 1:05 pm
Projects: EVūL (WIP), insilo (WIP), Cute Demon Crashers!
Deviantart: robotlolita
Github: robotlolita
Location: World's End (aka Brazil)
Contact:

Re: Some Command Questions with Ren'Py

#10 Post by killdream »

Un, files don't matter that much in ren'py, all '.rpy' files will be read as if they were just one.

You need to modify the narrator variable before showing the dialog with it (normally, you don't need to change it, but since you're going with nvl, it's better to change the narrator than create a new one).

This should be done in a init block, since it'll be executed everytime the game runs and before the game starts, so you'd make sure the variable is changed before you use any dialog.

Since Ren'Py uses a custom language that is not Python, you have to use some statements to get Python code inside your Ren'Py script. This can be done inline, with the '$' statement:

Code: Select all

$ narrator = Character(kind='nvl')
Or in a block, using the 'python' statement:

Code: Select all

python:
    narrator = Character(kind='nvl')

The python statement can be used inside a label or init block, so you have it as a sub-block of the init/label block:

Code: Select all

init:
    python:
        print "python block"

label start:
    python:
        print "python block"
but you can also embbed it in the init block declaration, so you don't have two blocks when you just need python:

Code: Select all

init python:
    print "python block"

HAXLION
Regular
Posts: 29
Joined: Tue Apr 29, 2008 10:05 am
Projects: "Everything"
Location: New York~
Contact:

Re: Some Command Questions with Ren'Py

#11 Post by HAXLION »

Blech. It's still not working out, even though I've tried what you guys recommended. What's wrong with my code?

# You can place the script of your game in this file.
init:
# Declare images below this line, using the image statement.
# eg. image eileen happy = "eileen_happy.png"
# Declare characters used by this game.
init python:
print "python block"
$ narrator = Character(kind='nvl')
image black = "#000000"
image room = "bg/room.png"
image hallway = "bg/hallway.png"
image bird = "bg/bird.png"
image carnival = "bg/carnival.png"
# The game starts here.

label start:
scene room
with fade
play music "bgm/rainfall.ogg"

User avatar
killdream
Veteran
Posts: 325
Joined: Wed Nov 05, 2008 1:05 pm
Projects: EVūL (WIP), insilo (WIP), Cute Demon Crashers!
Deviantart: robotlolita
Github: robotlolita
Location: World's End (aka Brazil)
Contact:

Re: Some Command Questions with Ren'Py

#12 Post by killdream »

Oh, no, please remove that

Code: Select all

init python:
    print "python block"
It was just an example i.i

And also, you have to post exactly what error you're getting or else we can't say much.

Also, please put your code in code tags. Python uses compulsory identation and normal posting on the topic will kill all the identation. (it's better if you add the traceback, though)

HAXLION
Regular
Posts: 29
Joined: Tue Apr 29, 2008 10:05 am
Projects: "Everything"
Location: New York~
Contact:

Re: Some Command Questions with Ren'Py

#13 Post by HAXLION »

killdream wrote:Oh, no, please remove that

Code: Select all

init python:
    print "python block"
It was just an example i.i

And also, you have to post exactly what error you're getting or else we can't say much.

Also, please put your code in code tags. Python uses compulsory identation and normal posting on the topic will kill all the identation. (it's better if you add the traceback, though)
Ah, my mistake. I apologize. Let's see...

Code: Select all

# You can place the script of your game in this file.
init:
    # Declare images below this line, using the image statement.
    # eg. image eileen happy = "eileen_happy.png"
    # Declare characters used by this game.
    init python:
        print "python block"
    $ narrator = Character(kind='nvl')      
    image black = "#000000"
    image room = "bg/room.png"
    image hallway = "bg/hallway.png"
    image bird = "bg/bird.png"
    image carnival = "bg/carnival.png"
# The game starts here.

label start:
    scene room
    with fade
    play music "bgm/rainfall.ogg"
I'm sorry, but an exception occured while executing your Ren'Py
script.

TypeError: 'kind' is an invalid keyword argument for this function

While executing init code:
- script at line 8 of C:\Documents and Settings\Owner\Desktop\renpy-6.8.1-sdk\renpy-6.8.1\Everything/game/script.rpy
- python at line 8 of C:\Documents and Settings\Owner\Desktop\renpy-6.8.1-sdk\renpy-6.8.1\Everything/game/script.rpy.

-- Full Traceback ------------------------------------------------------------

File "C:\Documents and Settings\Owner\Desktop\renpy-6.8.1-sdk\renpy-6.8.1\renpy\bootstrap.py", line 247, in bootstrap
File "C:\Documents and Settings\Owner\Desktop\renpy-6.8.1-sdk\renpy-6.8.1\renpy\main.py", line 253, in main
File "C:\Documents and Settings\Owner\Desktop\renpy-6.8.1-sdk\renpy-6.8.1\renpy\execution.py", line 199, in run
File "C:\Documents and Settings\Owner\Desktop\renpy-6.8.1-sdk\renpy-6.8.1\renpy\ast.py", line 554, in execute
File "C:\Documents and Settings\Owner\Desktop\renpy-6.8.1-sdk\renpy-6.8.1\renpy\python.py", line 880, in py_exec_bytecode
File "C:\Documents and Settings\Owner\Desktop\renpy-6.8.1-sdk\renpy-6.8.1\Everything/game/script.rpy", line 8, in <module>
File "C:\Documents and Settings\Owner\Desktop\renpy-6.8.1-sdk\renpy-6.8.1\renpy\character.py", line 572, in Character
TypeError: 'kind' is an invalid keyword argument for this function

While executing init code:

Ren'Py Version: Ren'Py 6.8.1a

User avatar
killdream
Veteran
Posts: 325
Joined: Wed Nov 05, 2008 1:05 pm
Projects: EVūL (WIP), insilo (WIP), Cute Demon Crashers!
Deviantart: robotlolita
Github: robotlolita
Location: World's End (aka Brazil)
Contact:

Re: Some Command Questions with Ren'Py

#14 Post by killdream »

Un, sorry, my mistake. I completly forgot Character function had a name argument xD

So, replace that by:

Code: Select all

$ narrator = Character(None, kind=nvl)
Also, take a look at the character documentation ^^

Post Reply

Who is online

Users browsing this forum: No registered users