Quicktime Event still an issue

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.
Post Reply
Message
Author
Variasaber
Newbie
Posts: 16
Joined: Sat Sep 24, 2011 11:35 pm
Completed: Ex Nihilo Unum (http://users.wpi.edu/~bmoriarty/imgd100 ... loUnum.rar)
Organization: 12000 Bombs
Location: Worcester Polytechnic Institute
Contact:

Quicktime Event still an issue

#1 Post by Variasaber »

EDIT3: Everything's resolved except the quicktime event, but I don't know if that's going to go anywhere.

EDIT2: The big issue right now is in my latest post, at the bottom.

EDIT: Resolved issues are struckthrough. Only one remains: "style.say_label.text_align = 0.5" in options.rpy simply doesn't work. This may have something to do with using the two-window setup for dialogue.

Hi folks. I've been having several issues with Ren'Py lately...


Firstly, I have this code in options.rpy:

Code: Select all

    #########################################
    # Layouts
    
    ## This enables the use of an in-game menu that is made out of
    ## buttons.
    layout.grouped_main_menu()
    config.main_menu_per_group = 2

    #########################################
At first this works fine; the main menu is switched to the grouped style. But, after viewing the Preferences menu or the Exit menu and then returning to the main menu, it switches back to its default style. Why is it doing this?

And on the subject of options.rpy, Ren'Py seems to ignore about half of it and just use defaults. For example, here's some code from it:

Code: Select all

style.say_label.bold = False
style.say_label.text_align = 0.5
The first line changes the character name displays in dialogue so that they are not in bold. That works just fine.
The second line is supposed to change the character name displays as well, making them centered within their own windows (the two-window system already works). This doesn't work though, the names still show up on the left. This should work, according to both another user on this forum AND according to the Ren'Py documentation.
That's the only specific example I know of that's not working, but there might be others as well. Does anyone know what's going on here?



Next, I tried to use the "Simple Onscreen Inventory" from the cookbook on the wiki. I copied and pasted the code they have directly, but it returns an error.
Here's the code for it:

Code: Select all

init python:   
    showitems = True
   
    def display_items_overlay():
        if showitems:
            inventory_show = "Inventory: "
            for i in range(0, len(items)):
                item_name = items[i].title()
                if i > 0:
                    inventory_show += ", "
                inventory_show += item_name
            ui.frame()
            ui.text(inventory_show)
    config.overlay_functions.append(display_items_overlay)

##
$ items.append("stone") #when you want to add items
$ items.remove("stone")#when you want to remove items
$ showitems = False #when you don't want to show the inventory onscreen (cutscenes and the like)
$ showitems = True #when you want to reshow the inventory after the cutscene is over
It doesn't like this line:

Code: Select all

for i in range(0, len(items)):
It returns some kind of error about items not being defined or something. Anyone know what the issue is?


Lastly, for the game I'm making I'm trying to add a quicktime sequence to one scene; basically, a little image will pop up at a random spot on the screen, and the player has a few seconds to click it, which will advance the sequence (with changing imagery to accompany it), and after they've done this a certain number of times, the sequence ends. If they fail to click the image within the few seconds they are given, or if they click on the wrong spot, they fail the sequence and have to start it over.
Right now I'm using an image map to make the shown image clickable, and a teammate figured out how to put a time limit on it, but I can't figure out how to randomize its position (its size is fixed). Just some sort of script to produce a random number within a defined range (whatever range the coder wants) would be enough. Anyone know how to do that, or perhaps is there a much easier way to do this than using an imagemap? And how would I make it such that clicking somewhere other than the given image can produce a different result?



Any help or guidance anyone can find will be greatly appreciated!
Last edited by Variasaber on Sat Oct 15, 2011 4:59 am, edited 3 times in total.
Image

User avatar
Alex
Lemma-Class Veteran
Posts: 3094
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Several issues

#2 Post by Alex »

It returns some kind of error about items not being defined or something. Anyone know what the issue is?
Your inventory system shows items from list named "items", so you should define this list.

Code: Select all

label start:
    $ items = []  # an empty list

    # or if you have some items in your inventory by default
    $ items = ["orange", "plum", "apple"]
is there a much easier way to do this than using an imagemap?
You can show a big imagebutton as background (click on it represents player's miss) and another small imagebutton (the target)

Check
http://www.renpy.org/doc/html/screens.html
http://www.renpy.org/doc/html/screens.html#timer
http://www.renpy.org/w/index.php?title= ... ndom&go=Go

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: Several issues

#3 Post by PyTom »

Variasaber wrote: At first this works fine; the main menu is switched to the grouped style. But, after viewing the Preferences menu or the Exit menu and then returning to the main menu, it switches back to its default style. Why is it doing this?
It sounds like you're mixing screens and layouts, something that doesn't work very well.
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

Variasaber
Newbie
Posts: 16
Joined: Sat Sep 24, 2011 11:35 pm
Completed: Ex Nihilo Unum (http://users.wpi.edu/~bmoriarty/imgd100 ... loUnum.rar)
Organization: 12000 Bombs
Location: Worcester Polytechnic Institute
Contact:

Re: Several issues

#4 Post by Variasaber »

PyTom wrote:It sounds like you're mixing screens and layouts, something that doesn't work very well.
Wow, a reply from the creator himself! I'm honored. This project I'm working on is the final course project for an introductory Game Design course at Worcester Polytechnic Institute. So, Ren'Py is being taught to college freshmen!
It's a shame the config I have now won't work, but oh well, no big deal. My deadline is fast approaching so for now I'll just have to drop it, but maybe later on.


Alex, thanks a bunch for all the info, looks like that's exactly what I need! I'll test things out with this new stuff and then report back.


Lastly, thank you both for the speedy replies! :mrgreen:
Image

Variasaber
Newbie
Posts: 16
Joined: Sat Sep 24, 2011 11:35 pm
Completed: Ex Nihilo Unum (http://users.wpi.edu/~bmoriarty/imgd100 ... loUnum.rar)
Organization: 12000 Bombs
Location: Worcester Polytechnic Institute
Contact:

Re: Several issues (all but one resolved)

#5 Post by Variasaber »

Okay, there's still an issue. I tried to implement all the stuff you showed me, Alex, to make a functional quicktime event, but it's returning an error I don't even understand.
Here's my code for the event:

Code: Select all

label quicktimesequence:
subtitle "Quicktime Sequence Start!"
screen quicktimeseq1:
    vbox xalign 1.0 yalign 1.0:
        imagebutton insensitive "bg800x600.png" action Return("failed")
    vbox xpos renpy.random.randint(25, 700) ypos renpy.random.randint(25, 500):
        imagebutton insensitive "qticon.png" action Return("success")
    timer 3.0 action Return("failed")
    
call screen quicktimeseq1
if _return == "failed":
    subtitle "Death"
    subtitle "Try Again?"
    menu:
        "Yes":
            jump quicktimesequence
            
        "No":
            return
And here's the error that returns:

Code: Select all

While running game code:
  File "game/script.rpy", line 828, in script
    call screen quicktimeseq1
  File "renpy-6.12.0-mainline/common/00statements.rpy", line 532, in python
  File "game/script.rpy", line 823, in python
            imagebutton insensitive "bg800x600.png" action Return("failed")
Exception: Not a displayable: None
What's the issue here? "Not a displayable: None"? Is it not recognizing that I declared an image there?
Image

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: Several issues

#6 Post by PyTom »

Variasaber wrote:Wow, a reply from the creator himself! I'm honored. This project I'm working on is the final course project for an introductory Game Design course at Worcester Polytechnic Institute. So, Ren'Py is being taught to college freshmen!
Wow, that was one of the schools I applied to, way back when I was applying to college. (I was accepted, but wound up not going there.)
Variasaber wrote:

Code: Select all

While running game code:
  File "game/script.rpy", line 828, in script
    call screen quicktimeseq1
  File "renpy-6.12.0-mainline/common/00statements.rpy", line 532, in python
  File "game/script.rpy", line 823, in python
            imagebutton insensitive "bg800x600.png" action Return("failed")
Exception: Not a displayable: None
What's the issue here? "Not a displayable: None"? Is it not recognizing that I declared an image there?
Can you post the full traceback?
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

Variasaber
Newbie
Posts: 16
Joined: Sat Sep 24, 2011 11:35 pm
Completed: Ex Nihilo Unum (http://users.wpi.edu/~bmoriarty/imgd100 ... loUnum.rar)
Organization: 12000 Bombs
Location: Worcester Polytechnic Institute
Contact:

Re: Quicktime Event still an issue

#7 Post by Variasaber »

Here you go:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 829, in script
    call screen quicktimeseq1
  File "renpy-6.12.0-mainline/common/00statements.rpy", line 532, in python
  File "game/script.rpy", line 824, in python
            imagebutton insensitive "bg800x600.png" action Return("failed")
Exception: Not a displayable: None

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

Full traceback:
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\execution.py", line 261, in run
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\ast.py", line 1400, in execute
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\ast.py", line 1413, in call
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\statements.py", line 92, in call
  File "renpy-6.12.0-mainline/common/00statements.rpy", line 532, in execute_call_screen
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\exports.py", line 1522, in call_screen
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\display\core.py", line 1445, in do_with
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\display\core.py", line 1478, in with_none
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\display\core.py", line 555, in replace_transient
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\display\core.py", line 825, in remove
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\display\core.py", line 753, in hide_or_replace
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\display\screen.py", line 175, in _hide
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\display\screen.py", line 244, in update
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\screenlang.py", line 1151, in __call__
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\python.py", line 974, in py_exec_bytecode
  File "game/script.rpy", line 824, in <module>
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\ui.py", line 434, in __call__
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\ui.py", line 710, in _imagebutton
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\display\behavior.py", line 681, in __init__
  File "C:\Program Files (x86)\Ren'Py\renpy-6.12.2\renpy\easy.py", line 87, in displayable
Exception: Not a displayable: None

Windows-post2008Server-6.1.7600
Ren'Py 6.12.2.1531
Ex Nihilo Unum 0.6
Image

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: Quicktime Event still an issue

#8 Post by PyTom »

Okay, the problem here is that an imagebutton needs at least an idle image.
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

Variasaber
Newbie
Posts: 16
Joined: Sat Sep 24, 2011 11:35 pm
Completed: Ex Nihilo Unum (http://users.wpi.edu/~bmoriarty/imgd100 ... loUnum.rar)
Organization: 12000 Bombs
Location: Worcester Polytechnic Institute
Contact:

Re: Quicktime Event still an issue

#9 Post by Variasaber »

Actually, that's not it... see, the code I posted above is what I wrote after initially seeing this error. Previously it used idle instead of insensitive, and had the same error. I've since removed the quicktime event outright since I had a deadline to make, but I can put it back in and post the traceback if you'd like.
Image

armaankhan
Newbie
Posts: 9
Joined: Tue Aug 09, 2011 3:38 pm
Contact:

Re: Quicktime Event still an issue

#10 Post by armaankhan »

Regarding your "style.say_label.text_align = 0.5" problem, I've had the same problem. In my tests, I've found that centering character names and dialogue only works when the dialogue is more than one line long. If it's less than one line, everything will remain left-justified.

I remember this being mentioned in the official documentation as well, so it's a feature, not a bug (see the information for text_align here).

I personally worked around it by applying window_left_padding to the characters I wanted "centered." It wasn't quite the same effect as centering, but it still looked nice for my project.

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: Quicktime Event still an issue

#11 Post by PyTom »

If you want center alignment, you have to use xalign along with text_align. Something like:

Code: Select all

text "Text of [variable] length." text_align 0.5 xalign 0.5
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

Variasaber
Newbie
Posts: 16
Joined: Sat Sep 24, 2011 11:35 pm
Completed: Ex Nihilo Unum (http://users.wpi.edu/~bmoriarty/imgd100 ... loUnum.rar)
Organization: 12000 Bombs
Location: Worcester Polytechnic Institute
Contact:

Re: Quicktime Event still an issue

#12 Post by Variasaber »

Ah! I think I see how it works now; like positioning a displayable, it needs values for the position and the anchor?

Anyway, I've been bogged down with work lately but once I find some spare time I'll put the idle declarations in that quicktime event code, get the traceback, and put it here.

Oh, and if you remember when I mentioned I was making a game for an introductory game design course project, that course is now over and the game is finished. All 11 games our class made can be found here: http://users.wpi.edu/~bmoriarty/imgd1001/teams.html
I'm not sure if that link will work for you guys, but hopefully it will. My team (AMP~*) made Ex Nihilo Unum.
It's not quite what I envisioned it would be; the quicktime event never made it in, there are very few sound effects and not enough music, and it lacks a proper credits screen, though borrowed assets are listed in the documentation which was hopefully included in the .rar. Still, I'd say it's solid for a first try. Next time I make a game in Ren'Py I want a good writer on my team though; the story was a bit cheesy and the dialogue was impromptu garbage. No runtime errors or gamebreaker glitches so far though :mrgreen:
Image

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot], henne, Ocelot