If you want to, you could get the offending lines of code from the repository history and post them in the code review thread. I just looked at the history of the girl assign screen, but I could find nothing that seemed to match your description, probably because I don't understand what you mean.
Then you can understand the problem I've had
![Smiley :)](https://www.pinkpetal.org/Smileys/DarkB/smiley.gif)
There was nothing wrong with Matt's code from the Python perspective.
As you prolly have figured out by now, game is coded this way:
1) All logical game elements are coded in pure python. We access, display and change those in RenPy labels.
2) User interactions:
- We jump to a RenPy 'label' (labels are RenPy's way of running the game, instead of the usual main game loop you'd expect to find in Hentai Sims, we simply jump labels until we run out of them (we can obviously keep jumping to the same label any amount of times))
- In that label, we set up background and call screens (screens are coded in RenPy's screen language), at the same time we lock game's flow in a while loop.
There is a number of things that are not smart to include in screens, mainly because screens are being refreshed on all user interactions, once every 20 secs (If I recall correctly) or even many times per second if game requires them to. Another thing is that certain functions (like action calls from buttons) are not searching for variables on the same namespace as the screen first (very unusual for Python).
Problem was here:
for brtl in hero.brothels:
if brtl.highlighted:
$imgType = im.Scale
else:
$imgType = lambda *args: im.Sepia(im.Scale(*args))
vbox:
null height 20
text(u'{size=-10}%s' % brtl.name) align(0.5,0.5)
use rtt_lightbutton(img = imgType(brtl.img, 240, 150), return_value = ['brothel', brtl], tooltip = 'Send %s off to work in %s and choose from available actions.' % (chr.name, brtl.name))
In precious revision brothel was used to iterate instead of brtl
for brothel in hero.brothels:
and at the same time we also had brothel variable in the label and while loop namespaces:
label girl_assign:
scene bg wood
hide screen girlProfile
show screen pyt_girl_assign
python:
if isinstance(chr.location, Brothel):
brothel = chr.location
brothel.highlighted = True
brothel_selected = True
else:
brothel = None
brothel_selected = False
while True:
result = ui.interact()
if result[0] == 'brothel':
for brothel in hero.brothels:
brothel.highlighted = False
brothel = result[1]
brothel.highlighted = True
brothel_selected = True
so this bit of old code:
return_value = ['brothel', brothel]
didn't actually return a brothel that came from iterating over hero.brothels in the screen (something any Python coder would expect, it actually works exactly like you'd expect something in Python to work since rtt_lightbutton itself is defined on the same namespace as label (it is in fact for all intent and purposes a separate screen itself), but it is still a bit confusing) but instead returned whatever brothel variable was set to in the label. As you can imagine, this is in no way a problem with one brothel but a rather nasty issue with multiple brothels that doesn't throw an Error making it very hard to catch.
In any case this is what I believe was wrong with the code and in the end it's like you've said:
Anyway, the important thing is that the bug is squashed
BTW, I made good progress on the image tagging tool today. Since we decided to have uncategorized tags, I have to adapt the tool to accept those again. I did that today, and so far I have not been able to find bugs beyond those I already fixed. Tagging single images works. Tagging multiple images should probably also work, but I had no time to test it so far. Now its time to decide how the XMP tags will get imported into the game.
It's your call, json is prolly a better bet since we can freely access it to view tags but pickle will serve just as well. This is entirely up to you. I am planning to do some work on guard jobs today as well.