screen image doesn't show up, plus confused on screen menu

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
tpgames
Regular
Posts: 53
Joined: Wed Jun 16, 2010 11:29 pm
Projects: Jade Universität
Contact:

screen image doesn't show up, plus confused on screen menu

#1 Post by tpgames »

What is wrong with this code? Image doesn't show up, and what I really want to do, the code doesn't really do. Thanks! rofl

More Info:
1) It runs, but bksv never shows up.

2) What I'm trying to learn how to do, is make a screen image where the player can choose a book to buy. What I really want is player to use their "wand" to choose a book on a shelf. The books don't exist yet, as I only have the bookshelf slots where a book would go. I was thinking of buttons which would be the books. My code doesn't even begin to do this. I wanted to capture where the cursor/image was on the mouse.
Thanks!

Code: Select all

# You can place the script of your game in this file.

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

# Declare characters used by this game.
init:

define j = Character('Jyz', color="#0000ff")
image bksv = "bksv.png"

# The game starts here.
label start:

    j "How to make a screen language menu..."

    j "ROFL!"
    j "This screen does nothing yet."
    
screen say:
    window id "window":
        vbox:
            spacing 10
            text who id "who"
            text what id "what"

screen add_test:
    add "bksv.png" xalign 1.0 yalign 0.0
    
screen hello_world:
     tag example
     zorder 1
     modal False

     text "Hello, to lacking tutorials, where lacking is king!"
The bookshelves in a store.
The bookshelves in a store.
Here is the other code, in straight python:

Code: Select all

class storeItem:
	self.select = select
	self.deselect = deselect
	self.pay = pay
	self.items2inv = items2inv
		
class selectCapture:
    def __init__(self, keycode, binding, cart):
        self.binding = binding
        self.keycode = keycode
        self.cart = cart

    def items(name, description, price):
        self.name = name
        self.description = description
        self.price = price

class cash:
	def__init__(self, £1000)
	    self.money = money
  
# This I have no clue on! b = buy book, but I don't know how to write this at all. 
      
    def selectItem(self, event):
    	if event.key=="b":
    		subtract $ from wallet
Thanks!
Kyteroo jaunting off....(won't add website until I've finished 1 Ren'Py game)
WIP: Jade Universität - A RPG puzzle game.

User avatar
SleepKirby
Veteran
Posts: 255
Joined: Mon Aug 09, 2010 10:02 pm
Projects: Eastern Starlight Romance, Touhou Mecha
Organization: Dai-Sukima Dan
Location: California, USA
Contact:

Re: screen image doesn't show up, plus confused on screen me

#2 Post by SleepKirby »

Are you using show screen to show your add_test and hello_world screens somewhere? I don't see code that uses those screens.

(The only screens that are used automatically without show screen are these screens.)

tpgames
Regular
Posts: 53
Joined: Wed Jun 16, 2010 11:29 pm
Projects: Jade Universität
Contact:

Re: screen image doesn't show up, plus confused on screen me

#3 Post by tpgames »

I was using this page:http://www.renpy.org/doc/html/screens.html

However, I'm not really sure which type of screen to use. I know what I want to do, but not how to do it. All I want to do is:

1) Player enters store.
2) Player clicks on bookshelf
3) Player clicks on Book thats a button.
4) Player chooses
a) More information
b) Put in shopping cart.
This is repeatable until player is done chosing books.
5) Player clicks on bookshelf to close.
6) Player goes to store clerk.
7) Player checks out.

So, my question becomes, which screen type do I want to use then? Would the "choice screen" do what I want it to do?
Thanks! :D
Kyteroo jaunting off....(won't add website until I've finished 1 Ren'Py game)
WIP: Jade Universität - A RPG puzzle game.

User avatar
SleepKirby
Veteran
Posts: 255
Joined: Mon Aug 09, 2010 10:02 pm
Projects: Eastern Starlight Romance, Touhou Mecha
Organization: Dai-Sukima Dan
Location: California, USA
Contact:

Re: screen image doesn't show up, plus confused on screen me

#4 Post by SleepKirby »

There aren't really any screen types. Any screen can contain any of the possible screen statements (such as add, bar, button, etc.). Screen statements are used very similarly to the UI functions (ui.add, ui.bar, ui.button, etc.). So a screen is just a container for some UI code.

The special screens like choice, say, main_menu etc. are just individual screens that are treated specially in Ren'Py, in the same way that labels like main_menu_screen are treated specially.

Does that help any?

tpgames
Regular
Posts: 53
Joined: Wed Jun 16, 2010 11:29 pm
Projects: Jade Universität
Contact:

Re: screen image doesn't show up, plus confused on screen me

#5 Post by tpgames »

Yes, that does help some. :D

Where would I put the show statement to get the image to show up through out the time player is choosing things? This is obviously, PyTom's tutorial code for the "choice screen".

Code: Select all

init:

define j = Character('Jyz', color="#0000ff")
image bksv = "bksv.png"

# The game starts here.
label start:

    j "You've created a new Ren'Py game."

    j "Once you add a story, pictures, and music, you can release it to the world!"
    j "This screen does nothing yet."

screen choice:

    window:
        style "menu_window"

        vbox:
            style "menu"

            for caption, action, chosen in items:

                if action:

                    button:
                        action action
                        style "menu_choice_button"

                        text caption style "menu_choice"

                else:
                    text caption style "menu_caption"
Thanks!
Kyteroo jaunting off....(won't add website until I've finished 1 Ren'Py game)
WIP: Jade Universität - A RPG puzzle game.

tpgames
Regular
Posts: 53
Joined: Wed Jun 16, 2010 11:29 pm
Projects: Jade Universität
Contact:

Re: screen image doesn't show up, plus confused on screen me

#6 Post by tpgames »

Update:
show bksv does NOT work anywhere's I've tried. However, I renamed it to

Code: Select all

 image menu_window = "bksv.png" 
And, guess what! The menu screen still does not show up!
It goes through the dialogue and blackness. :P

Why can't someone who knows how to program in Ren'Py change the tutorials to include real game examples that uses images?

All I want is a stupid screen menu that allows the player to make choices WITH the images showing up. I didn't know that is would be this difficult. JS, HTML 5, CSS3, is simplistic by comparison.
Thanks! :P
Kyteroo jaunting off....(won't add website until I've finished 1 Ren'Py game)
WIP: Jade Universität - A RPG puzzle game.

User avatar
SleepKirby
Veteran
Posts: 255
Joined: Mon Aug 09, 2010 10:02 pm
Projects: Eastern Starlight Romance, Touhou Mecha
Organization: Dai-Sukima Dan
Location: California, USA
Contact:

Re: screen image doesn't show up, plus confused on screen me

#7 Post by SleepKirby »

Have you tried putting it here?:

Code: Select all

screen choice:

    add "bksv.png"

    window:
By the way, I don't know whether you got this yet, but the choice screen is a screen meant for handling the choice menus that appear at menu statements. So the choice screen appears wherever you have a menu statement in your code. Are you trying to extend the behavior for these menus, or are you trying to do something different?

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

Re: screen image doesn't show up, plus confused on screen me

#8 Post by Alex »

I know not so much about screens, but looks that it should be smth like

Code: Select all

init:
   #some init code
screen my_screen: #defines a window
    #code for your window (an imagemap or some buttons, or whatever you want)

label start:
    "blah blah"
    show screen my_screen # this should make your screen appear onscreen (quibble)

tpgames
Regular
Posts: 53
Joined: Wed Jun 16, 2010 11:29 pm
Projects: Jade Universität
Contact:

Re: screen image doesn't show up, plus confused on screen me

#9 Post by tpgames »

SleepKirby wrote:Have you tried putting it here?:

Code: Select all

screen choice:

    add "bksv.png"

    window:
By the way, I don't know whether you got this yet, but the choice screen is a screen meant for handling the choice menus that appear at menu statements. So the choice screen appears wherever you have a menu statement in your code. Are you trying to extend the behavior for these menus, or are you trying to do something different?
I thought I had tried it there. I'll try it again, just in case that was the one spot I missed. I'll edit this post to reflect truths. lol However, that didn't work.

Update: I put "show bksv" which isn't even the right code to begin with! So, no I didn't do that. however, it didn't work.

And here's what else did not work:

Code: Select all

init:

    image choice = "bksv.png"
    
    define j = Character('Jyz', color="#0000ff")
       
 

# The game starts here.
label start:

    j "This screen does nothing yet."
    
screen choice:

    window:
        style "menu_window"

        vbox:
            style "menu"

            for caption, action, chosen in items:

                if action:

                    button:
                        action action
                        style "menu_choice_button"

                        text caption style "menu_choice"

                else:
                    text caption style "menu_caption"


    text "Hello, to crap tutorials, where crap is king!"
            
    show screen choice
    
Nor this (which is closer to what was suggested...

Code: Select all

init:

    image choice = "bksv.png"
    
    define j = Character('Jyz', color="#0000ff")
       
 

# The game starts here.

    
screen choice:

    window:
        style "menu_window"

        vbox:
            style "menu"

            for caption, action, chosen in items:

                if action:

                    button:
                        action action
                        style "menu_choice_button"

                        text caption style "menu_choice"

                else:
                    text caption style "menu_caption"


    text "Hello, to crap tutorials, where crap is king!"
 
    label start:

    j "This screen does nothing yet."
    
    show screen choice
    
#GIVES ERROR:
#On line 43 of /Users/kytriya/Desktop/Screen Lang learning/game/script.rpy: Expected a screen language statement.
show screen choice

Then more exactly what was suggested...

Code: Select all

init:

    image choice = "bksv.png"
    
    define j = Character('Jyz', color="#0000ff")
       
 

# The game starts here.

    
screen my_screen:

    window:
        style "menu_window"

        vbox:
            style "menu"

            for caption, action, chosen in items:

                if action:

                    button:
                        action action
                        style "menu_choice_button"

                        text caption style "menu_choice"

                else:
                    text caption style "menu_caption"


    text "Hello, to crap tutorials, where crap is king!"
 
    label start:

    j "This screen does nothing yet."
    
    show my_screen
   #
# Gives us Error:
#On line 36 of /Users/kytriya/Desktop/Screen Lang learning/game/script.rpy: label expects a non-empty block.
label start:
Kyteroo jaunting off....(won't add website until I've finished 1 Ren'Py game)
WIP: Jade Universität - A RPG puzzle game.

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: screen image doesn't show up, plus confused on screen me

#10 Post by PyTom »

Question: Do you have a screens.rpy that has screen choice in it? If so, Ren'Py may be using that one.

Once the screen is defined correctly, the menu statement will automatically use it.
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

tpgames
Regular
Posts: 53
Joined: Wed Jun 16, 2010 11:29 pm
Projects: Jade Universität
Contact:

Re: screen image doesn't show up, plus confused on screen me

#11 Post by tpgames »

PyTom wrote:Question: Do you have a screens.rpy that has screen choice in it? If so, Ren'Py may be using that one.

Once the screen is defined correctly, the menu statement will automatically use it.
I do as it turns out. So what do I do to fix it? I don't know which code is correct to get what I'm trying to accomplish. Hint: Royal clueless Newbie. ;)

And, looking at screens.rpy, I don't see where you would put an image under the choice screen version. And, I thought that would be the one I wanted to use, as I want the player to be able to choose book(s) to buy.
Thanks!

edit: Should I give this up until the tutorials become better or I find a friend offline who can do this for me? I can make simple dialogue stuff and have bright and glaring hotspots. I only say this because I might be too clueless.
Kyteroo jaunting off....(won't add website until I've finished 1 Ren'Py game)
WIP: Jade Universität - A RPG puzzle game.

User avatar
SleepKirby
Veteran
Posts: 255
Joined: Mon Aug 09, 2010 10:02 pm
Projects: Eastern Starlight Romance, Touhou Mecha
Organization: Dai-Sukima Dan
Location: California, USA
Contact:

Re: screen image doesn't show up, plus confused on screen me

#12 Post by SleepKirby »

Well, it's up to you, though no one said making games would be easy. It's going to take more than a few days to get used to the system, especially if you're going beyond the standard visual novel format. In the meantime, when you post for help, it's always good to go one step at a time, and go into more detail about what you're trying to do.

The choice screen is typically meant for selecting between text choices like "yes" and "no", "help her" or "don't help her", etc. and then (for example) branching the story based on the decision. It sounds like you're doing something different and more visually interactive. So I have a feeling that you'd want to make a screen with your own name, instead of overriding the choice screen. In that case:

Use the last piece of code you posted (the one with my_screen). To correct it, try changing the indentation of "label start:" so it looks like this:

Code: Select all

label start:

    j "This screen does nothing yet."
   
    show my_screen

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: screen image doesn't show up, plus confused on screen me

#13 Post by PyTom »

I do as it turns out. So what do I do to fix it? I don't know which code is correct to get what I'm trying to accomplish. Hint: Royal clueless Newbie. ;)
You want to delete one of the screens. It doesn't matter which one. I kind of like the idea of screens being in screens.rpy, but you can put them wherever you want.

Could you elaborate a bit on what you are trying to accomplish?
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

tpgames
Regular
Posts: 53
Joined: Wed Jun 16, 2010 11:29 pm
Projects: Jade Universität
Contact:

Re: screen image doesn't show up, plus confused on screen me

#14 Post by tpgames »

I'll try to explain this better. I've sat down and rethought this.
The screen is an in-game menu that would only be seen if the player went shopping at any store.

This is the original confused post I wrote.
What I'm trying to learn how to do, is make a screen image where the player can choose a book to buy. What I really want is player to use their "wand" to choose a book on a shelf. The books don't exist yet, as I only have the bookshelf slots where a book would go. I was thinking of buttons which would be the books. My code doesn't even begin to do this. I wanted to capture where the cursor/image was on the mouse.
Thanks!
Explained:

1) Player clicks on hotspot to get into bookstore. Another Image Map will allow player to choose which bookshelf.
2) Screen Comes up showing the bookshelf. (This is where I'm confused.)
3) The bookshelf contains 6 squares across and 6 squares down. 1 book/button will be in each square.
4) The bookshelf will also contain a button allowing them to go back to the Image Map.
5) Player will click on a book.
6) Options will pop up so that they can
a) Read description
b) Put book in cart
c) Put book back on shelf.
7) After they are through selecting books, they will click on cashier in image map.
8) then, the total of the books are added up.
9) total of books is subtracted from Cash on hand.
10) books go into Bookshelf inventory.

The books will automatically go into Alphabetical Order.

Another question: Can Ren'Py coding allow player to rearrange the books in the inventory anyway they want to or is this to difficult? Originally, I was going to try and figure out how to code this part in Python, and leave it out of the Ren'Py version, but put it in the Pygame version. But, Pygame/Python doesn't work on this Mac very well (for image support). Image support only works in Ren'Py. But, another part of me was thinking if I just spent time reading and rereading everything (infinatum) before trying to program that part, I might have less issues. lol I'll also have a PC by then with Image support and the pygame/python working nicely together so I can see in Shell what I did wrong.
Thanks!

edit: Should I give this up until the tutorials become better or I find a friend offline who can do this for me? I can make simple dialogue stuff and have bright and glaring hotspots. I only say this because I might be too clueless.
What I meant here is that sometimes if I just read programs and their tutorials and don't try to program in that language for a few months, better tutorials come out, or my brain starts connecting better with it. Thats what happened with HTML/ CSS and to a lesser extent JS.
Attachments
The bookstore
The bookstore
Kyteroo jaunting off....(won't add website until I've finished 1 Ren'Py game)
WIP: Jade Universität - A RPG puzzle game.

Post Reply

Who is online

Users browsing this forum: No registered users