Certain name reactions??
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.
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.
-
- Newbie
- Posts: 13
- Joined: Sat Feb 03, 2018 11:17 pm
- Contact:
Certain name reactions??
Uh, I need help on how to make a certain name have different kinds of outcomes like, if the MC's name is Violet, then the name colour turns purple??
And I need a way to have a character react to a certain name? Because I've been trying to put 'if name' and all that stuff but nothing has been working :/
And I need a way to have a character react to a certain name? Because I've been trying to put 'if name' and all that stuff but nothing has been working :/
- wyverngem
- Miko-Class Veteran
- Posts: 615
- Joined: Mon Oct 03, 2011 7:27 pm
- Completed: Simple as Snow, Lady Luck's Due,
- Projects: Aether Skies, Of the Waterfall
- Tumblr: casting-dreams
- itch: castingdreams
- Location: USA
- Contact:
Re: Certain name reactions??
Code: Select all
default mc_name = "Violet"
default name_color = "#FFF"
define mc = Character("[mc_name]", who_color=name_color)
label start:
if mc_name == "Violet":
$ name_color = "8300FF"
"Your name is [mc_name]. That's like the color purple right?"
else:
"It's nice to meet you [mc_name]."
Last edited by wyverngem on Thu Mar 01, 2018 12:27 am, edited 1 time in total.
-
- Newbie
- Posts: 13
- Joined: Sat Feb 03, 2018 11:17 pm
- Contact:
Re: Certain name reactions??
I tried it out, but it didn't seem to work.wyverngem wrote: ↑Wed Feb 28, 2018 9:21 pmI haven't tested the name_color, but it should work for you.Code: Select all
default mc_name = "Violet" default name_color = "#FFF" define mc = Character("[mc_name]", color=name_color) label start: if mc_name == Violet: $ name_color = "8300FF" "Your name is [mc_name]. That's like the color purple right?" else: "It's nice to meet you [mc_name]."
- trooper6
- Lemma-Class Veteran
- Posts: 3712
- Joined: Sat Jul 09, 2011 10:33 pm
- Projects: A Close Shave
- Location: Medford, MA
- Contact:
Re: Certain name reactions??
Should be who_color not color. If you want to change the color of the text, that would be what_color.
Also, if that doesn't work, post your code.
Also, if that doesn't work, post your code.
A Close Shave:
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
*Last Thing Done (Aug 17): Finished coding emotions and camera for 4/10 main labels.
*Currently Doing: Coding of emotions and camera for the labels--On 5/10
*First Next thing to do: Code in all CG and special animation stuff
*Next Next thing to do: Set up film animation
*Other Thing to Do: Do SFX and Score (maybe think about eye blinks?) Check out My Clock Cookbook Recipe: http://lemmasoft.renai.us/forums/viewto ... 51&t=21978
-
- Newbie
- Posts: 13
- Joined: Sat Feb 03, 2018 11:17 pm
- Contact:
Re: Certain name reactions??
Code: Select all
default name = "Wyvern"
default name_color = "#585858"
define mc = Character("[name]", color="who_color")
It keeps saying that "who_color" is invalid.
- Milkymalk
- Miko-Class Veteran
- Posts: 753
- Joined: Wed Nov 23, 2011 5:30 pm
- Completed: Don't Look (AGS game)
- Projects: KANPEKI! ★Perfect Play★
- Organization: Crappy White Wings
- Location: Germany
- Contact:
Re: Certain name reactions??
Try:
name and name_color are variables (containers for data). Anything inside " " is data (string data, to be exact). So if you write "name", the computer understands exactly that - "name". If you write name without " ", the computer understands whatever the content of the variable name is.
Code: Select all
default name = "Wyvern"
default name_color = "#585858"
define mc = Character(name, who_color=name_color)
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)
-
- Newbie
- Posts: 13
- Joined: Sat Feb 03, 2018 11:17 pm
- Contact:
Re: Certain name reactions??
Okay, I've tried out the code, but it seems to have said 'invalid syntax' ?Milkymalk wrote: ↑Wed Feb 28, 2018 11:54 pm Try:name and name_color are variables (containers for data). Anything inside " " is data (string data, to be exact). So if you write "name", the computer understands exactly that - "name". If you write name without " ", the computer understands whatever the content of the variable name is.Code: Select all
default name = "Wyvern" default name_color = "#585858" define mc = Character(name, who_color=name_color)
- Milkymalk
- Miko-Class Veteran
- Posts: 753
- Joined: Wed Nov 23, 2011 5:30 pm
- Completed: Don't Look (AGS game)
- Projects: KANPEKI! ★Perfect Play★
- Organization: Crappy White Wings
- Location: Germany
- Contact:
Re: Certain name reactions??
Are you sure the 'invalid syntax' is in these lines? What does the error message say?
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)
- wyverngem
- Miko-Class Veteran
- Posts: 615
- Joined: Mon Oct 03, 2011 7:27 pm
- Completed: Simple as Snow, Lady Luck's Due,
- Projects: Aether Skies, Of the Waterfall
- Tumblr: casting-dreams
- itch: castingdreams
- Location: USA
- Contact:
Re: Certain name reactions??
Can you post the full error log please? I was a little tired when I replied sorry. @trooper6 This is the error I get when I have the code as this:
Silly me this code works fine with the right number of hex digit colors. The only issues is that I'm seeing the same thing. No error, but it doesn't change the color.
If it's written like this the error goes like this:
I really thought you could change it based on the name.
Code: Select all
init:
$ nameColor = "#FFFFFF"
default mc_name = "Violet"
define v = Character("[mc_name]", who_color=nameColor)
label start:
v "I I work"
if mc_name == "Violet":
$ name_color = "#8300F"
v"Your name is [mc_name]. That's like the color purple right?"
else:
v "It's nice to meet you [mc_name]."
If it's written like this the error goes like this:
Code: Select all
default nameColor = "#FFFFF"
default mc_name = "Violet"
define v = Character("[mc_name]", who_color=nameColor)
label start:
v "I I work"
if mc_name == "Violet":
$ name_color = "#8300F"
v"Your name is [mc_name]. That's like the color purple right?"
else:
v "It's nice to meet you [mc_name]."
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 4, in script
define v = Character("[mc_name]", who_color=nameColor)
File "game/script.rpy", line 4, in <module>
define v = Character("[mc_name]", who_color=nameColor)
NameError: name 'nameColor' is not defined
-
- Newbie
- Posts: 13
- Joined: Sat Feb 03, 2018 11:17 pm
- Contact:
Re: Certain name reactions??
here's the full error logwyverngem wrote: ↑Thu Mar 01, 2018 12:25 am Can you post the full error log please? I was a little tired when I replied sorry. @trooper6 This is the error I get when I have the code as this:
Silly me this code works fine with the right number of hex digit colors. The only issues is that I'm seeing the same thing. No error, but it doesn't change the color.Code: Select all
init: $ nameColor = "#FFFFFF" default mc_name = "Violet" define v = Character("[mc_name]", who_color=nameColor) label start: v "I I work" if mc_name == "Violet": $ name_color = "#8300F" v"Your name is [mc_name]. That's like the color purple right?" else: v "It's nice to meet you [mc_name]."
If it's written like this the error goes like this:
Code: Select all
default nameColor = "#FFFFF" default mc_name = "Violet" define v = Character("[mc_name]", who_color=nameColor) label start: v "I I work" if mc_name == "Violet": $ name_color = "#8300F" v"Your name is [mc_name]. That's like the color purple right?" else: v "It's nice to meet you [mc_name]."
I really thought you could change it based on the name.Code: Select all
I'm sorry, but an uncaught exception occurred. While running game code: File "game/script.rpy", line 4, in script define v = Character("[mc_name]", who_color=nameColor) File "game/script.rpy", line 4, in <module> define v = Character("[mc_name]", who_color=nameColor) NameError: name 'nameColor' is not defined
Code: Select all
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 37, in script
if name == "Violet":
File "game/script.rpy", line 37, in <module>
if name == "Violet":
NameError: name 'name' is not defined
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "game/script.rpy", line 37, in script
if name == "Violet":
File "C:\Users\wolfe\Downloads\renpy-6.99.12.4-sdk\renpy\ast.py", line 1702, in execute
if renpy.python.py_eval(condition):
File "C:\Users\wolfe\Downloads\renpy-6.99.12.4-sdk\renpy\python.py", line 1843, in py_eval
return py_eval_bytecode(code, globals, locals)
File "C:\Users\wolfe\Downloads\renpy-6.99.12.4-sdk\renpy\python.py", line 1836, in py_eval_bytecode
return eval(bytecode, globals, locals)
File "game/script.rpy", line 37, in <module>
if name == "Violet":
NameError: name 'name' is not defined
Windows-8-6.2.9200
Ren'Py 6.99.14.1.3218
Wed Feb 28 20:52:05 2018
- 78909087
- Veteran
- Posts: 277
- Joined: Sat Aug 16, 2014 2:33 pm
- Completed: Dungeons and Don't Do It, Wake Up
- Projects: Lethe
- IRC Nick: Pacermist
- Contact:
Re: Certain name reactions??
That last error shows that the code is referring to an undefined variable "name".
In the code that has been posted, the variables are all called mc_name. Try changing the "name" variable in line 37 to mc_name and see if it works.
In the code that has been posted, the variables are all called mc_name. Try changing the "name" variable in line 37 to mc_name and see if it works.
-
- Newbie
- Posts: 13
- Joined: Sat Feb 03, 2018 11:17 pm
- Contact:
Re: Certain name reactions??
I tried changing those, but it didn't seem to be the problem?
This is the error log
Code: Select all
I'm sorry, but errors were detected in your script. Please correct the
errors listed below, and try again.
File "game/script.rpy", line 48: invalid syntax
$ name_color = "#013ADF"
^
Ren'Py Version: Ren'Py 6.99.14.1.3218
Thu Mar 01 07:21:50 2018
- 78909087
- Veteran
- Posts: 277
- Joined: Sat Aug 16, 2014 2:33 pm
- Completed: Dungeons and Don't Do It, Wake Up
- Projects: Lethe
- IRC Nick: Pacermist
- Contact:
Re: Certain name reactions??
Could you PM me your code? I'll have a look through it.
- Milkymalk
- Miko-Class Veteran
- Posts: 753
- Joined: Wed Nov 23, 2011 5:30 pm
- Completed: Don't Look (AGS game)
- Projects: KANPEKI! ★Perfect Play★
- Organization: Crappy White Wings
- Location: Germany
- Contact:
Re: Certain name reactions??
Code: Select all
File "game/script.rpy", line 48: invalid syntax
$ name_color = "#013ADF"
^
Crappy White Wings (currently quite inactive)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)
Working on: KANPEKI!
(On Hold: New Eden, Imperial Sea, Pure Light)
-
- Newbie
- Posts: 13
- Joined: Sat Feb 03, 2018 11:17 pm
- Contact:
Re: Certain name reactions??
Yeah, it is, but I removed the $ and it still showed up with an errorMilkymalk wrote: ↑Thu Mar 01, 2018 3:47 pmIs this by chance inside a python block? You only need a $ in front of a line of code if it's outside of a python block and it's not a renpy script keyword.Code: Select all
File "game/script.rpy", line 48: invalid syntax $ name_color = "#013ADF" ^
Who is online
Users browsing this forum: DewyNebula