When the player reads the actual story page, the code resolves and the stats are capped. The stats screen will print the capped stat. The loop is closed and your stats will always capped, regardless.
So, ye, fairly safe to use. But I’m on mobile currently; best to test it in real env.
From my experience, the only command that gets evaluated every time the player enters the page is random.
I have developed the habit of moving any code to the top of the page and encapsulating it between *page_breaks. CS ignores consecutive page breaks if there’s no text printed to the screen, but behind the curtain it still considers them to be on different pages.
This way, “text pages” have no code and “code pages” have no text. It ensures CS will never hit any code line more than once.
I knew that it ignores consecutive page breaks, but I never thought of exploiting that to fix the *rand issue! That’s really clever and should be integrated into common practice.