I'm New to Ren'Py Questions

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
denzil
Veteran
Posts: 293
Joined: Wed Apr 20, 2005 4:01 pm
Contact:

#16 Post by denzil » Sat May 19, 2007 9:10 am

Talking about window.title, has there been any progress with showing Czech characters in title of window? I tried Ren'Py 6.2 and I'm still getting question marks instead of some of them.
Practice makes purrrfect.
Finished projects: Broken sky .:. colorless day .:. and few more...

Guest

#17 Post by Guest » Sat May 19, 2007 9:44 am

PyTom wrote:When using non-ASCII characters in Python code, you need to prefix the string with a 'u', for unicode. So you'd want to write:

Code: Select all

init:
    $ window.title = u"Ðóññêèé"
Ditto for the Character's name.
Duh.

Code: Select all

init:
    $ window.title = u"Ðóññêèé"
results in

Code: Select all

I'm sorry, but an exception occured while executing your Ren'Py
script.

NameError: name 'window' is not defined

While executing init code:
 - script at line 2 of C:\ή㡿 ࡯로renpy-6.2.0\Try1/game/script.rpy
 - python at line 2 of C:\ή㡿 ࡯로renpy-6.2.0\Try1/game/script.rpy.

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

  File "C:\Downloads\à擄᭬읒en-Py\renpy-6.2.0\renpy\bootstrap.py", line 197, in bootstrap
  File "C:\Downloads\à擄᭬읒en-Py\renpy-6.2.0\renpy\main.py", line 259, in main
  File "C:\Downloads\à擄᭬읒en-Py\renpy-6.2.0\renpy\execution.py", line 171, in run
  File "C:\Downloads\à擄᭬읒en-Py\renpy-6.2.0\renpy\ast.py", line 489, in execute
  File "C:\Downloads\à擄᭬읒en-Py\renpy-6.2.0\renpy\python.py", line 860, in py_exec_bytecode
  File "C:\ή㡿 ࡯로renpy-6.2.0\Try1/game/script.rpy", line 2, in <module>
NameError: name 'window' is not defined

While executing init code:

Ren'Py Version: Ren'Py 6.2.0c
while

Code: Select all

$ config.window_title = u"Ðóññêèé"
works but results in series of question marks.

But Character's and Save name now works perfectly.

Thank you very much!!!

And sorry for lengthy post without much meaning.

Zephie-chan
Newbie
Posts: 16
Joined: Mon Jan 01, 2007 9:27 pm
Location: United States
Contact:

#18 Post by Zephie-chan » Tue Jun 19, 2007 1:46 am

Okay, so between normal dramas of daily life, I have come back with an extremely unorthodox coded "Bookmark" feature that pretty much explains I have no idea what the hell I am doing.

This is my "bookmark.rpy", which is basically a total rip from the cookbook. Yes, I mangled it into something totally unrecognizable:

Code: Select all

## Save Bookmark Labels
label _save_bookmark_one:
    $ renpy.save('savebookmark1', _('Save Bookmark 1'))
    $ ui.text(_('The game has been saved using bookmark slot one.'), xpos=0.5, xanchor='center', ypos=0.5, yanchor='center')
    return

label _save_bookmark_two:
    $ renpy.save('savebookmark2', _('Save Bookmark 2'))
    $ ui.text(_('The game has been saved using bookmark slot two.'), xpos=0.5, xanchor='center', ypos=0.5, yanchor='center')
    return

label _save_bookmark_one:
    $ renpy.save('savebookmark3', _('Save Bookmark 3'))
    $ ui.text(_('The game has been saved using bookmark slot three.'), xpos=0.5, xanchor='center', ypos=0.5, yanchor='center')
    return

## Load Bookmark Labels
label _load_bookmark_one:
    $ renpy.load('savebookmark1')
    return

label _load_bookmark_two:
    $ renpy.load('savebookmark2')
    return

label _load_bookmark_three:
    $ renpy.load('savebookmark3')
    return

# New Right-click Game Menu. "_game_menu_screen" is set to "_save_bookmark_menu" in options.
label _save_bookmark_menu:
    scene white
    ui.textbutton(_("Save Bookmark 1"), xpos=0.98, ypos=0.02, xanchor='right', yanchor='top', clicked=renpy.curried_call_in_new_context('_save_bookmark_one'))
    ui.textbutton(_("Save Bookmark 2"), xpos=0.98, ypos=0.12, xanchor='right', yanchor='top', clicked=renpy.curried_call_in_new_context('_save_bookmark_two'))
    ui.textbutton(_("Save Bookmark 3"), xpos=0.98, ypos=0.22, xanchor='right', yanchor='top', clicked=renpy.curried_call_in_new_context('_save_bookmark_three'))

    return

# This is the load bookmark menu you recieve when you click on "Load Bookmark" at the main menu.
label _load_bookmark_menu:
    scene white
    ui.textbutton(_("Load Bookmark 1"), xpos=0.98, ypos=0.02, xanchor='right', yanchor='top', clicked=renpy.curried_call_in_new_context('_load_bookmark_one'))
    ui.textbutton(_("Load Bookmark 2"), xpos=0.98, ypos=0.12, xanchor='right', yanchor='top', clicked=renpy.curried_call_in_new_context('_load_bookmark_two'))
    ui.textbutton(_("Load Bookmark 3"), xpos=0.98, ypos=0.22, xanchor='right', yanchor='top', clicked=renpy.curried_call_in_new_context('_load_bookmark_three'))

    return
As clearly seen by, I assume, anyone that knows anything about Ren'Py scripting, it doesn't work. I don't know why, I don't even know the vaguest clue as to how to get it working!

But I'm posting it here as an example of the type of effect that I want: I want a button on the main menu that goes to a loading screen with three buttons for each three saves. Ditto for the save menu: three buttons that will create three saves that I can load from. I'd also very much like the saves to record the time/date it was saved and which "scene" it was saved on (there are a total of 53 "scenes" in the game). But I think that's going a bit further than I want at this point as I'd just like the save and load functions to work period.

I'm at the end of my rope and getting rather frustrated with my inability to do what seems to be so simple to everyone else, but I'm here to learn and I'd appreciate any advice on getting the above code to work or someone to show me a better, gentler way of doing what I want.

Thanks in advance!
"The greatest error is not in making a mistake, but not allowing the one who made the mistake a chance to fix it." - corVine
"There is no reason why good can't triumph over evil, if only angels will get organized along the lines of the mafia." Kurt Vonnegut

User avatar
PyTom
Ren'Py Creator
Posts: 15427
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:

#19 Post by PyTom » Tue Jun 19, 2007 2:03 am

What's the error you're getting? Trivially, you want to do a ui.interact or a renpy.restart_interaction after the ui.texts, otherwise they won't show up.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Zephie-chan
Newbie
Posts: 16
Joined: Mon Jan 01, 2007 9:27 pm
Location: United States
Contact:

#20 Post by Zephie-chan » Tue Jun 19, 2007 2:48 am

This is the error that pops up when it tries to load/open the game:

Code: Select all

I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.


On line 36 of E:\Program Files\Ren'Py\mygame/game/bookmark.rpy: expected statement.
ui.textbutton(_("Save Bookmark 1"), xpos=0.98, ypos=0.02, xanchor='right', yanchor='top', clicked=renpy.curried_call_in_new_context('_save_bookmark_one'))
                                                                                                                                                          ^

On line 37 of E:\Program Files\Ren'Py\mygame/game/bookmark.rpy: expected statement.
ui.textbutton(_("Save Bookmark 2"), xpos=0.98, ypos=0.12, xanchor='right', yanchor='top', clicked=renpy.curried_call_in_new_context('_save_bookmark_two'))
                                                                                                                                                          ^

On line 38 of E:\Program Files\Ren'Py\mygame/game/bookmark.rpy: expected statement.
ui.textbutton(_("Save Bookmark 3"), xpos=0.98, ypos=0.22, xanchor='right', yanchor='top', clicked=renpy.curried_call_in_new_context('_save_bookmark_three'))
                                                                                                                                                            ^

On line 44 of E:\Program Files\Ren'Py\mygame/game/bookmark.rpy: expected statement.
ui.textbutton(_("Load Bookmark 1"), xpos=0.98, ypos=0.02, xanchor='right', yanchor='top', clicked=renpy.curried_call_in_new_context('_load_bookmark_one'))
                                                                                                                                                          ^

On line 45 of E:\Program Files\Ren'Py\mygame/game/bookmark.rpy: expected statement.
ui.textbutton(_("Load Bookmark 2"), xpos=0.98, ypos=0.12, xanchor='right', yanchor='top', clicked=renpy.curried_call_in_new_context('_load_bookmark_two'))
                                                                                                                                                          ^

On line 46 of E:\Program Files\Ren'Py\mygame/game/bookmark.rpy: expected statement.
ui.textbutton(_("Load Bookmark 3"), xpos=0.98, ypos=0.22, xanchor='right', yanchor='top', clicked=renpy.curried_call_in_new_context('_load_bookmark_three'))
                                                                                                                                                            ^

Ren'Py Version: Ren'Py 6.2.0c
In PHP, I would have tried to put a semicolon after each of the lines as the expected statement, but I have no idea if that could be used for Ren'Py or not, or even what symbol it's requesting.

I'll added ui.interact() on the line below ui.text(). Should I also put it under the ui.textbutton() commands too, or just on one or the other?
"The greatest error is not in making a mistake, but not allowing the one who made the mistake a chance to fix it." - corVine
"There is no reason why good can't triumph over evil, if only angels will get organized along the lines of the mafia." Kurt Vonnegut

User avatar
monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

#21 Post by monele » Tue Jun 19, 2007 3:36 am

"$" in front of ui.interact ^^

Zephie-chan
Newbie
Posts: 16
Joined: Mon Jan 01, 2007 9:27 pm
Location: United States
Contact:

#22 Post by Zephie-chan » Tue Jun 19, 2007 7:37 am

monele wrote:"$" in front of ui.interact ^^
Yep! But I'm still getting the same error even when I add "$ ui.interact()". There's no change in the error, either.
"The greatest error is not in making a mistake, but not allowing the one who made the mistake a chance to fix it." - corVine
"There is no reason why good can't triumph over evil, if only angels will get organized along the lines of the mafia." Kurt Vonnegut

User avatar
monele
Lemma-Class Veteran
Posts: 4101
Joined: Sat Oct 08, 2005 7:57 am
Location: France
Contact:

#23 Post by monele » Tue Jun 19, 2007 10:15 am

Code: Select all

_("Save Bookmark 1")
I'm unfamiliar with this syntax... and so I guess I really don't know what's wrong ^^;

Zephie-chan
Newbie
Posts: 16
Joined: Mon Jan 01, 2007 9:27 pm
Location: United States
Contact:

Re: I'm New to Ren'Py Questions

#24 Post by Zephie-chan » Wed Sep 05, 2007 6:14 pm

I still haven't figured out any of the above, and I cannot find an example I can make sense of to make it happen, but I'm still continuing to try in my free time. Which is very little with college assignments (long five page essays and ten page research papers) being shove into my every orifice. But enough of that, time for another, probably somewhat ridiculous question, but lack of time to do trial and error forces me to:

I want to rotate an image and tried attempting to do so using the RotoZoom function, but that's also my problem: RotoZOOM. I don't want a zoom, and seemingly no matter what numbers I put in the zoom parts of the code, it either does nothing or (most of the time) crashes. Is there a function specifically for rotating only, or is there some way to modify RotoZoom to not zoom?

Thanks heaps! And I'll let you know when I finally figure out how to make customized buttons and save/load/game menus and things like that. Promise. :P
"The greatest error is not in making a mistake, but not allowing the one who made the mistake a chance to fix it." - corVine
"There is no reason why good can't triumph over evil, if only angels will get organized along the lines of the mafia." Kurt Vonnegut

User avatar
PyTom
Ren'Py Creator
Posts: 15427
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: I'm New to Ren'Py Questions

#25 Post by PyTom » Wed Sep 05, 2007 6:17 pm

Just make zoom_start and zoom_end both 1.0. Zooming things to 1x of their normal size is equivalent to not zooming them at all, right?

(Actually, wrong. RotoZoom isn't 100% perfect, so things might get shifted by a pixel or so. But when you're rotating, nobody's going to notice.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Zephie-chan
Newbie
Posts: 16
Joined: Mon Jan 01, 2007 9:27 pm
Location: United States
Contact:

Re: I'm New to Ren'Py Questions

#26 Post by Zephie-chan » Wed Sep 05, 2007 7:10 pm

I tried that, actually. Here's the code, copied and pasted from the demo with edits to point to my own images (this is how it shows up in my game):

Code: Select all

show logo_boent_symbol at RotoZoom(0, 360, 5, 0, 1.0, 1.0, rot_repeat=True, rot_anim_timebase=True, opaque=False, xalign=0.25, yalign=0.5) behind logo_boent
Both zooms are 1.0, but it still zooms from a smaller scale to the larger one.
"The greatest error is not in making a mistake, but not allowing the one who made the mistake a chance to fix it." - corVine
"There is no reason why good can't triumph over evil, if only angels will get organized along the lines of the mafia." Kurt Vonnegut

User avatar
PyTom
Ren'Py Creator
Posts: 15427
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: I'm New to Ren'Py Questions

#27 Post by PyTom » Wed Sep 05, 2007 8:41 pm

You got the order of arguments wrong. You're zooming from 0 to 1.0 in 1.0 seconds. Instead, you want to zoom from 1.0 to 1.0 in 0 seconds. (Or maybe 1.0 seconds... not sure if 0 seconds will cause a divide by zero error.)
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
"Silly and fun things are important." - Elon Musk
Software > Drama • https://www.patreon.com/renpytom

Zephie-chan
Newbie
Posts: 16
Joined: Mon Jan 01, 2007 9:27 pm
Location: United States
Contact:

Re: I'm New to Ren'Py Questions

#28 Post by Zephie-chan » Wed Sep 05, 2007 9:38 pm

Ah, okay. I mistook the "self" listed in the reference section as the first function addressed (zero). But after reading your reply and then looking at the reference section again, I note that self isn't listed in the command explanation.

Makes sense now. :) Thanks!

Edit: Zero seconds will cause a divide by zero error. It must be set to 1.0.
"The greatest error is not in making a mistake, but not allowing the one who made the mistake a chance to fix it." - corVine
"There is no reason why good can't triumph over evil, if only angels will get organized along the lines of the mafia." Kurt Vonnegut

Zephie-chan
Newbie
Posts: 16
Joined: Mon Jan 01, 2007 9:27 pm
Location: United States
Contact:

Re: I'm New to Ren'Py Questions

#29 Post by Zephie-chan » Thu Sep 06, 2007 9:44 pm

Okay, how is this for a question with a lot of detailed examples of what I'm talking about?:

Say I take the code from the Quick Save and Load section in the Cookbook, and I delete everything except for the bare bone framework:

Code: Select all

label _quick_save:
    call _enter_menu_without_scene from __call__enter_menu_4

    $ renpy.save('quicksave', _('Save Bookmark'))

    $ ui.add(Solid((0, 0, 0, 128)))
    $ ui.text(_('Your position has been bookmarked.'), 
        xpos=0.5, ypos=0.5, 
        xanchor='center', yanchor='center')

    $ ui.saybehavior()
    $ ui.interact(suppress_overlay=True, suppress_underlay=True)
    return

label _quick_load:
    $ renpy.load('quicksave')
    return
Okay, now I can call on the quick save and quick load commands through a button whenever I desire. So I append a quick load button to the main menu through the config.main_menu array, and it actually works (gasp!). Now I know how to append it to an already created menu like that. But what I want to do is create a whole new menu by being able to insert the button where I please. So, as an example, say I'm looking at the Adding On-Screen Buttons section in the Cookbook. The only problem is that it appends the button to an already existing menu -- how do I get the button to just show up where I define it inside a label?

Hope that's clear enough...

In addition, while I'm on this subject -- I haven't tried this out yet, so I could be right (or wrong, as that tends to happen more often than not), but it's late at night and I wanna get into bed: Say I have the Quick Save button defined as follows, appended to the main menu:

Code: Select all

( u"Load Bookmark", ui.jumps("_quick_load"), 'renpy.can_load("quicksave")' ),
Could I use the example PyTom gave me page back to make the button an image, like this:

Code: Select all

config.image_buttons["Load Bookmark"] = (
         "button_idle.png",
         "button_hover.png",
         "button_selected-idle.png",
         "button_selected-hover.png",
         "button_disabled.png")
Or do I have to do something extra? Thanks in advance, and I'm sorry for asking so many questions, but this menu stuff just confuses the hell out of me.
"The greatest error is not in making a mistake, but not allowing the one who made the mistake a chance to fix it." - corVine
"There is no reason why good can't triumph over evil, if only angels will get organized along the lines of the mafia." Kurt Vonnegut

Zephie-chan
Newbie
Posts: 16
Joined: Mon Jan 01, 2007 9:27 pm
Location: United States
Contact:

Re: I'm New to Ren'Py Questions

#30 Post by Zephie-chan » Fri Sep 07, 2007 11:14 pm

Okay: all of my trial and error attempts today failed -- but I did get really close! Only had one error (expected statement at the end of a line, which I can't figure out). I consider that a feat beyond my capabilities, so I must be getting a little better. However, that I still doesn't help me get it totally right. This is what I had:

options.rpy:

Code: Select all

_game_menu_screen = "_quickie_menu"
The _quick_menu label in quickmenu.rpy:

Code: Select all

label _quick_menu:
    
    scene background_white
    with Dissolve(0.5)
    
    ui.vbox(xpos=0.99, ypos=0.98, xanchor='right', yanchor='bottom')
    ui.textbutton("Save Bookmark", clicked=renpy.curried_call_in_new_context("_quick_save"), xminimum=80)
    ui.textbutton("Load Bookmark", clicked=renpy.curried_call_in_new_context("_quick_load"), xminimum=80)
    ui.close()

    $ ui.interact(suppress_overlay=True, suppress_underlay=True)
Yeah... I'm completely useless. Anyone care to give me a working example of what I'm trying in vain to do? Also, I somehow, somewhere in the Reference section came across a command to return you to the game after pressing a button. Something like _return or another. I can't find it again...

Thanks, guys!
"The greatest error is not in making a mistake, but not allowing the one who made the mistake a chance to fix it." - corVine
"There is no reason why good can't triumph over evil, if only angels will get organized along the lines of the mafia." Kurt Vonnegut

Post Reply

Who is online

Users browsing this forum: Bing [Bot]