Correct "call expression" use?

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
denzil
Veteran
Posts: 293
Joined: Wed Apr 20, 2005 4:01 pm
Contact:

Correct "call expression" use?

#1 Post by denzil »

When I use:

Code: Select all

    call test ("someparameter")
    # or
    $ tmp = "test"
    call expression tmp
everything seems to work as it's supposed to. But when I try to combine these two:

Code: Select all

    call expression test ("someparameter")
    # also tried:
    call expression test ("someparameter") from some_random_label
then the game crashes with error: TypeError: 'str' object is not callable
Am I doing something wrong here, or is it RenPy error?
Attachments
traceback.txt
(980 Bytes) Downloaded 94 times
Practice makes purrrfect.
Finished projects: Broken sky .:. colorless day .:. and few more...

User avatar
PyTom
Ren'Py Creator
Posts: 16096
Joined: Mon Feb 02, 2004 10:58 am
Completed: Moonlight Walks
Projects: Ren'Py
IRC Nick: renpytom
Github: renpytom
itch: renpytom
Location: Kings Park, NY
Contact:

Re: Correct "call expression" use?

#2 Post by PyTom »

What's going on here has to do with the definition of a simple_expression, and how parsing works.
According to the reference manual:
Reference Manual wrote: A simple_expression is a Python expression that starts with a name, a string, or any Python expression in parentheses. This may be followed by any number of the following:
* A dot followed by a name.
* A parenthesized python expression.
The problem here is that the parsing of a simple_expression is taking precedence over parsing the argument list. Basically, when you write:

call expression test ("someparameter")

it's being parsed as:

call expression (test("someparameter"))

which obviously crashes. I've fixed this so that one will be able to write:

call expression test pass ("someparameter")

which will resolve this ambiguity.

This change will be in the 6.10.2b release.
Supporting creators since 2004
(When was the last time you backed up your game?)
"Do good work." - Virgil Ivan "Gus" Grissom
Software > Drama • https://www.patreon.com/renpytom

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Dark79, Google [Bot], Majestic-12 [Bot]