Theme editor

  • RequestStream Movies, TV shows and anime streaming • 1 week trial
  • LewdCorner Site Cleanup Update
    A new cleanup update has been posted covering the recent Vault rework, rank changes, policy cleanup, and theme polish. The goal is to make LC cleaner, easier to understand, and safer for the site going forward. - Jack Of Blades
    Read More

I have a Ren'Py modding question

  • Thread starter Thread starter Burgouis
  • Start date Start date
  • Replies Replies 3
  • Views Views 511

Burgouis

Registered
Lewd
Joined
Jul 5, 2022
Threads
1
Messages
88
Vouches
0
Likes
78
Activity Coin
597
Donation Coin
0
Platinum Coin
0
LewdCoins
⚡22
1/3
‎3 Years of Service‎
Thread owner
I'm modding a game that has customizable ages, and I'm trying to mod it to subtract one custom age from another, to create a third age. (In order to show how old the MC's mom was, when his oldest daughter was born, and she became a grandma.) So, if you could write out the code needed, or show me an example of a game that does this, I'd appreciate it.

So far I have:
define persistent.tsage2 = ([persistent.tsage] - [persistent.dLeahAGE])

Which is throwing up this error:
File "game/script.rpy", line 173, in script
define persistent.tsage2 = ([persistent.tsage] - [persistent.dLeahAGE])
File "game/script.rpy", line 173, in <module>
define persistent.tsage2 = ([persistent.tsage] - [persistent.dLeahAGE])
TypeError: unsupported operand type(s) for -: 'RevertableList' and 'RevertableList'
 
It's a bit tough to write out the exact code you need without knowing the game, but here is a couple of pointers:

[persistent.tsage] - [persistent.dLeahAGE] means subtracting one list from another - probably not what you want.
Code:
define persistent.tsage2 = persistent.tsage - persistent.dLeahAGE
is more likely what you're after.

Note that define is used to define a new variable and set its original value. This happens when the game first launches. So for the above code to work as expected both persistent.tsage and persistent.dLeahAGE must already be defined and have their correct value set.

Hope that helps!
 
The way I do it is:

Numbers are whatever you want them to be:
Code:
default persistent.tsage = 40
default persistent.dLeahAGE = 18
default persistent.tsage2 = 22

Code:
label custom_tsage:
    $ persistent.tsage2 = persistent.tsage - persistent.dLeahAGE
return

script:
Code:
call custom_tsage
mc "I was [persistent.tsage2] when I had her."
 
Back
Top Bottom