Trouble with "romance points"

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
User avatar
Biotikos
Regular
Posts: 33
Joined: Sat Jan 19, 2013 4:50 pm
Projects: Eien no Mirai
Organization: Biotikos Development
Skype: aleatory-22
Contact:

Trouble with "romance points"

#1 Post by Biotikos »

Hello, community.

I've been using romance points since I started my project in 2015 (yea, that's a long time) and never had problems, but it's been sometime since I haven't done debugging and I am stuck with a problem with numerical variables.

In a separate file, named "definitions.rpy", in the "game" folder, I have the definition:

Code: Select all

# Puntos de afecto
$ kisakiap = 0
Then, on the game, I called it:

Code: Select all

menu: 
     "Quedarme.":
         $ irse = False
         "No, no merece la pena."
         "Ya he tenido bastante con ese mini-rechazo que me ha hecho Kotone."
         "Mordí de nuevo el melon pan, y abrí mi refresco."
         "Souta puso en el medio de los tres una caja de Pockys, e invitó a Kotone a sentarse con nosotros."
     "Ir a hablar con ella.":
         $ irse = True
         [b]$ kisakiap += 1[/b]
         "Me levanté, dejando el melon pan en el suelo, y caminando hacia la puerta."
Results are this (complete traceback)

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/script.rpy", line 1747, in script
    $ kisakiap += 1
  File "game/script.rpy", line 1747, in <module>
    $ kisakiap += 1
NameError: name 'kisakiap' is not defined

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

Full traceback:
  File "game/script.rpy", line 1747, in script
    $ kisakiap += 1
  File "C:\Users\Ray\Downloads\renpy-6.99.12.4-sdk\renpy\ast.py", line 814, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\Ray\Downloads\renpy-6.99.12.4-sdk\renpy\python.py", line 1719, in py_exec_bytecode
    exec bytecode in globals, locals
  File "game/script.rpy", line 1747, in <module>
    $ kisakiap += 1
NameError: name 'kisakiap' is not defined

Windows-8-6.2.9200
Ren'Py 6.99.12.4.2187
Eien no Mirai 0.81d
Does anyone has an idea why is this happening?

Thank you!

User avatar
Scribbles
Miko-Class Veteran
Posts: 636
Joined: Wed Sep 21, 2016 4:15 pm
Completed: Pinewood Island, As We Know It
Projects: In Blood
Organization: Jaime Scribbles Games
Deviantart: breakfastdoodles
itch: scribbles
Location: Ohio
Contact:

Re: Trouble with "romance points"

#2 Post by Scribbles »

you might need to use default instead of $ where you define it

default kisakiap = 0
Image - Image -Image

User avatar
Dovahkitteh
Veteran
Posts: 229
Joined: Wed Sep 02, 2015 4:51 pm
Completed: YDD, RE, CoB, Req
Projects: Red Embrace: Hollywood, The Black Hand
Organization: Argent Games
Tumblr: argentgames
Skype: Dovahkitteh
itch: argent-games
Contact:

Re: Trouble with "romance points"

#3 Post by Dovahkitteh »

You could also try having them in an init block, as this is what I have for my own game and it works fine:

Code: Select all

init:

    #Route determination points
    $lin_p = 0
And then calling them later is just

Code: Select all

$lin_p += 1
Image

Writer, Programmer, Designer

Programming/Design Commissions

Image Image

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

Re: Trouble with "romance points"

#4 Post by trooper6 »

Current best practices is to define your variables outside of any blocks using default. (Except for persistent variables which should use define)
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
Biotikos
Regular
Posts: 33
Joined: Sat Jan 19, 2013 4:50 pm
Projects: Eien no Mirai
Organization: Biotikos Development
Skype: aleatory-22
Contact:

Re: Trouble with "romance points"

#5 Post by Biotikos »

Thanks to you all!

I fixed it as you explained me and it worked <3

Screencap of the Variables Visor in Ren'Py at our Twitter

I'll properly credit you all in the game's credits as in our Twitter where I have uploaded the screencap from above (?

Post Reply

Who is online

Users browsing this forum: Google [Bot]