【问题标题】:Ren'Py - If Elif Dialogue StatementRen\'Py - If Elif 对话声明
【发布时间】:2023-01-03 19:32:16
【问题描述】:

我的代码:

if $ nice_dec4 = true:
    a "Last night, was fantastic, I.."
    
    a "Needed it."
elif $ mean_dec4 = true:
    a "Hey.."

    a "I was wondering if.."

    a "Nevermind."

    b "NO!"

    b "Could I.. stay over?"

    show sloane tired school

    a "Why would you lie to me..?"

    a "Why do you hit the mouse button like this isn't my life."

    a "Why don't you care.. anymore?"

    a "Come back soon,"

    a "{b}{i}Darling."

回溯如下:

[code]
I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 712, in script
    if $ nice_dec4 = true:
SyntaxError: invalid syntax (script.rpy, line 712)

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/script.rpy", line 712, in script
    if $ nice_dec4 = true:
  File "/Users/NAME/Desktop/renpy-8.0.1-sdk/renpy/ast.py", line 2115, in execute
    if renpy.python.py_eval(condition):
  File "/Users/NAME/Desktop/renpy-8.0.1-sdk/renpy/python.py", line 1081, in py_eval
    code = py_compile(code, 'eval')
  File "/Users/NAME/Desktop/renpy-8.0.1-sdk/renpy/python.py", line 1018, in py_compile
    raise e
  File "/Users/NAME/Desktop/renpy-8.0.1-sdk/renpy/python.py", line 970, in py_compile
    raise orig_e
  File "/Users/NAME/Desktop/renpy-8.0.1-sdk/renpy/python.py", line 963, in py_compile
    tree = compile(source, filename, py_mode, ast.PyCF_ONLY_AST | flags, 1)
SyntaxError: invalid syntax (script.rpy, line 712)

macOS-10.16-x86_64-i386-64bit x86_64
Ren'Py 8.0.2.22081402
Me And Sloane 1.2
Sun Dec  4 15:33:04 2022
[/code]

我希望代码会根据我之前让玩家做出的决定而改变,但我得到的只是这个错误。

忽视 - - - - - - - - - - - - - - - - - - - - - - - - - --------------

“看起来您的帖子主要是代码;请添加更多详细信息”: mabklwglabd,jagdwlvgkulygwdvg agwlgd。 w gdwilyavjkdfwvakuwdmvawwhmgwa,fywdjgcwfuwgcmhv aw,vw j, dwa dfldf,vdwm kw amvwdjawf wdlva;hwjha.,mww

【问题讨论】:

    标签: renpy


    【解决方案1】:

    在 Ren'Py 中使用 if/elif 运算符时,不需要使用 $ 符号。

    if nice_dec4 = true:
        a "Last night, was fantastic, I.."
        a "Needed it."
    
    elif mean_dec4 = true:
        a "Hey.."
        a "I was wondering if.."
    

    $ 符号用于定义变量。例如,$ var1 = True

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-12-03
      • 1970-01-01
      • 1970-01-01
      • 2022-10-07
      • 1970-01-01
      • 2018-03-23
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多