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.
-
chesarty
- Regular
- Posts: 116
- Joined: Sat Aug 25, 2018 3:07 am
- Completed: 0
-
Contact:
#1
Post
by chesarty » Thu Sep 02, 2021 4:49 pm
So... any clue why this code doesn't work? It runs but the game still reads $major as "none" rather than any of the options.
the definitions:
Code: Select all
$ journalism = False
$ finearts = False
$ accounting = False
$ philospohy = False
$ compsci = False
$ major = "none"
if journalism = True:
$major = "Journalism"
elif finearts = True:
$major = "Fine Arts"
elif accounting = True:
$major = "Accounting"
elif philospohy = True:
$major = "Philosophy"
elif compsci = True:
$major = "Computer science"
the script:
Code: Select all
menu:
"Journalism":
$journalism=True
"Fine arts":
$finearts=True
"Accounting":
$accounting=True
"Philosophy":
$philosophy=True
"Computer science":
$compsci=True
mc "It's [major]. Boring, I know."
-
Ocelot
- Eileen-Class Veteran
- Posts: 1883
- Joined: Tue Aug 23, 2016 10:35 am
- Github: MiiNiPaa
- Discord: MiiNiPaa#4384
-
Contact:
#2
Post
by Ocelot » Thu Sep 02, 2021 5:01 pm
if journalism = True: → if journalism == True:
Same with others.
Also in your script there is nothing to change value of major after menu selection.
< < insert Rick Cook quote here > >
-
rayminator
- Miko-Class Veteran
- Posts: 754
- Joined: Fri Feb 09, 2018 12:05 am
- Location: Canada
-
Contact:
#3
Post
by rayminator » Thu Sep 02, 2021 5:04 pm
here is your problem
either you use default or a init to define your variable it would be best to use default
Code: Select all
default journalism = False
or
outside of a any label
init:
$ journalism = False
Code: Select all
$ journalism = False
$ finearts = False
$ accounting = False
$ philospohy = False
$ compsci = False
and with these that are not spaced out the same way you defined the variables
Code: Select all
menu:
"Journalism":
$journalism=True < need to be spaced out the same way as the defined variable
"Fine arts":
$finearts=True < need to be spaced out the same way as the defined variable
"Accounting":
$accounting=True < need to be spaced out the same way as the defined variable
"Philosophy":
$philosophy=True < need to be spaced out the same way as the defined variable
"Computer science":
$compsci=True < need to be spaced out the same way as the defined variable
and the same for this
Code: Select all
if journalism = True:
$major = "Journalism" < need to be spaced out the same way as the defined variable
elif finearts = True:
$major = "Fine Arts" < need to be spaced out the same way as the defined variable
elif accounting = True:
$major = "Accounting" < need to be spaced out the same way as the defined variable
elif philospohy = True:
$major = "Philosophy" < need to be spaced out the same way as the defined variable
elif compsci = True:
$major = "Computer science" < need to be spaced out the same way as the defined variable
Users browsing this forum: Bing [Bot]