renpy character likes, lust etc

monkeyposter_7

Thirsty for my Guest
Game Developer
Nov 23, 2018
330
1,181
i basically want to make choices that affect how much people like you or lust for you, and i want to name this attributes myself
like "angela_like" or "angela_lust" etc

can someone tell me how to do this or what to look for in guides? is this "variables" or something else?
 
Oct 30, 2018
395
1,169
Yes, those are indeed variables.
To give you a very basic example of how they could be used -

Code:
define a = Character("Angela")

label start:

         $ angela_lust = 0

         #do something sexy with angela

         $ angela_lust +=1

         #angela's lust score has increased by 1

The "$" sign denotes a single line Python statement. I've used the first one to initialize the variable "angela_lust" and set it to the value of 0. The second statement is used to increment it.
There are multiple ways to initialize and use variables in Ren'Py and they're all valid (though some are deprecated and might cause issues).

For further reading is the official Ren'Py documentation. Or if you want any other help feel free to ask.
 

lancelotdulak

Active Member
Nov 7, 2018
556
557
You should get a book on basic programming in the language of your choice. I strongly suggest anything by Kernigan and Ritchie. Theyre the gold standard. ID also suggest you learn C. Then c++ later. It will teach you the basics of all languages clearly. Once you learn c the core of all languages will become clear to you and picking up new languages will (generally) be a breeze. The reason to move to c++ is to learn object oriented programming.. and classes are very handy for things like threading etc
 
  • Like
Reactions: monkeyposter_7

79flavors

Well-Known Member
Respected User
Jun 14, 2018
1,607
2,256
i basically want to make choices that affect how much people like you or lust for you, and i want to name this attributes myself
like "angela_like" or "angela_lust" etc

can someone tell me how to do this or what to look for in guides? is this "variables" or something else?
Yes, both "angela_like" and "angela_lust" would both be variables.

Quick guide then...

Edit: Moved everything I wrote here to a thread of it's own. Hopefully it might help a few more people that way.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,967
16,215
I store everything in a character class, [...]
While I completely understand why it's easier to do so, I tend to follow PyTom when he say that it's a bad idea. There's too many things in the Character class, and too many possible addition, for this to be an effective conflict free solution.
What can be done is to embed the Character object in your own class, then proxying it. Something like :
Code:
class MyCharacter( renpy.ptyhon.RevertableObject ):

    def __init__( self, [your own parameters], *args, **kwargs ):
        # Create the embedded Character object.
        self.__charObj = store.Character( *args, **kwargs )

    # 'say' statements works by calling the Character object,
    # so expect to be called, and pass it to the embedded object.
    def __call__( self, *args, **kwargs ):
        return self.__charObj( *args, **kwargs )

    # Will be called if an asked attribute is not found. Which mean
    # that it's a call for the embedded object, pass it to it.
    def __getattr__( self, aName ):
        # But first, ensure that it's not just a syntax error.
        if hasattr( self.__charObj, aName): return getattr( self.__charObj, aName)
        raise AttributeError( "Unknown attribute : '{}'".format( aName ) )