Need help with a simple renpy problem

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
ojisan
Newbie
Posts: 9
Joined: Fri Dec 28, 2007 5:44 am
Location: Honolulu, Hawaii
Contact:

Need help with a simple renpy problem

#1 Post by ojisan »

Everyone,

Now that summer vacation is nearing, I'd like to go back to work on "The Hawaii Exorcist," my renpy game that I've put on hiatus. The main reason I stopped was the frustration I had with trying to debug my script, which kept crashing to to an error that I cannot seem to solve. I had other work commitments, and I could not spare the time to comb through for the error. It's about an "if" statement, and I ask your help.

In this game, the choices the character makes define their personality and how others react to him (her?). For example, one of the jokes in the game is whether the characters believe in "Bernard" the purple dinosaur, a kid's show. I start the game with:
$ bernard_affinity = 0

Then, as they do simple actions, I either add or subtract points to this value. During certain times in the game, if this score is high enough, a purple dinosaur will appear out of nowhere (perhaps the main character's imagination, as no one else can see it) and lecture/sing to the character. Here's a sample of the script:

Code: Select all

## First of all, set down the affinity the characters have for the player. How do Samantha and Clayton feel about the main character? Does the main character believe in Bernard the Dinosaur?
    $ samantha_affinity = 0
    $ alex_affinity = 0
    $ bernard_affinity = 0

##[.... other parts of the script edited out for clarity]

##Here is scene that keeps giving me problems. The hero's friend, Samantha, has to study for a test and wants to go home. The hero, who is Samantha's boss, has to decide if he asks Samantha to stay or to go. Here, his choice is to let her go. The problem line in question seems to be " if bernard_affinity = 1: "

label samgo:
    show samantha giggle
    $ samantha_affinity += 1
    if bernard_affinity = 1: 
        show bernardthedino
        with dissolve
        b "Remember kids, learn to be considerate! If your friend has to study, let her study."
        b "(singing) Studying is so fun, studying is so fun." 
        b "Merrily merrily merrily merrily"
        b "Studying is so fun!"
        hide bernardthedino
        with dissolve
    m "I'd like for you to stay here, but I know you really want to ace that test."    
    s "Really? How nice of you! I have to study for this test because it's SOOOO hard."
    s "Tell me how this turns out. Sorry I couldn't be of much help."
Thanks for your advice. The script is 30% complete and I'm working on drawing characters with the wacom pen tablet I just bought.

J

JQuartz
Eileen-Class Veteran
Posts: 1265
Joined: Fri Aug 31, 2007 7:02 am
Projects: 0 completed game. Still haven't made any meaningfully completed games...
Contact:

Re: Need help with a simple renpy problem

#2 Post by JQuartz »

Code: Select all

if bernard_affinity == 1: 
You have to use == for if statements.
I suspect somebody is stealing my internet identity so don't believe everything I tell you via messages. I don't post or send messages anymore so don't believe anything I tell you via messages or posts.

ojisan
Newbie
Posts: 9
Joined: Fri Dec 28, 2007 5:44 am
Location: Honolulu, Hawaii
Contact:

Re: Need help with a simple renpy problem

#3 Post by ojisan »

JQuartz,

Thank you so much for the simple solution. It's working now (although other fixable problems have cropped up). :evil: Hard to believe a simple lack of a "=" set back this project by a month.


J

Post Reply

Who is online

Users browsing this forum: Black Spriggan, snotwurm