Certain name reactions??

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.
Message
Author
User avatar
Imperf3kt
Lemma-Class Veteran
Posts: 2977
Joined: Mon Dec 14, 2015 5:05 am
Location: Your monitor
Contact:

Re: Certain name reactions??

#16 Post by Imperf3kt » Thu Mar 01, 2018 6:50 pm

Your variables don't match. I made a small adjustment:

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":
        $ nameColor = "#8300F"
        v"Your name is [mc_name]. That's like the color purple right?"
    else:
        v "It's nice to meet you [mc_name]."
But personally, I think you are going about this backwards. For instance, when / how does the player input their name is "Violet"?
Warning: May contain trace amounts of gratuitous plot.
pro·gram·mer (noun) An organism capable of converting caffeine into code.

Twitter
Imperf3kt Blackjack - a WIP blackjack game for Android made using Ren'Py
Free Android GUI - Updated occasionally

LazyLycanthrope
Newbie
Posts: 13
Joined: Sat Feb 03, 2018 11:17 pm
Contact:

Re: Certain name reactions??

#17 Post by LazyLycanthrope » Thu Mar 01, 2018 11:21 pm

Imperf3kt wrote:
Thu Mar 01, 2018 6:50 pm
Your variables don't match. I made a small adjustment:

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":
        $ nameColor = "#8300F"
        v"Your name is [mc_name]. That's like the color purple right?"
    else:
        v "It's nice to meet you [mc_name]."
But personally, I think you are going about this backwards. For instance, when / how does the player input their name is "Violet"?
I tried it, but it just had this error?

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 50: invalid syntax
        $ nameColor = "#8258FA"
         ^
    

Ren'Py Version: Ren'Py 6.99.14.1.3218
Thu Mar 01 19:18:42 2018
And it doesn't work even if I remove the $ ??
Also, I already had some code for when the player inputs their name

Code: Select all

  python:
        mc_name = renpy.input("What was it again?")
        mc_name = mc_name.strip()
        if not mc_name:
            mc_name = "Wyvern"
        if mc_name == "Violet":
            $ nameColor = "#8258FA"
            mc "My name is [mc_name], like the color."
        else:
            mc "Oh. My name is [mc_name]."

User avatar
wyverngem
Miko-Class Veteran
Posts: 613
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??

#18 Post by wyverngem » Fri Mar 02, 2018 1:12 am

Umm, I think you may need to read up a little more on the coding part. Just check out the documentation and The Question code. Spacing is very important in Python if you have extra spaces it won't read properly. Your error was because there was an extra space between the $ and the variable name.

The code posted above works within a label. When you write under the label you need to place at $ in front of it. Take the python bit out and put it under a label and you shouldn't get any errors as long as you add back in your $ and properly space it. It then should work.

User avatar
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??

#19 Post by 78909087 » Fri Mar 02, 2018 9:44 am

After a while messing around before the light dawned on me, I discovered this thread...

I decided to respond to this query rather than PM so that others can find the answer later, too.

In short;
You cannot assign a variable to a style. However, there is a simple workaround, which leaves you with this code.

Code: Select all

define mc = Character("{color=[color_var]}[mc_name]{/color}")
define color_var = "#000000"
default mc_name = "Wyvern"

label start:
    define config.has_autosave = True
    scene beddark with fade
    $ health = 100
    show screen health
    play music "Backbay Lounge.mp3"


    "..Gah... What time is it..??"
    "I look over to my alarm clock. It's 3 AM."
    "Wait- darn diddly dang it! Did I just forget my own name!?"

    $ mc_name = renpy.input("What was it again?")
    $ mc_name = mc_name.strip()
    if not mc_name:
        $ mc_name = "Wyvern"
    if mc_name == "Violet":
        $ color_var = "#8258FA"
        mc "My name is [mc], like the color."
    else:
        mc "Oh. My name is [mc]."
Take the dynamic MC name and add the color text tag around the square brackets in the quotes.

This will change the [mc] you call in any following text to this same color, so beware... But I think that's a cool feature of it's own.

Try this out and see what you think. I tested it in my own code, and it works.
I am not friends with the sun.
Image

LazyLycanthrope
Newbie
Posts: 13
Joined: Sat Feb 03, 2018 11:17 pm
Contact:

Re: Certain name reactions??

#20 Post by LazyLycanthrope » Fri Mar 02, 2018 11:20 am

78909087 wrote:
Fri Mar 02, 2018 9:44 am
After a while messing around before the light dawned on me, I discovered this thread...

I decided to respond to this query rather than PM so that others can find the answer later, too.

In short;
You cannot assign a variable to a style. However, there is a simple workaround, which leaves you with this code.

Code: Select all

define mc = Character("{color=[color_var]}[mc_name]{/color}")
define color_var = "#000000"
default mc_name = "Wyvern"

label start:
    define config.has_autosave = True
    scene beddark with fade
    $ health = 100
    show screen health
    play music "Backbay Lounge.mp3"


    "..Gah... What time is it..??"
    "I look over to my alarm clock. It's 3 AM."
    "Wait- darn diddly dang it! Did I just forget my own name!?"

    $ mc_name = renpy.input("What was it again?")
    $ mc_name = mc_name.strip()
    if not mc_name:
        $ mc_name = "Wyvern"
    if mc_name == "Violet":
        $ color_var = "#8258FA"
        mc "My name is [mc], like the color."
    else:
        mc "Oh. My name is [mc]."
Take the dynamic MC name and add the color text tag around the square brackets in the quotes.

This will change the [mc] you call in any following text to this same color, so beware... But I think that's a cool feature of it's own.

Try this out and see what you think. I tested it in my own code, and it works.
I tried it out, and I got another syntax error?

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 46: invalid syntax
    $ mc_name = renpy.input("What was it again?")
     ^
    

Ren'Py Version: Ren'Py 6.99.14.1.3218
Fri Mar 02 07:19:20 2018
here's what the python code looks like:

Code: Select all

 python:
        $ mc_name = renpy.input("What was it again?")
        $ mc_name = mc_name.strip()
        if not mc_name:
            $ mc_name = "Wyvern"
        if mc_name == "Violet":
            $ color_var = "#8258FA"
            mc "My name is [mc_name], like the color."
        else:
            mc "Oh. My name is [mc_name]."

User avatar
trooper6
Lemma-Class Veteran
Posts: 3706
Joined: Sat Jul 09, 2011 10:33 pm
Projects: A Close Shave
Location: Medford, MA
Contact:

Re: Certain name reactions??

#21 Post by trooper6 » Fri Mar 02, 2018 11:35 am

None of that should be in a python block. If you notice the code 78909087 provided none of that was in a python block, just regularly in a label.
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

User avatar
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??

#22 Post by 78909087 » Fri Mar 02, 2018 11:37 am

To add to what Trooper6 said, I believe the $ is a call for python, like a small "python:" for each line.
I am not friends with the sun.
Image

LazyLycanthrope
Newbie
Posts: 13
Joined: Sat Feb 03, 2018 11:17 pm
Contact:

Re: Certain name reactions??

#23 Post by LazyLycanthrope » Fri Mar 02, 2018 11:57 am

trooper6 wrote:
Fri Mar 02, 2018 11:35 am
None of that should be in a python block. If you notice the code 78909087 provided none of that was in a python block, just regularly in a label.
I removed the python block, and it works, but when I put any other name, I get this error?

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 53, in script
    mc "Oh. My name is [mc_name]."
KeyError: u'color_var'

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

Full traceback:
  File "game/script.rpy", line 53, in script
    mc "Oh. My name is [mc_name]."
  File "C:\Users\wolfe\Downloads\renpy-6.99.12.4-sdk\renpy\ast.py", line 643, in execute
    renpy.exports.say(who, what, interact=self.interact, *args, **kwargs)
  File "C:\Users\wolfe\Downloads\renpy-6.99.12.4-sdk\renpy\exports.py", line 1176, in say
    who(what, *args, **kwargs)
  File "C:\Users\wolfe\Downloads\renpy-6.99.12.4-sdk\renpy\character.py", line 987, in __call__
    who = who_pattern.replace("[who]", sub(who))
  File "C:\Users\wolfe\Downloads\renpy-6.99.12.4-sdk\renpy\character.py", line 982, in sub
    return renpy.substitutions.substitute(s, scope=scope, force=force, translate=translate)[0]
  File "C:\Users\wolfe\Downloads\renpy-6.99.12.4-sdk\renpy\substitutions.py", line 242, in substitute
    s = formatter.vformat(s, (), kwargs)
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 563, in vformat
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 585, in _vformat
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 646, in get_field
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 605, in get_value
KeyError: u'color_var'

Windows-8-6.2.9200
Ren'Py 6.99.14.1.3218
Fri Mar 02 07:54:48 2018
Specifically, any other name except violet is usually just plain white, but it also doesn't let the default name work.

User avatar
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??

#24 Post by 78909087 » Fri Mar 02, 2018 12:39 pm

Please just post all of your script.
I am not friends with the sun.
Image

LazyLycanthrope
Newbie
Posts: 13
Joined: Sat Feb 03, 2018 11:17 pm
Contact:

Re: Certain name reactions??

#25 Post by LazyLycanthrope » Fri Mar 02, 2018 2:22 pm

78909087 wrote:
Fri Mar 02, 2018 12:39 pm
Please just post all of your script.

Code: Select all


# ETC
define farright = Position(xpos=2.)

# POINTS



# BACKGROUNDS
image bed = "bedroom.png"
image kit = "kitchen.png"
image kitdark = "kitchendark.png"
image con = "congrats.png"
image cafe = "cafe.png"
image rabidrs = "rabidravens.png"
image beddark = "bedroomdark.png"
image dark = "dark.png"
image nickh = "nickhouse.png"
image betaending = "betaending.png"
# CHARACTERS

define n = Character("Nick", color="#58ACFA")
define d = Character("Dirk", color="#2E64FE")
define l = Character("Logan", color="#F5A9BC")

define mc = Character("{color=[color_var]}[mc_name]{/color}")
default nameColor = "#FFFFF"
default mc_name = "Wyvern"

# The game starts here.

label start:
    define config.has_autosave = True
    scene beddark with fade
    $ health = 100
    show screen health
    play music "Backbay Lounge.mp3"
    
    
    "..Gah... What time is it..??"
    "I look over to my alarm clock. It's 3 AM."
    "Wait- darn diddly dang it! Did I just forget my own name!?"

    $ mc_name = renpy.input("What was it again?")
    $ mc_name = mc_name.strip()
    if not mc_name:
        $ mc_name = "Wyvern"
    if mc_name == "Violet":
        $ color_var = "#8258FA"
        mc "My name is [mc_name], like the color."
    if mc_name == "Tod":
        $ color_var = "#FDE278"
        mc "For fuck's sake, my name is [mc_name]! How could I forget. Ugh, time to be a total fucking asshole to everyone I meet."
    else:
        mc "Oh. My name is [mc_name]."
    
    "I get out of bed, despite the fact that it's heckin 3 AM in the morning."
    "I walk into the kitchen and-"
    
    scene kitdark with hpunch
    play music "Mischief Maker.mp3" fadein 1.0
    
    show nick grin
    
    $ n = "{color=#58ACFA}???{/color}"
    
    n "Hello!!"

    mc "HOW DID YOU GET IN HERE?!"
    
    show nick grin2
    
    n "Your doggy door was open!"
    show nick happy
    
    mc "... Get out."
    show nick nervous2
    n "Sure thing!"
    
    show nick happy at default
    hide nick happy with moveoutright
    
    "What.. What just happened?"
    "I walk back into my bedroom..."
    
    scene beddark
    stop music fadeout 1.0
    play music "Backbay Lounge.mp3" fadein 1.0
    play sound "phone buzz.mp3"
    with hpunch
    mc "It's my phone! I wonder who texted me.."
    "I pick up the phone, seeing that it's my friend, Logan"
    
    l "Hey! What's shakin'?"
    $ renpy.block_rollback()
    menu:
        "Don't reply.":
            "I put down the phone because socializing is something I'm not up to doing right now."
            mc "..."
            mc "Okay."
            jump tired
##
        "Reply.":
            mc "Hey Logan! I'm just... In my bedroom."
            l "In your bedroom? That's all?"
            mc "Well.. Let's just say that someone crawled through my doggy door."
            l "What? Wait- don't answer that. Anyways, I'm playing Sky's Rim. Wanna join me?"
            mc "Dude. It's 3 in the morning."
            l "Oh."
            l ".."
            l "..."
            l "...."
            l "Okay."
            "I put down the phone, and sigh."
            mc "..There he goes."
            jump okay
##
        "Ask why he's texting at 3am.":
            mc "Why are you texting me at 3am?"
            l "... I don't know."
            mc "..."
            "I put down the phone."
            jump weird
##
    label tired:
        mc "I'm tired."
        mc "I guess I'll just stay in bed.. again."
        stop music fadeout 1.0
    scene con
    with fade
    play sound "party horn.mp3"
    $ renpy.block_rollback()
    "go back to main menu?"
    menu:
        "yes.":
            return
##
    label weird:
        mc "Well. That was weird."
        jump okay
##
    label okay:
        mc "I think I'm gonna sleep a bit more."
        scene black
        with fade
        scene bed
        
        mc "..."
        "I look at my phone for the time."
        "It's 9:35 AM."
        mc "Might as well get up and eat something since there's no chance of me falling asleep again."
##
    scene kit
    with fade
    "I walk over to the fridge."
    
    $ renpy.block_rollback()
    menu:
        "Open the fridge":
            "There's nothing inside."
            mc "...I should have went grocery shopping."
            mc "Might as well go somewhere before I starve to death."
##
        "Go eat somewhere":
            "I'm too tired to cook anything. But where should I go?"

    $ renpy.block_rollback()
    menu:
        "Starlight Cafe":
            "I could go for a cup of coffee while I'm there.."
            jump cafe
##
        "Rabid Raven's":
            "Some burgers and beer sounds good right now."
            jump rabidrs
        
##NICK MEETING
    label cafe:
    $ renpy.block_rollback()
    define config.has_autosave = True
    scene cafe
    with fade
    $ ilynick = 0
    $ nickhealth = 100
    play music "Falling for u.mp3" fadein 1.0
    show screen ilynick
    show screen nickhealth
##
    mc "Now I have to recite my order 20 times before I tell the cashier what I want.."
    show nick grin2
    n "Hey there!"
    "Wait. Isn't this the dude who crawled through my doggy door at like??? 3 AM???"
    mc "Oh. Hi..? I guess??"
    show nick nervous
    n "About that doggy door thing.. Uh.."
    n "I went into the wrong house and it was too dark to realize."
    n "{size=15}I only realized that I was in the wrong house when I heard your voice so..{/size}"
    mc "What?"
    show nick nervous2
    n "..Nevermind."
    show nick happy
    n "Anyways, I'm Nikolai Grimm. Or just Nick."
    $ n = "{color=#58ACFA}Nick{/color}"
    mc "Nice to meet you Nick!"
    show nick grin
    n "Well, it's nice to meet you too!"
    show nick h
    n "Uh.. Do you want a cup of coffee? I'll pay as an apology!"
    show nick nervous
    
    $ renpy.block_rollback()
    menu:
        "Accept.":
            show nick happy
            $ ilynick +=10
            mc "Sure!"
            jump coffeedate
##
        "Decline.":
            show nick frown
            mc "No thank you."
            jump heckoff
##
    label coffeedate:
    define config.has_autosave = True
    "You sit down at a table with Nick, and just awkwardly look around."
    mc "So... Do you come here often?"
    show nick grin
    n "Yeah, this is where I go for most of my day."
    show nick surprised
    n "Oh! Wait- I never got your name!"
    mc "My name's [mc_name]!"
    show nick blush
    n "{size=15}..[mc_name].. That's a nice name...{/size}"
    mc "Hm? What did you say?"
    show nick nervous2
    n "N-nothing!"
    "I raised an eyebrow- He was being kinda weird. But hey, he probably just has trouble talking to people. I mean, I sure do."
    "I take a big sip out of my coffee. It tasted... Off."
    mc "Are you okay? You seem really tense."
    show nick nervous
    n "I'm fine! I'm just kinda getting anxious due to the amount of people here."
    mc "Oh, I can totally relate."
    mc "So.. What do you do for a living?"
    show nick nervous2
    n "I'm a college student. How about you?"
    mc "I'm in college too! Hey.. Wait, I was wondering.."
    mc "What did you mean you went into the wrong house?"
    n "..."
    show nick nervous
    n "I was just going to a friend's place. They were.. Expecting me."
    mc "At 3am?"
    n "Yeah, we like hanging around during the early hours of the day."
    mc "I can tell that you seem nervous. Wanna go somewhere else?"
    show nick h
    n "Yes, that would be a lot better."
    mc "Uh, well there's a nice park that's usually kinda empty, but it's kinda far from here and I don't have a car."
    show nick happy
    n "We can use my car, I mean if you want to."
    mc "Sure!"
    jump car
##
label car:
    stop music fadeout 1.0
    play music "Horror Ambience.mp3" fadein 1.0
    "We walk over to his car, and we get in."
    "Nick starts the car, and I notice the lack of door handle."
    mc ".. W-where's the door handle?"
    show creepy nick grin6
    n "Oh..! It was like that when I got it!"
    "Feeling kind of panicked, I just said an 'Okay.' and left it at that."
    "I started feeling kind of dizzy and weak, but I didn't know why."
    "Then I realized- Nick had put something in my coffee before he had given it to me."
    show creepy nick grin7
    "I pass out, the last thing I hear is Nick quietly chuckling to himself."
    stop music fadeout 1.0
    scene dark
    jump mergeabduct
    return
    
##
    label heckoff:
    define config.has_autosave = True
    n "Oh, okay. Maybe next time then?"
    mc "Maybe."
    show nick frown at farright with move
    mc "Wow, what a weirdo."
    
    "I order my coffee, and decide to run a few errands."
    stop music fadeout 1.0
    scene dark
    play music "Lightless Dawn.mp3" fadein 1.0
    "By the time I get home, it's already nighttime."
    scene beddark with fade
    show creepy nick grin5
    n "Hey there~"
    mc "What the?! Nick? What are you-" with hpunch
    $ health -=20
    "Before I could finish my sentence, a hard object had hit my head."
    jump mergeabduct
##
    label mergeabduct:
    scene dark
    scene nickh with fade
    play music "Echoes of Time.mp3" fadein 1.0
    "I looked around the unfamiliar room with confusion."
    mc "Where am I? Wait-"
    "I realize that I'm tied up and I start to panic."
    show creepy nick grin
    n "You're finally awake!"
    mc "W-what the?! {b}LET ME GO!{/b}"
    show creepy nick grin2
    n "Aw, don't worry [mc_name]! I'll treat you well~"
    mc "How did you even manage to get me here?! I mean, besides earlier.."
    show creepy nick grin4
    n "I have my ways."
    jump abducted
    ##
    n "Sorry, but I can't do that."
    show creepy nick grin
##
    label abducted:
    n "You look hungry, do you want something to eat?"
    $ renpy.block_rollback()
    menu:
        "Accept.":
            mc "Yes please.."
            $ ilynick +=15
            show creepy nick grin2
            n "Alrighty! Just a note- I can only cook pancakes."
            jump pancakes
##
        "Decline.":
            mc "I don't think I can trust you."
            show frustrated nick
            n "Fine then."
            n "Go and sleep. I'll be upstairs so don't try to escape."
            jump rest
            
label pancakes:
    show creepy nick grin
    hide creepy nick grin with moveoutright
    "He shuffled out of the room and went up a flight of stairs."
    "I try to get the ropes loose, but they're too tight."
    "I sigh, and looked around some more."
    "This is a basement.. He made it look.. So welcoming.. I mean, besides the concrete flooring and walls."
    show creepy nick grin2
    with hpunch
    n "Hey! I'm back with your pancakes!"
    mc "Thank you.. But.. How am I gonna eat them when I'm tied up?"
    show creepy flustered nick
    n "Well.. I had something in mind.."
    n "But, I'll feed you this time."
    mc "What does he mean by {i}'I had something in mind'?!{/i}"
    "I just shook it off and let him feed me the pancakes."
    $ health +=15
    n "Uh.. Do you like them?"
    $ renpy.block_rollback()
    menu:
        "They're amazing!":
            show creepy nick grin
            $ ilynick +=20
            n "You really think so?"
            mc "Yeah!"
            show creepy flustered nick
            n "T-thank you.."
            n "Uhh.. You should probably rest.."
            mc "Okay.."
            n "Please don't try anything.. Goodnight."
            hide creepy flustered nick with moveoutright
            "I layed down onto the cold concrete and as soon as I did, I fell asleep."
            stop music fadeout 1.0
            scene dark with fade
            jump rest
##
        "I don't really like pancakes.":
            $ dislike = "pancakes"
            show creepy nick sad
            $ ilynick -=5
            n "Oh.. {size=15}I'm sorry..{/size}"
            hide creepy nick sad with moveoutright
            "He just left without a word."
            "I guess.. I'll just sleep..."
            stop music fadeout 1.0
            scene dark with fade
            jump rest
##
        "They taste terrible.":
            stop music fadeout 1.0
            play music "PANIC.mp3" fadein 1.0
            hide creepy nick grin
            show frustrated nick
            $ ilynick -=10
            n "That's very rude."
            hide frustrated nick with moveoutright
            "He goes over to a cabinet and unlocks it."
            mc "W-what are you doing?"
            "He didn't answer. But then I noticed the metallic object in his hand."
            show frustrated nick with moveinright
            "The man walked back in front of me, and I closed my eyes."
            mc "Gah!" with hpunch
            $ health -=20
            "I opened my eyes and felt a searing pain in my arm, so I looked over at it. He had stabbed my arm with a knife."
            show frustrated nick2
            n "Next time, don't be ungrateful."
            "I wimpered and nodded."
            n "I'm going to go to sleep. Don't try anything. {size=15}Things won't end well if you do.{/size}"
            show frustrated nick
            "He ripped the knife out and put it back into the cabinet, and then walked over to the door before looking back at me." 
            hide frustrated nick with moveoutright
            "He's gone."
            "I try to make myself comfortable, but I can't with how cold the ground is and how tight these ropes are."
            "Somehow though, I managed to fall asleep."
            scene dark with fade
            jump rest
##
label rest:
    stop music fadeout 1.0
    play music "Horror Ambience.mp3" fadein 1.0
    scene nickh
    "I woke up on the cold concrete floor and pull myself out of the now loosened ropes."
    "What should I do now?"
    $ renpy.block_rollback()
    menu:
        "Find a weapon.":
            "I look around, nothing. Well, except for the axe on a rack in the corner. {size=15}Wait.. Why does he have that {i}here?!{/i}{/size}"
            "I grab the axe, ready to fight off anyone."
            "But little did I know, there was an alarm on the rack."
            mc "OHSHIT-" with hpunch
            jump yougotaxed
            
            
        "Rest.":
            "There's no use trying to escape. Who knows what he'll do."
            scene dark with fade
            scene nickh
            show creepy nick grin2 with hpunch
            n "Hey! I hope you had a nice rest, because we'll be doing something special~"
            mc "What..?"
            show creepy nick grin7
            n "You just have to wait and find out~"
            jump torture
            
##
        "Try to escape.":
            "I run over to the door, and attempt to turn the knob. It's locked."
            mc "Dammit!"
            "Suddenly, I heard shuffling from the other side of the door."
            "SHITSHITSHIT-"
            "I quickly go back into my spot and put the ropes back on, and decide to just sleep until the next day."
            scene dark with fade
            scene nickh
            show creepy nick grin2 with hpunch
            n "Heyo, [mc_name]! Hope you aren't feeling tired, because we've got stuff to do!"
            mc "O-okay.."
            "Phew- I thought he'd do something to me because of when I tried the door knob.."
            jump torture
            
##
label yougotaxed:
    stop music fadeout 1.0
    play music "Industrial Rage.mp3" fadein 1.0
    show frustrated nick
    $ ilynick -=10
    n "What the HELL do you think you're doing?!"
    "He pinned me down onto the concrete floor with his shoe, and ripped the axe out of my hands, and put it back onto the rack."
    n "Don't ever try to take anything unless you have my permission. Got it?"
    label menu1:
    $ time = 3
    $ timer_range = 3
    $ timer_jump = 'menu1_slow'
    show screen countdown
    $ renpy.block_rollback()
    menu:
        "Yes.":
            hide screen countdown
            show creepy nick grin
            $ ilynick +=20
            n "Good."
            jump obey
        "Scream":
            hide screen countdown
            jump scree
   
label menu1_slow:
    n "..."
    show frustrated nick2
    n "Fine, don't answer."
    jump torture
label obey:
    show creepy nick grin4
    n "Anyways, let's do something else~"
    n "Maybe something that'll.. Spice something up~"
    mc "W-what do you mean..?"
    n "Oh, you'll see~"
    jump torture
label scree:
    show creepy nick a with hpunch
    n "!!!"
    show frustrated nick2
    hide creepy nick a
    n "Be quiet!"
    n "You'll be in big trouble if you keep being loud.."
    show frustrated nick
    n "So are you going to cooperate or not?"
    $ renpy.block_rollback()
    menu:
        "Yes.. Please don't kill me..":
            show creepy nick grin2
            "Great! But no promises!"
            $ ilynick +=20
            jump torture
##
        "Cry":
            show creepy nick a
            show creepy nick grin7
            n "That's cute."
            $ ilynick +=25
            jump torture
##
label torture:
    show creepy nick blush3
    n "I think this'll be quite enjoyable."
    "I looked at him in complete terror as he licked his lips and walked over to a locked drawer."
    hide frustrated nick
    hide creepy nick blush3 with moveoutright
    "He looked through some stuff in the drawer, and then muttered 'I'm sure this'll do a good job.' while picking up a blue object."
    show creepy nick grin5 with moveinright
    "I attempted to point to the object in his hand."
    mc "What is that..?"
    n "Oh, this?"
    show creepy nick grin2
    n "It's a nail gun, silly~!"
    "I shuddered."
    
    hide screen health
    hide screen ilynick
    scene yagotaxed
    with fade
    play music "Ghost Story.mp3" fadein 1.0
    $ renpy.block_rollback()
    "go back to main menu?"
    menu:
        "yes.":
            return

####################
##DIRK MEETING
    label rabidrs:
    $ renpy.block_rollback()
    define config.has_autosave = True
    scene rabidrs
    with fade
    $ ilydirk = 0
    show screen ilydirk
    play music "Big Rock.mp3" fadein 1.0
    $ d = "{color=#2E64FE}???{/color}"
    mc "Yikes, there's a lot of people here today.."
    d "Yo, are you looking for somewhere to sit?"
    "I turn around, and come face to face with a tall man."
    hide screen health
    hide screen ilynick
    scene betaending
    with fade
    play music "Better Days.mp3" fadein 1.0
    $ renpy.block_rollback()
    "go back to main menu?"
    menu:
        "yes.":
            return

User avatar
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??

#26 Post by 78909087 » Fri Mar 02, 2018 2:43 pm

The issue this time was that you changed the code I provided, taking out the

Code: Select all

define color_var = "#FFFFFF"
and replacing it with your

Code: Select all

default name_color = "#FFFFF"
Which doesn't even have the right number of values in it to be a hex code... And isn't a variable that does anything for your script.

This meant that the variable for the name to recieve a default color was removed, and the script couldn't tell wtf to do.
This is the code you should be using at the beginning of your script.

Code: Select all

define mc = Character("{color=[color_var]}[mc_name]{/color}")
define color_var = "#FFFFFF"
default mc_name = "Wyvern"

# The game starts here.

label start:
    define config.has_autosave = True
    scene beddark with fade
    #$ health = 100
    #show screen health
    #play music "Backbay Lounge.mp3"
    
    
    "..Gah... What time is it..??"
    "I look over to my alarm clock. It's 3 AM."
    "Wait- darn diddly dang it! Did I just forget my own name!?"

    $ mc_name = renpy.input("What was it again?")
    $ mc_name = mc_name.strip()
    if not mc_name:
        $ mc_name = "Wyvern"
    if mc_name == "Violet":
        $ color_var = "#8258FA"
        mc "My name is [mc_name], like the color."
    if mc_name == "Tod":
        $ color_var = "#FDE278"
        mc "For fuck's sake, my name is [mc_name]! How could I forget. Ugh, time to be a total fucking asshole to everyone I meet."
    else:
        mc "Oh. My name is [mc_name]."
I am not friends with the sun.
Image

LazyLycanthrope
Newbie
Posts: 13
Joined: Sat Feb 03, 2018 11:17 pm
Contact:

Re: Certain name reactions??

#27 Post by LazyLycanthrope » Fri Mar 02, 2018 8:38 pm

78909087 wrote:
Fri Mar 02, 2018 2:43 pm
The issue this time was that you changed the code I provided, taking out the

Code: Select all

define color_var = "#FFFFFF"
and replacing it with your

Code: Select all

default name_color = "#FFFFF"
Which doesn't even have the right number of values in it to be a hex code... And isn't a variable that does anything for your script.

This meant that the variable for the name to recieve a default color was removed, and the script couldn't tell wtf to do.
This is the code you should be using at the beginning of your script.

Code: Select all

define mc = Character("{color=[color_var]}[mc_name]{/color}")
define color_var = "#FFFFFF"
default mc_name = "Wyvern"

# The game starts here.

label start:
    define config.has_autosave = True
    scene beddark with fade
    #$ health = 100
    #show screen health
    #play music "Backbay Lounge.mp3"
    
    
    "..Gah... What time is it..??"
    "I look over to my alarm clock. It's 3 AM."
    "Wait- darn diddly dang it! Did I just forget my own name!?"

    $ mc_name = renpy.input("What was it again?")
    $ mc_name = mc_name.strip()
    if not mc_name:
        $ mc_name = "Wyvern"
    if mc_name == "Violet":
        $ color_var = "#8258FA"
        mc "My name is [mc_name], like the color."
    if mc_name == "Tod":
        $ color_var = "#FDE278"
        mc "For fuck's sake, my name is [mc_name]! How could I forget. Ugh, time to be a total fucking asshole to everyone I meet."
    else:[img][/img]
        mc "Oh. My name is [mc_name]."
It works now, but if I put violet/tod/any of the names listed in the code, it it goes from saying "my name is violet"/any of the other name dialogues to what the mc is supposed to say if their name isn't any of the names listed above ((aka they say the"else" part"))

User avatar
Draziya
Regular
Posts: 70
Joined: Sun Nov 26, 2017 8:50 am
Completed: this was for you. [NaNoRenO 19], Acetylene [AceJam19], Ah!! My Roommate is a Succubus Hellbent on World [MonJam 18], I Don't Have A Clue [QRMJam 18], Cautionary Tale [NaNoRenO 18], OP Dodge Cross [GGJ 18], Acetone [AceJam 18]
Projects: I'm a love interest in my childhood friend's reverse harem!!
Organization: Watercress
itch: Drazillion
Contact:

Re: Certain name reactions??

#28 Post by Draziya » Sat Mar 03, 2018 9:14 am

Currently, the last bit of your code is saying that if the main character's name is not Tod, say "Oh. My name is [mc_name]." This means that if you input Violet it will recognise that as not being Tod and give you the dialogue for any other name.

You want the else statement to only happen If the player inputed a name that isn't Violet or Tod.

Try using elif (else if) instead of if.

Code: Select all

    if not mc_name:
        $ mc_name = "Wyvern"
    if mc_name == "Violet":
        $ color_var = "#8258FA"
        mc "My name is [mc_name], like the color."
    elif mc_name == "Tod":
        $ color_var = "#FDE278"
        mc "For fuck's sake, my name is [mc_name]! How could I forget. Ugh, time to be a total fucking asshole to everyone I meet."
    else:
        mc "Oh. My name is [mc_name]."
Image

Post Reply

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot]