Simulate a mouse click

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
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Simulate a mouse click

#16 Post by trooper6 »

Oh...if you've fixed it, then I'll stop working on your screen. By the way, you don't get squares in a grid unless you put frames inside the grid boxes. It seems to me that you can use the grid and have it look the way you want, with rows of items laid out equally horizontally and vertically. Just use the spacing keyword to space them out as much as you want.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

User avatar
LiveTurkey
Regular
Posts: 109
Joined: Tue Dec 27, 2016 10:50 pm
Location: Brooklyn
Contact:

Re: Simulate a mouse click

#17 Post by LiveTurkey »

trooper6 wrote:Oh...if you've fixed it, then I'll stop working on your screen. By the way, you don't get squares in a grid unless you put frames inside the grid boxes. It seems to me that you can use the grid and have it look the way you want, with rows of items laid out equally horizontally and vertically. Just use the spacing keyword to space them out as much as you want.
Actually I just found a pretty nasty bug haha. If I click on the transparent image (which used to close out the backpack) it just ends the game. I'm assuming because now it just returns all the way and ends the game.

Apparently also if I click on an item it ends the game.

User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 3785
Joined: Mon Dec 14, 2015 5:05 am
itch: Imperf3kt
Location: Your monitor
Contact:

Re: Simulate a mouse click

#18 Post by Imperf3kt »

What happens after the backpack?
Imagine you are travelling on a road southbound.
You stop and "call" a screen and start following a road that leads east. When you reach the end of the eastbound road, you find a teleporter that transports you back to the southbound road / east road junction from which you continue travelling south.

At least, that is what is meant to happen
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Current project: GGD Mentor

Twitter

User avatar
LiveTurkey
Regular
Posts: 109
Joined: Tue Dec 27, 2016 10:50 pm
Location: Brooklyn
Contact:

Re: Simulate a mouse click

#19 Post by LiveTurkey »

Imperf3kt wrote:What happens after the backpack?
Imagine you are travelling on a road southbound.
You stop and "call" a screen and start following a road that leads east. When you reach the end of the eastbound road, you find a teleporter that transports you back to the southbound road / east road junction from which you continue travelling south.

At least, that is what is meant to happen
If you are talking about how the game now ends after calling the screen, I think I fixed it. This is my new backpack screen.

Code: Select all

screen backpack:
    imagebutton:
        idle "backgrounds/transparent.png"
        action [Hide ("backpack"), SetVariable("itemGivenId", "noItem"),
            If((speaker == "noOne"), Jump(location), Return())]  
    add "backgrounds/backpack.png"    
    $ amountOfColumns = 3
    $ columnPosition = 0
    for Item in inventory.items:
        $ i_name = Item
        imagebutton: 
            idle Item.image 
            hover Item.hoverImage 
            xpos 430+((columnPosition%amountOfColumns)*200)
            ypos 230+((columnPosition//amountOfColumns)*200)
            action [SetVariable("itemGivenId", Item.type), SetVariable("itemGivenName", Item.name), Hide("item_desc"), Hide("item_name"), Hide("backpack"), 
                If((speaker == "noOne"), Jump(location), Return())] 
            hovered [Show(("item_name"), Item = i_name), Show(("item_desc"), Item = i_name)]  
            unhovered [Hide("item_desc"), Hide("item_name")]
        $ columnPosition += 1
Everything seems to work. Although I don't know if this was a good fix or a band aid fix that is going to destroy my game somewhere down the line.

User avatar
trooper6
Lemma-Class Veteran
Posts: 3712
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Simulate a mouse click

#20 Post by trooper6 »

1) You don't need the High("backpack") because, if you are calling the screen rather than showing it, the screen will automatically disappear once your click something that has a return.

2) You should reserve capital letters only for class definitions. So that "for Item in inventory.items" I'd change to something like: "for i in inventory.items"
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?)
Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978

Post Reply

Who is online

Users browsing this forum: No registered users