[Bug] ??? call x not working, call expression x works

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
ISAWHIM
Veteran
Posts: 284
Joined: Sun Nov 06, 2016 5:34 pm
Contact:

[Bug] ??? call x not working, call expression x works

#1 Post by ISAWHIM » Sat Dec 14, 2019 5:14 pm

I am trying to create a dynamic loop, which "calls" a label by a "variable" ($ x = test).

This works, if I use the "expression" keyword... as it expects the "label ID" to be in quotes. So, the variable is essentially "test", where I say...
call expression x pass (count = 3)

However, I can't get this to work, without the inclusion of the "expression" keyword. Thus, this fails...
call x

Script error: Could not find label 'x'

Naturally, I know that "call" expects a label-ID without quotes, which is similar to "pass by reff/pointer", but I don't know how to do that. Honestly, it should work with a direct "reff/pointer", as well as a "string". But, then again, so should the use of the call with the "expression" keyword.

So, if this is not a "bug", then how would I manage this specific use of "call" and "label". (Adding a note to the help files may solve a few issues, if there is only one specific way to do this. Having each variant of the same exact "call" statement, is kind-of a hindrance.)

RAW CODE:

Code: Select all

label test:
    "TEST JUMP"
    $ x = "id_0"
    call expression x pass (count = 3)
    "END 1"
    call x
    "END 2"
    return
    
label id_0(count=1):
    "ID 0: Some text [count]"
    return
Note to self... Can not have a label named "expression"... (Also annoying, because that is a common word used in visual novels, which might want to be used for jumping to a characters expression. :P)

Honestly, in the future, I would set it up as just one format, which handles both "quoted_text", or variables. The word "expression", being removed. If there is a "(" following the label-ID, that is obviously an expression, which should be optional. As opposed to making two individual uses of the same function "call", which do not operate in similar ways and have specific, unique demands to operate them.

EG... (Expected use. Would also remove the redundant need of the extra "help listing" for using "expression", with call.)
Instead of this...
call expression "shoe" (frog = 1)

We "expect" this...
$x = "shoe"
call x
call "shoe"
call x (frog = 1)
call "shoe" (frog = 1)


Should all function the same way. Just one actually has the optional "expression" to pass.

Just as you use "label", which is "expected".
label test:
label test (frog = 1):


Both are variants of the same command...
We don't use...
label expression "test" (frog = 1):
Last edited by ISAWHIM on Sat Dec 14, 2019 6:12 pm, edited 1 time in total.

User avatar
ISAWHIM
Veteran
Posts: 284
Joined: Sun Nov 06, 2016 5:34 pm
Contact:

Re: [Bug] ??? call x not working, call expression x works

#2 Post by ISAWHIM » Sat Dec 14, 2019 5:43 pm

Figured it out...

I need to use this python-variant. (Oddly, the "RenPy" counterpart code should work the same way, but it doesn't.)

$renpy.call (x)

The "RenPy" counterpart, which doesn't work, is this...
call x
or
call (x)

So, it's a bug, that it doesn't work, or it's by design. However, it is a confusing design that can be changed to become less confusing. Please consider the suggestion in the prior post, to make it function as expected. Also, to remove and simplify the need to have "expression", and the odd format of the secondary-use of the same "call" statement revised to match the base "call" statement, so it is all just one singular statement "call", with the "optional" parts, as 90% of the other code has been written and functions.

Thank-you. :)

P.S. You should merge, or at-least link to, the "python variants", of the same functions, in the help files. Some can be assumed, but some are just non-intuitive and have to be googled, which is annoying, as it takes you to a giant page of all commands, where you have to hunt for an individual command, that you have no idea what it is.
Last edited by ISAWHIM on Sat Dec 14, 2019 6:12 pm, edited 1 time in total.

User avatar
Alex
Lemma-Class Veteran
Posts: 2379
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: [Bug] ??? call x not working, call expression x works

#3 Post by Alex » Sat Dec 14, 2019 6:05 pm

ISAWHIM wrote:
Sat Dec 14, 2019 5:14 pm
...
Well, this is the Ren'Py script language, so statements (like jump, call, show, etc.) are expect the name of the label / displayable. And this name shouldn't have quotation marks (that's how they are made). But if you need to use a variable instead of the real name, you should use additional 'expression' statement to tell engine that it should treat the folowing text as a text string if it's in quotes and as a variable otherwise.
https://www.renpy.org/doc/html/label.ht ... -statement

Code: Select all

$ img = 'eileen happy'
show eileen normal
show expression img

$ label_name_var = "my_label"
call my_label
call expression label_name_var
call expression "my_label"
There's a number of reserved words that shouldn't be used as variables and all (shouldn't be redefined) - https://www.renpy.org/doc/html/reserved.html
The 'expression' is not among those words, but using it as the name of label will confuse the engine...)) You can use underscore in the label names, so it wouldn't be hard to make

Code: Select all

label expression_:

Post Reply

Who is online

Users browsing this forum: Google [Bot]