# The default values for each character and each kind of points.
default ann_lov = 0
default ann_cor = 0
default sar_lov = 0
default sar_cor = 0
# The code in charge of the point attribution.
# parameters:
# - who -> Nickname of the character, as used in the variable names.
# - what -> The value that is changed, as used in the variable names.
# - value -> The value used to change the number of points.
label points( who, what, value ):
# Declare the temporary variable as being local to this label, and the
# one used for the message. They'll exist in this label, and only in this label.
$ renpy.context_dynamic( "varName", "message" )
# Build the notification message, and the name of the variable to change,
# starting by the name of the character...
if who == "ann":
$ message = "Annabella "
$ varName = who + "_"
elif who == "sar":
$ message = "Sarah "
$ varName = who + "_"
else:
"Oops, an error happened, unknown character '[who]'. Please, notify the author of this game."
return
# ... continuing by the kind of point.
if what == "love":
$ message += what
$ varName += "lov"
elif what == "corruption":
$ message += what
$ varName += "cor"
else:
"Oops, an error happened, unknown point category '[what]'. Please, notify the author of this game."
return
# Finishing to build by the message by adding the value.
if value < 0:
# "- 1" is better looking than "-1" for a message.
$ message += "- {}".format( abs( value ) )
else:
$ message += "+ {}".format( value )
# Attribution of the point(s).
# You give to the variable whose name is stored in "varName" the value of this
# variable, plus the value to add.
# Note that this value can be negative, in which case it will become a
# subtraction.
$ setattr( store, varName, getattr( store, varName ) + value )
# Notify the player the way you want. Here I'll use the screen provided
# by /Barotok/
show screen points( message )
# And finally return to the game flow
return