Page 1 of 1

Unable to call label with button NameError: global name 'from_current' is not defined

Posted: Sun Dec 10, 2017 12:05 pm
by asta128
deleted

Re: Unable to call label with button NameError: global name 'from_current' is not defined

Posted: Sun Dec 10, 2017 1:11 pm
by trooper6
So there was some problems with your code.
-You have two different things with the same name (both a screen and a label called "test")
-Showing a screen doesn't stop the game from continuing, so your code would go immediately from the start label to the test label, where it working.

So I fixed your code to make it so that it should work...like so:

Code: Select all

screen testscreen():
    textbutton "test" action Call("test")

label start():
    "Game starts."
    show screen testscreen()
    "The program doesn't stop just because you show a screen."
    "Game over."
    return
    
label test():
    "This works"
    return
Now, this also brings up the from_current error...which is something that was added with the new Call() action. This makes me think there may be a bug with the Call() action.

Re: Unable to call label with button NameError: global name 'from_current' is not defined

Posted: Sun Dec 10, 2017 1:40 pm
by asta128
deleted

Re: Unable to call label with button NameError: global name 'from_current' is not defined

Posted: Sun Dec 10, 2017 1:56 pm
by trooper6
One thing to do is to post to the Developer thread and say there could be a bug.
But backing up a bit, you may not even need the Call() action. It was just introduced with the most recent update and people have been making very complex RenPy things before then without it. So perhaps describing exactly what you want to do could help find a way to do it without the Call() action.

Re: Unable to call label with button NameError: global name 'from_current' is not defined

Posted: Sun Dec 10, 2017 2:05 pm
by asta128
deleted

Re: Unable to call label with button NameError: global name 'from_current' is not defined

Posted: Sun Dec 10, 2017 3:08 pm
by trooper6
You've always been able to can call screens...but that isn't the same as the Call() action.
You can also show images or dialogue using buttons depending on what exactly you want to do. Do you just want a popup of a sprite to say "Good job" then disappear or something like that? That can be done with buttons. More than one way to do it as well.

Re: Unable to call label with button NameError: global name 'from_current' is not defined

Posted: Mon Dec 11, 2017 9:57 pm
by Tayruu
I ran into this problem myself, and I'm pretty sure it's a bug too. self.from_current = from_current is in 00action_control, and is even referenced in this documentation (distinct from this one??), but it doesn't appear to do anything. Adding from_current=False to my Call() nothing.

Commenting the line out of the core code fixed it. (Which, yes, is a bad move, but...)

Re: Unable to call label with button NameError: global name 'from_current' is not defined

Posted: Tue Dec 12, 2017 10:41 pm
by pokestat
Has this been confirmed as a bug? I've experienced this issue too.

Re: Unable to call label with button NameError: global name 'from_current' is not defined

Posted: Wed Dec 13, 2017 1:31 pm
by RicharDann
I was going to start a new thread about this but I see now I'm not the only one experiencing this. For now I'm temporarily using the renpy.call function directly:

Code: Select all

action Function(renpy.call, 'a_label', from_current=False)
But I hope Call() is fixed in next stable release, I do need to call labels from a screen and Call('a_label') is more readable and easier to type that my current setup.

Re: Unable to call label with button NameError: global name 'from_current' is not defined

Posted: Wed Dec 13, 2017 7:25 pm
by trooper6
In order for it to be fixed, you would need to let PyTom know it's a problem. I recommend one of you all struggling with this make a post in the Development thread.

Re: Unable to call label with button NameError: global name 'from_current' is not defined

Posted: Thu Dec 14, 2017 2:02 am
by pokestat
Posted on Dev thread: viewtopic.php?f=8&t=47009