[Solved] Screen not showing up

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
cytra
Newbie
Posts: 2
Joined: Thu Oct 05, 2023 4:10 am
Contact:

[Solved] Screen not showing up

#1 Post by cytra »

I am trying to make an inventory screen where items can be dragged to a certain area to be combined so I'm using drag and drop.

I want the description of a item to show up immediately after the item is being clicked or dragged.

To achieve that, I made another screen for the description but it would not show up unless I tried to close the window. The "Are you sure you want to quit" box popped up and the description would show up in the background.

I'm new to programming and not sure how to achieve my desired effect. Any help would be appreciated.

Code: Select all

init python:

	def drag_activated(activated_item):

        	store.current = activated_item[0].drag_name
        	renpy.hide_screen("item_description")
        	renpy.show_screen("item_description")

screen item_description():

	modal False 

	for item in Inventory.items:
		frame:
			background None
			xpos 1000
			ypos 500
			xsize 500
			ysize 400

			if item.name == current:
                		text "[item.description]":
                		size 40
                    
                	if current == "None":
                		text "Combine items to create something new.":
                    		size 40

screen inventory():

	modal True
	add "background_inventory”
	on "show" action Show("item_description")

	draggroup:
        	for item in Inventory.items:
            		drag:
                		drag_name item.name
                		child "icon_%s"%(item.name)
                		xpos item.x_pos
                		ypos item.y_pos
                		drag_raise True
                		droppable False
                		dragged drag_inventory
                		activated drag_activated
                		
screen room():

	modal True
	add "background_room"
	
	imagebutton auto "inventory_icon_%s":
		focus_mask True
		action Show("inventory")

label part2:

	call screen room
Last edited by cytra on Thu Oct 05, 2023 7:01 am, edited 2 times in total.

User avatar
m_from_space
Eileen-Class Veteran
Posts: 1057
Joined: Sun Feb 21, 2021 3:36 am
Contact:

Re: Screen not showing up

#2 Post by m_from_space »

Try:

Code: Select all

init python:

	def drag_activated(activated_item):

        	store.current = activated_item[0].drag_name
        	renpy.show_screen("item_description")
                renpy.restart_interaction()

cytra
Newbie
Posts: 2
Joined: Thu Oct 05, 2023 4:10 am
Contact:

Re: Screen not showing up

#3 Post by cytra »

m_from_space wrote: Thu Oct 05, 2023 6:52 am Try:

Code: Select all

init python:

	def drag_activated(activated_item):

        	store.current = activated_item[0].drag_name
        	renpy.show_screen("item_description")
                renpy.restart_interaction()
Thank you so much! It works perfectly now! ^ ^

Post Reply

Who is online

Users browsing this forum: Google [Bot]