[SOLVED]ConditionSwitch "pl.dp >= num" is completely IGNORED

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
johandark
Veteran
Posts: 355
Joined: Sat Apr 30, 2016 11:04 am
Completed: Wild Guards, In Dreams
Projects: Pact with a witch
Deviantart: johandarkweb
Location: Barcelona
Contact:

[SOLVED]ConditionSwitch "pl.dp >= num" is completely IGNORED

#1 Post by johandark »

I defined several Point levels to activate a Conditional. If it´s high, it´s gonna be RED, if it´s Medium, it´s gonna be Blue and if it´s Low, it´s gonna be Yellow.

I´ve got points done this way:

Code: Select all

init python:        
    class PointLocker(object):
        def __init__(self):
            self.dp = 0
            self.np = 0
            self.mp = 0

Code: Select all

            if type == "dp":
                self.dp += num
                renpy.show_screen("Outer_{}Screen".format(type), message)
            elif type == "np":
                self.np += num
                renpy.show_screen("Outer_{}Screen".format(type), message)
            elif type == "mp":
                self.mp += num
                renpy.show_screen("Outer_{}Screen".format(type), message)
Then I did the Conditions of High to Low Levels:

Code: Select all

#Points for level 001 animation.
    
define Points_High = ("pl.dp >= 24") #Higher Points
    
define Points_Med = ("20 <= pl.dp <= 23") #Medium Points

define Points_Low= ("pl.dp <= 19") #Lowest Points
And Finally the Animation Contain:

Code: Select all

    contains: 
        ConditionSwitch(Points_High and Insert, At("ball_red", position01), 
                                    Points_Med and Insert, At("ball_blue", position01), 
                                    Points_Low and Insert, At("ball_yellow", position01),
                                    "True", Null())
The problem comes, when the "$ Insert == True" is completely funtional (Since I have a "$ Expulse == True", that also works), but the "High/Med/Low" Define points ARE COMPLETELY IGNORED.

It always appear the first one that is in top. In this case "ball_red".

WHY?!.. It´s the last thing I need for ConditionSwitch...

Thanks for your help!
Last edited by johandark on Tue Jan 10, 2017 12:40 pm, edited 1 time in total.
Image

User avatar
nyaatrap
Crawling Chaos
Posts: 1824
Joined: Mon Feb 13, 2012 5:37 am
Location: Kimashi Tower, Japan
Contact:

Re: ConditionSwitch "pl.dp >= num" is completely IGNORED

#2 Post by nyaatrap »

nyaatrap wrote:Though I don't think conditionswitch in ATL works, because ATL only evaluates values when it's showing or replacing.
To reflect changes in ATL, you'll need to show it again.

User avatar
johandark
Veteran
Posts: 355
Joined: Sat Apr 30, 2016 11:04 am
Completed: Wild Guards, In Dreams
Projects: Pact with a witch
Deviantart: johandarkweb
Location: Barcelona
Contact:

Re: ConditionSwitch "pl.dp >= num" is completely IGNORED

#3 Post by johandark »

nyaatrap wrote:
nyaatrap wrote:Though I don't think conditionswitch in ATL works, because ATL only evaluates values when it's showing or replacing.
To reflect changes in ATL, you'll need to show it again.

I did not understand what you mean :S
Image

User avatar
johandark
Veteran
Posts: 355
Joined: Sat Apr 30, 2016 11:04 am
Completed: Wild Guards, In Dreams
Projects: Pact with a witch
Deviantart: johandarkweb
Location: Barcelona
Contact:

Re: ConditionSwitch "pl.dp >= num" is completely IGNORED

#4 Post by johandark »

nyaatrap wrote:To reflect changes in ATL, you'll need to show it again.
Could you please show some example?.. :(
Image

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: ConditionSwitch "pl.dp >= num" is completely IGNORED

#5 Post by xela »

Code: Select all

    contains:
        ConditionSwitch(Points_High and Insert, At("ball_red", position01),
                                    Points_Med and Insert, At("ball_blue", position01),
                                    Points_Low and Insert, At("ball_yellow", position01),
                                    "True", Null())
This is getting a tad ridiculous, how much trouble can one person have figuring out booleans and evaluations...

Try:

Code: Select all

    contains:
        ConditionSwitch(Points_High + " and Insert", At("ball_red", position01),
                              ...
conditions should be strings so they can be converted to bytecode and evaluated on interactions to update the displayable, what you have there will be evaluated at runtime and result in True/False which will remain constant until the displayable is instantiated again.
Like what we're doing? Support us at:
Image

User avatar
johandark
Veteran
Posts: 355
Joined: Sat Apr 30, 2016 11:04 am
Completed: Wild Guards, In Dreams
Projects: Pact with a witch
Deviantart: johandarkweb
Location: Barcelona
Contact:

Re: ConditionSwitch "pl.dp >= num" is completely IGNORED

#6 Post by johandark »

xela wrote:This is getting a tad ridiculous, how much trouble can one person have figuring out booleans and evaluations....
Yes, You´re right, I´m a completely noob on programming, sorry for troubles...

But thank you very much, Now I learned a new thing and it works perfectly!

Thanks!
Image

User avatar
xela
Lemma-Class Veteran
Posts: 2481
Joined: Sun Sep 18, 2011 10:13 am
Contact:

Re: ConditionSwitch "pl.dp >= num" is completely IGNORED

#7 Post by xela »

johandark wrote:Yes, You´re right, I´m a completely noob on programming, sorry for troubles...
No trouble on my side, point was that this issue is covered in the docs and even if you don't understand them, this was explained in your previous thread.
johandark wrote:But thank you very much, Now I learned a new thing and it works perfectly!

Thanks!
You're welcome :)
Like what we're doing? Support us at:
Image

Post Reply

Who is online

Users browsing this forum: No registered users