- Sep 29, 2017
- 58
- 111
Hello world.
I apologize if this is the wrong forum for my question.
Is it possible to run a loop in the console of renpy? If so, what are the limiting parameters; specifically, can conditional statements be used?
This is the basics of what I'm trying to accomplish (obviously not python, just showing what I want to accomplish):
The specific situation is with Lab Rats 2 - Reformulate. The mod authors post all the files on their github, so I'm able to poke around for variable names and game logic. Essentially, I want to write a loop that will iterate over all the non-special NPC's, and 'top-up' everyone's stats (game has stat decay). Preferably, in a way that is easily repeatable, as I don't want to go to the cheat screen of 95 NPC's and adjust stats individually. I just can't figure out how to make a loop run in the console.
I have tried using "list comprehension"?; however, I may not be understanding it correctly, as multiple lines give a syntax error, and I can't figure out a python single line looping conditional.
The renpy documentation (
// EDIT
Well, I figured out how to do multiple line entries in the console. It was expecting an end of line character ":". When a line ends in ":" the console allows you to enter a line and hit enter to get to the next line. Hitting enter twice exits the line input and runs the code. This is rather messy, having to copy/paste individual lines. If anyone knows how to write a python/renpy script and run it from the console, I would greatly appreciate it.
Here is the sample code I got to work
At the end, a=10, b=10, d=100; so, this is performing as expected. Just messy to input. And easy to break. "c" is a variable in use, so that caused problems, and infinite loops just crash the game.
Here is the code my sleep deprived brain came up with.
It worked on 80 of the 94. It didn't work on prostitutes and jobless. I need to fix the code, but I can do that later.
If anyone has any useful tips, I would love to learn.
I apologize if this is the wrong forum for my question.
Is it possible to run a loop in the console of renpy? If so, what are the limiting parameters; specifically, can conditional statements be used?
This is the basics of what I'm trying to accomplish (obviously not python, just showing what I want to accomplish):
Code:
for (int i = 0; i < NPC.size(); i++) {
if (NPC[i].love != 100 && NPC[i] != uniqueCharacter)
NPC[i].love = 100;
NPC[i].suggestibility = 100;
NPC[i].obedience = 300;
NPC[i].happiness = 300;
NPC[i].arousal = 100;
}
I have tried using "list comprehension"?; however, I may not be understanding it correctly, as multiple lines give a syntax error, and I can't figure out a python single line looping conditional.
The renpy documentation (
You must be registered to see the links
) says that scripts can be run? Is that something that I need to write in LUA to run? Basically, would it be possible to write my code into a file, put it in the game directory, and run it as many times as needed from the console?// EDIT
Well, I figured out how to do multiple line entries in the console. It was expecting an end of line character ":". When a line ends in ":" the console allows you to enter a line and hit enter to get to the next line. Hitting enter twice exits the line input and runs the code. This is rather messy, having to copy/paste individual lines. If anyone knows how to write a python/renpy script and run it from the console, I would greatly appreciate it.
Here is the sample code I got to work
Python:
a=0
b=0
d=0
while a < 10:
b=0
while b < 10:
b += 1
d += 1
a +=1
Here is the code my sleep deprived brain came up with.
Python:
a = 0
b = 0
peopleCount = 0
while a < len(list_of_jobs):
b = 0
while b < len(people_with_job(list_of_jobs[a])):
if people_with_job(list_of_jobs[a])[b].name == 'Gabrielle': // add all special NPC
peopleCount += 1
else:
people_with_job(list_of_jobs[a])[b].love = 100
people_with_job(list_of_jobs[a])[b].suggestibility = 100
people_with_job(list_of_jobs[a])[b].obedience = 300
people_with_job(list_of_jobs[a])[b].happiness = 300
people_with_job(list_of_jobs[a])[b].arousal = 100
peopleCount += 1
b += 1
a += 1
If anyone has any useful tips, I would love to learn.