Problem with choices

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
RenGames69
Newbie
Posts: 17
Joined: Sat Sep 12, 2020 12:59 pm
Contact:

Problem with choices

#1 Post by RenGames69 »

Hi, I have a problem with simple choices. I have a 3 choices which after making them should show different pictures, but when I define them and then choose one of them it shows all of the pictures at once. How to separate them? I define them all as False, then I try 1 False, 2 True and 3...? dont know.

Can someone please change my code to get it working, I mean defining, and then menu

here's the code


default pws = True
default gop = True
default rct = True


menu:

"Alright, It's time to choose some nice lingerie"

"Purple with stockings":
$ pws = True
jump continue


"Grey one piece":
jump continue

"Red C Thru":
jump continue


label continue:


if pws:
show pwspicture at right

if gop:
show goppicture at right

if rct:
show rctpicture at right

"And here it shows all of them at once"

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Problem with choices

#2 Post by rayminator »

would do it this way it better

Code: Select all

default pws = 0
default gop = 0
default rct = 0


menu:

"Alright, It's time to choose some nice lingerie"

"Purple with stockings":
$ pws = 1
jump continue


"Grey one piece":
jump continue

"Red C Thru":
jump continue


label continue:


if pws == 0:
show pwspicture at right

if gop == 0:
show goppicture at right

if rct == 0:
show rctpicture at right

RenGames69
Newbie
Posts: 17
Joined: Sat Sep 12, 2020 12:59 pm
Contact:

Re: Problem with choices

#3 Post by RenGames69 »

After i made choice I get this

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/club.rpy", line 554, in script
    if rct == 0:
  File "game/club.rpy", line 554, in <module>
    if rct == 0:
NameError: name 'rct' is not defined

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

Full traceback:
  File "game/club.rpy", line 554, in script
    if rct == 0:
  File "C:\Users\awena\Documents\renpy-7.3.5-sdk\renpy\ast.py", line 1832, in execute
    if renpy.python.py_eval(condition):
  File "C:\Users\awena\Documents\renpy-7.3.5-sdk\renpy\python.py", line 2059, in py_eval
    return py_eval_bytecode(code, globals, locals)
  File "C:\Users\awena\Documents\renpy-7.3.5-sdk\renpy\python.py", line 2052, in py_eval_bytecode
    return eval(bytecode, globals, locals)
  File "game/club.rpy", line 554, in <module>
    if rct == 0:
NameError: name 'rct' is not defined

Windows-8-6.2.9200
Ren'Py 7.3.5.606
 0.1
Tue Sep 22 15:24:23 2020

RenGames69
Newbie
Posts: 17
Joined: Sat Sep 12, 2020 12:59 pm
Contact:

Re: Problem with choices

#4 Post by RenGames69 »

I don't know why script don't want to define "rct" word

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Problem with choices

#5 Post by rayminator »

change the zero into 1's my mistake

Code: Select all

if pws == 0:
if gop == 0:
if rct == 0:

RenGames69
Newbie
Posts: 17
Joined: Sat Sep 12, 2020 12:59 pm
Contact:

Re: Problem with choices

#6 Post by RenGames69 »

It's really close, but still something missing. The 1st choice is working fine, but when I chose 2 or 3 it's not displaying image. It's 100% something with code, because those images are working everywere else in the script.

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Problem with choices

#7 Post by rayminator »

it cause you forgot to add these to the other menus

Code: Select all

$ gop = 1

Code: Select all

$ rct = 1

RenGames69
Newbie
Posts: 17
Joined: Sat Sep 12, 2020 12:59 pm
Contact:

Re: Problem with choices

#8 Post by RenGames69 »

It's working! Thank you very much. You're very helpful.

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]