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

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
asta128
Newbie
Posts: 8
Joined: Sun Dec 10, 2017 11:56 am

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

#1 Post by asta128 »

deleted
Last edited by asta128 on Thu Nov 01, 2018 5:26 pm, edited 1 time in total.

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: Unable to call label with button NameError: global name 'from_current' is not defined

#2 Post 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.
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

asta128
Newbie
Posts: 8
Joined: Sun Dec 10, 2017 11:56 am

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

#3 Post by asta128 »

deleted
Last edited by asta128 on Thu Nov 01, 2018 5:26 pm, edited 1 time in total.

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: Unable to call label with button NameError: global name 'from_current' is not defined

#4 Post 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.
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

asta128
Newbie
Posts: 8
Joined: Sun Dec 10, 2017 11:56 am

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

#5 Post by asta128 »

deleted
Last edited by asta128 on Thu Nov 01, 2018 5:26 pm, edited 1 time in total.

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: Unable to call label with button NameError: global name 'from_current' is not defined

#6 Post 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.
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
Tayruu
Regular
Posts: 141
Joined: Sat Jul 05, 2014 7:57 pm

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

#7 Post 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...)

pokestat
Newbie
Posts: 6
Joined: Tue Dec 12, 2017 12:54 pm
Contact:

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

#8 Post by pokestat »

Has this been confirmed as a bug? I've experienced this issue too.

User avatar
RicharDann
Veteran
Posts: 286
Joined: Thu Aug 31, 2017 11:47 am
Contact:

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

#9 Post 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.
The most important step is always the next one.

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: Unable to call label with button NameError: global name 'from_current' is not defined

#10 Post 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.
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: AWizardWithWords, Google [Bot]