Ren'Py Steam achievement related issue

3DeadAngel

Newbie
Game Developer
May 10, 2023
55
61
Hello! I'm working on Steam achievements and I stumbled upon a problem which I can't seem to find any fixes to.

The concept:
I have a secret gallery which has 22 images in total. Whenever a player clicks a secret gallery item a persistent get's a +1. After the player reaches the magic number which is 22 the achievemnt should be granted to the player.

What I have in the code: ($ achievement.grant("SGALLERY") this line is coming back with the error)
Code:
init python:
    achievement.register("SGALLERY", stat_max=22)
  
default persistent.special1 = False
default persistent.special_renders = 0 #this is the counter

#The screen which adds a +1 to the special_renders once it's clicked (working)
default secret_button1 = False
screen secret_button():
    add "random.webp"
    if not secret_button1:
        imagebutton:
            focus_mask True
            auto "random_%s.png"
            action [ToggleScreen("secret_button"), Function(renpy.notify, "Special render unlocked"), SetField(persistent, "special1", True), SetField(persistent, "special_renders", persistent.special_renders + 1), Return()]
          

# then how I put it inside the game, however I have no clue why it's wrong, if i delete the steam achievement out it's working as it should
if persistent.special1 == False:
                show screen secret_button
                blank "special render here"
                hide screen secret_button
                $ achievement.progress("SGALLERY", len(persistent.special_renders))
                if achievement.get_progress("SGALLERY") >= 22:
                    $ achievement.grant("SGALLERY")
                $ achivement.sync()
else:
                show screen fake_screen
                blank "special render here"
                hide screen fake_screen
Hopefully I'm a moron only and the issue is nothing complicated:D
 
Last edited: