Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
Tags

Ren'Py Stats Framework

A framework for preventing typos from breaking your stat-based Ren'Py game · By bobcgames

Error in Python Code?

A topic by amandaterasu created 29 days ago Views: 40 Replies: 4
Viewing posts 1 to 3

When I downloaded this and opened it up in vs code, it showed the following error: 

[{

    "resource": "/C:/Renpy/renpy-8.2.3-sdk/Projects/Zodiac/game/0bobcstats.rpy",

    "owner": "renpy0",

    "severity": 4,

    "message": "\"store.bobcstats_did_dodefault\": Use of a store variable that has not been defaulted.",

    "startLineNumber": 136,

    "startColumn": 19,

    "endLineNumber": 136,

    "endColumn": 42

}]

I added a couple of checks to my script to see if it would work anyway:

[{

    rim "Let's check your stats. Your evil is [evil] and your hp is [hp]. They should be 0 and 100, respectively."

    rim "now I'm going to add 1 to evil and subtract 10 from hp."

    stat evil add 1

    stat hp sub 10

    rim "Your evil is [evil] and your hp is [hp]. They should be 1 and 90, respectively."

}]

When I actually run the game, the first check calls the values, correctly, but in the second check it does add 1 to evil but does not subtract the 10 from hp. 


and



I'm not sure what's preventing the subtraction from working, and when I attempt to insert more than 2 stats, the game won't load, referencing the error in Line 136.

I'm not a programmer, so please forgive me if I've made a glaringly obvious mistake or left out something important. I would appreciate any help or advice you could give on getting this to function.
Developer

Hey! The error you're seeing is not actually an error... I'm using store variables in a special way as part of the initial script setup, so the lack of defaulting there is intentional. But I can probably clean that up so it doesn't show that error.

Your example *should* work though. Does it work if you do values smaller than 10? 

Hi! I have the same problem. I can add more than two stats, but the stats with a default initial value (hp in the example) cannot be modified at all.

Can you double check on your end?

Developer

Thanks for the ping! There was indeed a bug that I had somehow missed in my initial testing, and it's been fixed. Please download the latest version of the file and try again!

Developer

An updated version has been uploaded that should fix both the vs code error and the issue you were getting with hp. Please download the latest version and try again.

(You should have always been able to add more than two stats... if you're still having trouble with that part, please include your definition of the stats tuple)