Points System Failure

A place to discuss things that aren't specific to any one creator or game.
Forum rules
Ren'Py specific questions should be posted in the Ren'Py Questions and Annoucements forum, not here.
Post Reply
Message
Author
User avatar
nagirinara
Regular
Posts: 70
Joined: Mon Apr 12, 2010 1:01 pm
Projects: World Academy, Galaxy Angel: A New Dawn
Location: Vancouver, Washington, USA
Contact:

Points System Failure

#1 Post by nagirinara » Mon Apr 12, 2010 1:10 pm

I'm experimenting with using the points system for my game to determine endings and such. However, I keep running into a problem. The errors I get are in brackets. Here's the code:

Code: Select all

# The game starts here.
label start:
    
    $ feli_points = 0
    $ ivan_points = 0
    $ antonio_points = 0
    $ doitsu_points = 0
    
    scene bg hall

    g "Points system check!"
    
    menu:
        
        "Get Feli Points!":
        $ feli_points += 100 [Expects non-empty block]
        g "I got Feli points!"
        
        "Get Ivan Points!":
        $ ivan_points += 100
        g "I got Ivan points! That's kinda of scary..."
        
        "Get Antonio Points!":
        $ antonio_points += 100
        g "I got Antonio points!"
        
        "Get Ludwig Points!":
        $ doitsu_points += 100
        "I got Ludwig points... hmmm incestuous..."
 
    if feli_points == 100 : [Expects non-empty block]
    "You get Feli's ending!"
    jump end
    
    if ivan_points == 100 : [Expects non-empty block]
    "You get Ivan's ending!"
    jump end
    
    if antonio_points == 100 : [Expects non-empty block]
    "You get Antonio's ending!"
    jump end
    
    if doitsu_points == 100 :    [Expects non-empty block]
    "You get Ludwig's ending!"
    jump end
    
label end:
   
   "Credits go here!"
It's just my preliminary testing and I omitted my defined characters from this sample for you. I'm sure it's something simple that I'm missing, if you guys could point it out to me, that would be great.
It's Nagi Rinara: Nagi-san or Rinara-chan, not Nagirinara-san. <--- Seriously, don't do it.

Currently making:
World Academy - Version Gilbo
Currently helping:
Galaxy Angel: A New Dawn
Finished:
None =T.T=

User avatar
tigerkidde
Regular
Posts: 155
Joined: Sun Mar 01, 2009 2:31 pm
Projects: Summer Tales of Katt and June
Contact:

Re: Points System Failure

#2 Post by tigerkidde » Mon Apr 12, 2010 1:24 pm

A quick glance at it, I think beneath the "if statements" you need to tab the item over. I need to test it to be sure though.

User avatar
nagirinara
Regular
Posts: 70
Joined: Mon Apr 12, 2010 1:01 pm
Projects: World Academy, Galaxy Angel: A New Dawn
Location: Vancouver, Washington, USA
Contact:

Re: Points System Failure

#3 Post by nagirinara » Mon Apr 12, 2010 1:26 pm

Hmmm, I'll try that.

Edit: Actually, that fixed that, but I'm still not sure what the problem is with the menu-item. Thanks for the help!
It's Nagi Rinara: Nagi-san or Rinara-chan, not Nagirinara-san. <--- Seriously, don't do it.

Currently making:
World Academy - Version Gilbo
Currently helping:
Galaxy Angel: A New Dawn
Finished:
None =T.T=

User avatar
Alex
Lemma-Class Veteran
Posts: 2981
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

Re: Points System Failure

#4 Post by Alex » Mon Apr 12, 2010 1:27 pm

The problem is indentation. Lines inside blocks should have additional 4 spaces (since Ren`py didn`t find such strings it thoughts that block is empty and shows you an error message).
http://www.renpy.org/wiki/renpy/doc/ref ... _Structure

Code: Select all

# The game starts here.
label start:
    
    $ feli_points = 0
    $ ivan_points = 0
    $ antonio_points = 0
    $ doitsu_points = 0
    
    scene bg hall

    g "Points system check!"
    
    menu:
        
        "Get Feli Points!":
            $ feli_points += 100
            g "I got Feli points!"
        
        "Get Ivan Points!":
            $ ivan_points += 100
            g "I got Ivan points! That's kinda of scary..."
        
        "Get Antonio Points!":
            $ antonio_points += 100
            g "I got Antonio points!"
        
        "Get Ludwig Points!":
            $ doitsu_points += 100
            "I got Ludwig points... hmmm incestuous..."

    if feli_points == 100 :
        "You get Feli's ending!"
        jump end
    
    if ivan_points == 100 :
        "You get Ivan's ending!"
        jump end
    
    if antonio_points == 100 :
        "You get Antonio's ending!"
        jump end
    
    if doitsu_points == 100 :
        "You get Ludwig's ending!"
        jump end
    
label end:
   
   "Credits go here!"

User avatar
nagirinara
Regular
Posts: 70
Joined: Mon Apr 12, 2010 1:01 pm
Projects: World Academy, Galaxy Angel: A New Dawn
Location: Vancouver, Washington, USA
Contact:

Re: Points System Failure

#5 Post by nagirinara » Mon Apr 12, 2010 1:29 pm

Ah, thank you. *finally got everything fixed* You guys were very helpful!
It's Nagi Rinara: Nagi-san or Rinara-chan, not Nagirinara-san. <--- Seriously, don't do it.

Currently making:
World Academy - Version Gilbo
Currently helping:
Galaxy Angel: A New Dawn
Finished:
None =T.T=

mduffor
Newbie
Posts: 11
Joined: Thu Nov 19, 2009 2:56 pm
Location: California, USA
Contact:

Re: Points System Failure

#6 Post by mduffor » Mon Apr 12, 2010 3:04 pm

As others have mentioned, it is an indentation problem. Basically in Python, if a line ends in a colon [:] then the lines following it need to be indented. By convention, indentation is four spaces for python. Also for everyone's sanity, it is best to use spaces instead of tab characters.

Cheers,
Michael
Blog + website = www.mduffor.com

Post Reply

Who is online

Users browsing this forum: No registered users