not sure why. but i had a special persistent points system working. then it broke.
this is the beginning:
label start:
$ persistent.ending
$ renpy.save_persistent()
if persistent.ending == 2:
jump trueending
this is at each ending.
python:
persistent.ending += 1
renpy.save_persistent()
i wanted to make a simple flag system allowing to reroute to a particular label when you tried to play the game again. but it didn't work. so i did this. with a persistent point system. and it worked at first. then it broke and now i'm confused. every time i reach the end it comes up claiming += 1 isn't a supported operand. originally it didn't work because I had defined a value for persistent.ending so i fixed that. and now it's derping again. can anyone help? or point me in the direction of a flag system that will allow me to redirect the beginning of the vn so when you try to play it again it goes to trueending.
here is the traceback
I'm sorry, but an uncaught exception occurred.
While running game code:
File "game/script.rpy", line 260, in script
File "game/script.rpy", line 261, in python
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'int'
-- Full Traceback ------------------------------------------------------------
Full traceback:
File "C:\Users\Tomoko\Desktop\Media\Tools\renpy-6.16.5-sdk\renpy\execution.py", line 288, in run
node.execute()
File "C:\Users\Tomoko\Desktop\Media\Tools\renpy-6.16.5-sdk\renpy\ast.py", line 720, in execute
renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
File "C:\Users\Tomoko\Desktop\Media\Tools\renpy-6.16.5-sdk\renpy\python.py", line 1308, in py_exec_bytecode
exec bytecode in globals, locals
File "game/script.rpy", line 261, in <module>
persistent.ending += 1
TypeError: unsupported operand type(s) for +=: 'NoneType' and 'int'
Windows-post2008Server-6.2.9200
Ren'Py 6.16.5.525
Death Sketch 0.1
"unsopported operand += 1"
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
-
- Newbie
- Posts: 1
- Joined: Fri Jan 24, 2014 6:35 am
- Contact:
-
- Veteran
- Posts: 448
- Joined: Wed Nov 18, 2009 11:17 am
- Completed: Loren
- Projects: PS2
- Location: Germany
- Contact:
Re: "unsopported operand += 1"
Put this under the start label:
Code: Select all
if not persistent.ending:
$persistent.ending = 0
Avatar created with this deviation by Crysa
Currently working on:
Currently working on:
- Winterwolves "Planet Stronghold 2" - RPG Framework: Phase III
- i1abnrk
- Regular
- Posts: 38
- Joined: Wed Nov 20, 2013 1:50 pm
- Projects: Critter Corral, Haremu Kikkemu Mo
- IRC Nick: i1abnrk
- Deviantart: i1abnrk
- Github: i1abnrk
- Location: Wisconsin
- Contact:
Re: "unsopported operand += 1"
Unsupported operand means the operand '+=' is not used in python and therefore renpy. Instead you have to write:
Try that.
Code: Select all
peristant.ending = peristant.ending + 1
-
- Veteran
- Posts: 448
- Joined: Wed Nov 18, 2009 11:17 am
- Completed: Loren
- Projects: PS2
- Location: Germany
- Contact:
Re: "unsopported operand += 1"
I'm sorry but that's wrong. If you look at the actual error it becomes quite evident what the problem is:i1abnrk wrote:Unsupported operand means the operand '+=' is not used in python and therefore renpy. Instead you have to write:Try that.Code: Select all
peristant.ending = peristant.ending + 1
The problem is the type persistent.ending has at the beginning. If it were 0, that is an integer, this wouldn't be a problem. But it's None instead which doesn't support the addition operator. Neither the += nor the + one. That's why persistent.ending has to be initialised as 0 before we can add anything to it.TypeError: unsupported operand type(s) for +=: 'NoneType' and 'int'
Last edited by Anima on Fri Jan 24, 2014 1:11 pm, edited 1 time in total.
Avatar created with this deviation by Crysa
Currently working on:
Currently working on:
- Winterwolves "Planet Stronghold 2" - RPG Framework: Phase III
Re: "unsopported operand += 1"
I believe you got that wrong . "+=" works perfectly fine. Anima's solution is correct, the error is thrown because Ren'Py tried to add an int and an undefined variable (which in case of persistent ones I believe returns None as it's value).i1abnrk wrote:Unsupported operand means the operand '+=' is not used in python and therefore renpy.
Edit: As explained above.
- i1abnrk
- Regular
- Posts: 38
- Joined: Wed Nov 20, 2013 1:50 pm
- Projects: Critter Corral, Haremu Kikkemu Mo
- IRC Nick: i1abnrk
- Deviantart: i1abnrk
- Github: i1abnrk
- Location: Wisconsin
- Contact:
Re: "unsopported operand += 1"
Ok then :p
Who is online
Users browsing this forum: Majestic-12 [Bot]