[Solved] Screen hides only in 80% of the time

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
User avatar
Lezalith
Regular
Posts: 82
Joined: Mon Dec 21, 2015 6:45 pm
Contact:

[Solved] Screen hides only in 80% of the time

#1 Post by Lezalith » Mon Aug 15, 2016 8:14 pm

Hey people.

So, I have a "Practice" screen. On that screen, there are buttons to call in different "branches". These branches are screens, all with the tag "skillBranch". Let me show you how one of them looks like.

Code: Select all

screen MorningBranchMeele:
    tag skillBranch
    imagemap: 
        xalign 0.5
        yalign 0.5
        alpha False
        ground "screens/practice/activity/melee.png"
        hover "screens/practice/activity/melee_hover.png"
        selected_idle "screens/practice/activity/melee_selected_idle.png"
        selected_hover "screens/practice/activity/melee_selected_hover.png"
        hotspot(827, 105, 302, 51) hovered [(SetVariable("hoverSkill", "Unarmed")),(Show("skillDescription"))] unhovered Hide("skillDescription") action [(SetVariable("InTeachingMorning", "Unarmed"))]
        hotspot(827, 165, 302, 51) hovered [(SetVariable("hoverSkill", "Axe")),(Show("skillDescription"))] unhovered Hide("skillDescription") action [(SetVariable("InTeachingMorning", "Axe"))]
        hotspot(827, 225, 302, 51) hovered [(SetVariable("hoverSkill", "Knife")),(Show("skillDescription"))] unhovered Hide("skillDescription") action [(SetVariable("InTeachingMorning", "Knife"))]
They have a Morning and Afternoon variation, and I have totally 24 of them. Now, when you close practice screen, branches stay. This was a problem, and so I made an "emptyBranch":

Code: Select all

screen emptyBranch:
    tag skillBranch
That's it. It's basically nothing. This emptyBranch is called when exiting the Practice sceen. Because it has the same tag, it SHOULD hide all the other branches.

Well, sadly, that is not the case. It usually works, but not always. And this is a major bug in my project.

I went for two more different solutions.
A) Into the "action" of button that exits the Practice screen, I actually added 24 variations of Hide("???branch???"), so even if the "tag recognition" for emptyBranch failed and did not hide other screens, all branches that would be possibly on the screen would hide.
This was as much effective as my original solution.
B) Upon exiting Practice, you will get into the "root menu". You can also enter root menu by jumping to a label, and as far as I know, jumping to a label should hide all screens.
But the effectiveness was the same.


I honestly do not get it. All three solutions SHOULD WORK, these are just simple mechanics, it isn't neither brain science nor rocket surgery!
Last edited by Lezalith on Tue Aug 16, 2016 9:33 am, edited 2 times in total.

User avatar
papiersam
Veteran
Posts: 231
Joined: Fri Aug 12, 2016 2:24 pm
Completed: Gem Hunt Beta, 1/Probably, Animunch
Projects: The Panda Who Dreamed
Contact:

Re: Screen hides only in 80% of the time

#2 Post by papiersam » Mon Aug 15, 2016 8:23 pm

I think it really depends on how you're showing/calling the screen in the first place, and under what circumstances. Or, at least, it'd be easier to diagnose if we knew.

Also, are you sure you should be using 'tag' and not 'use' (assuming skillBranch is also a screen)? From my own practice, to include a screen with a screen, I've always used 'use' (also, the default generated screens uses use navigation and use quick_menu to include those screens).

User avatar
Lezalith
Regular
Posts: 82
Joined: Mon Dec 21, 2015 6:45 pm
Contact:

Re: Screen hides only in 80% of the time

#3 Post by Lezalith » Mon Aug 15, 2016 9:03 pm

Code: Select all

            hotspot (417, 99, 186, 51) action [(Show("MorningBranchCommunication"))]
            hotspot (83, 259, 186, 51) action [(Show("MorningBranchMeele"))]
            hotspot (292, 259, 186, 51) action [(Show("MorningBranchRanged"))]
            hotspot (502, 259, 186, 51) action [(Show("MorningBranchExplosives"))]
            hotspot (89, 574, 186, 51) action [(Show("MorningBranchCrafting"))]
            hotspot (266, 574, 186, 51) action [(Show("MorningBranchStrategy"))]
            hotspot (445, 574, 186, 51) action [(Show("MorningBranchHunting"))]
            hotspot (626, 574, 186, 51) action [(Show("MorningBranchMedicine"))]
            hotspot (803, 574, 186, 51) action [(Show("MorningBranchStealth"))]
            hotspot (92, 426, 186, 51) action [(Show("MorningBranchMobility"))]
            hotspot (301, 426, 186, 51) action [(Show("MorningBranchEndurance"))]
            hotspot (511, 426, 186, 51) action [(Show("MorningBranchAgility"))]
These are the buttons that call in the branches.


And what are you talking about? "skillBranch" is not a screen, it is name of the tag.
Somewhere in the middle of first post, you will find sentence that losely translates to "If tags worked, this whole thing wouldn't bother me", and you start bringing "use" into it.


EDIT:
1st version of the "Back" button:

Code: Select all

hotspot (1023, 608, 210, 62) action Show("main_screen", transition=dissolve),Hide("study"),Show("emptyBranch")
2nd version:

Code: Select all

hotspot (1023, 608, 210, 62) action Show("main_screen", transition=dissolve),Hide("study"),Hide("MorningBranchCommunication"),Hide("MorningBranchMelee"),Hide("MorningBranchRanged"),Hide("MorningBranchExplosives"),Hide("MorningBranchCrafting"),Hide("MorningBranchMedicine"),Hide("MorningBranchHunting"),Hide("MorningBranchStealth"),Hide("MorningBranchStrategy"),Hide("MorningBranchMobility"),Hide("MorningBranchAgility"),Hide("MorningBranchEndurance"),Hide("AfternoonBranchCommunication"),Hide("AfternoonBranchMelee"),Hide("AfternoonBranchRanged"),Hide("AfternoonBranchExplosives"),Hide("AfternoonBranchCrafting"),Hide("AfternoonBranchMedicine"),Hide("AfternoonBranchHunting"),Hide("AfternoonBranchStealth"),Hide("AfternoonBranchStrategy"),Hide("AfternoonBranchMobility"),Hide("AfternoonBranchAgility"),Hide("AfternoonBranchEndurance")
3rd version:

Code: Select all

hotspot (1023, 608, 210, 62) action Jump("main_menu")
All mentioned in the original post.

User avatar
papiersam
Veteran
Posts: 231
Joined: Fri Aug 12, 2016 2:24 pm
Completed: Gem Hunt Beta, 1/Probably, Animunch
Projects: The Panda Who Dreamed
Contact:

Re: Screen hides only in 80% of the time

#4 Post by papiersam » Mon Aug 15, 2016 10:50 pm

Funny, I hadn't thought to use 'tag' for anything else but 'tag menu'. Thank you for pointing that out. Also, sorry, I completely misunderstood the situation.

I have no idea why it's only hiding in some cases (80%, to be exact), except that maybe it has something to do with the order shown?

Anyways, I have a rough theory that's similar to version 2:

Code: Select all

init python:
    
    import pygame
     
    arr_branches = ["MorningBranchCommunication", "MorningBranchMeele", "MorningBranchRanged", "..."] #here is an array of all the branch names
    def hide_all(arr):
        for i in range (0, len(arr)): #goes through all the names in the array
            renpy.hide_screen(arr[i]) #hides the screen of that name
And then just use

Code: Select all

    hide_all(arr_branches)
when you want to hide the branches. Note that this isn't tested and probably won't work, but I wanted to test the concept.

Sorry I couldn't be of more help with this.

User avatar
Lezalith
Regular
Posts: 82
Joined: Mon Dec 21, 2015 6:45 pm
Contact:

Re: Screen hides only in 80% of the time

#5 Post by Lezalith » Tue Aug 16, 2016 12:35 am

Don't worry about it :)

It is basically my 2nd version, just put differently, but I guess it would be worth a shot.
However, when I implemented it, another glorious bug appeared. As you can see, the branches contain imagemaps. Whenever I hover over the imagemap of a branch, the branch disappears.
I mean, implementing the "hide_all(arr_branches)" does it. This WOULD make sense, IF I wasn't adding this onto an action instead of hover, on a different hotspot of a different imagemap of a different screen.


You know what I also noticed? When I remove some of the actions in hotspot, and end up with this...

Code: Select all

hotspot (1023, 608, 210, 62) action Show("main_screen", transition=dissolve),Hide("study")
The branches should stay with such a code. The only thing we are hiding is screen "study" and branches are not there, they have their own separate screens. Yet, the branch hides like the code was not modified at all!

... I think my code is haunted or something.

EDIT: OH!
Also, might aswell mention that the entire button (Actually an imagemap, but I'll call it a button for the duration of this edit) that we're messing with here is... Well, um, the button has, of course, idle and hover versions. The button is reacting (when clicked) in the area marked by hotspot, in the entire area. However, it changes to hover only when hovered in specific area.
The interesting thing is, it would make sense if it changed into hover version only in that area which reacts to hover. But that is not the case, the entire button changes to it's hover version.

I am so dumb.

EDIT2:
Oh, and just to clarify, it is not specifically 80%. I would even say it's more, but even so, it is a major bug that I cannot ignore. And it bugs me (heh, get it?) even more because these things are not making any sense.
Last edited by Lezalith on Tue Aug 16, 2016 9:27 am, edited 1 time in total.

User avatar
papiersam
Veteran
Posts: 231
Joined: Fri Aug 12, 2016 2:24 pm
Completed: Gem Hunt Beta, 1/Probably, Animunch
Projects: The Panda Who Dreamed
Contact:

Re: Screen hides only in 80% of the time

#6 Post by papiersam » Tue Aug 16, 2016 1:21 am

Seems like an integrative issue. I think, though, that'd I'd be able to most effectively debug everything if you post up just enough of the code to replicate all the issues so I can look through it thoroughly.

My best guess, though, is that the coding needs to be tweaked a bit. It seems like there are just a lot of components included, and need to be handled accordingly.

That being said, I'm afraid there's no other way I can help without seeing the program more completely.

User avatar
Lezalith
Regular
Posts: 82
Joined: Mon Dec 21, 2015 6:45 pm
Contact:

Re: Screen hides only in 80% of the time

#7 Post by Lezalith » Tue Aug 16, 2016 9:28 am

Found the reason for button hover problem. I have it there twice, in two different imagemaps... Just how in the world did I not notice before?

Maybe that's also the reason why Hide is bugging out. Will check.

EDIT: Yep, it looks fixed. God dammit, how do I keep overlooking stuff?
Either way, thank you r_sami for help :)

Post Reply

Who is online

Users browsing this forum: Google [Bot], _ticlock_