Jump statement not working with arguments?

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
unicodepepper
Newbie
Posts: 7
Joined: Tue Nov 15, 2016 11:17 am
Contact:

Jump statement not working with arguments?

#1 Post by unicodepepper » Fri Jan 20, 2017 9:41 pm

I was going to place this in the bug replication section, but first I wanted to make sure this wasn't a feature instead. Let's look at an example code:

Code: Select all

label example:
    call pick("paper")     #works flawlessly
    jump pick("paper")     #causes an exception
    return

label pick(object="stone"):
    "I picked up the [object]"
    return

In the above code, what I'd expect is to pick a paper, then pick another paper, then go back to the main menu. However, the jump statement says that it expected a newline right over the opening parentheses. If that line is commented, the code runs smoothly. Does anyone have any idea why is that, and any tips or alternatives to solve it? I'm using ren'py 6.99.7.858, if that helps about something. Thanks in advance!

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

Re: Jump statement not working with arguments?

#2 Post by Imperf3kt » Fri Jan 20, 2017 10:09 pm

You have no "paper" to pick... I only see "stone"

Did you put return at the end of paper as you did with "stone"?

All I can think of here, is you're jumping to the label "example", and then instantly jumping to another label.
You should change that so there's some kind of user-interaction between the jumps.
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter

philat
Eileen-Class Veteran
Posts: 1692
Joined: Wed Dec 04, 2013 12:33 pm
Contact:

Re: Jump statement not working with arguments?

#3 Post by philat » Sat Jan 21, 2017 12:15 am

Looking at the documentation, it doesn't seem like jumping with parameters is intended. (Call explicitly mentions parameters, jump does not.) Not sure why though. Might be worth raising with PyTom if you'd like. https://www.renpy.org/doc/html/label.ht ... -statement

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

Re: Jump statement not working with arguments?

#4 Post by nyaatrap » Sat Jan 21, 2017 12:59 am

If you go to (jump to) another line of the code, you can't tell its scope is local or global. It'll share the same global scope, so arguments become meaningless. In that's case, the following would do the same thing.

Code: Select all

jump label(x=1)

$x=1
jump label
You shouldn't use a same label for both call and jump. If you jump to a label that has the return statement, it leads to the main menu.

Post Reply

Who is online

Users browsing this forum: Sunlit-Dreamer