Lemma Soft Forums

Supporting creators of visual novels and story-based games since 2003.


Visit our new games list, blog aggregator, IRC, and wiki.
Activation problem? Email [email protected]
It is currently Sat May 25, 2013 9:31 pm

All times are UTC - 5 hours [ DST ]


Forum rules


Ask questions about one topic per thread, and use a descriptive subject. "NotImplemented error in script.rpy" is a good subject, "Tom's problems" is not. Remember to include all of traceback.txt or error.txt when reporting a problem, as well as the relevant lines of script. Use the [code] tag to format scripts.



Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: Sat Aug 04, 2012 6:45 pm 
Newbie
User avatar

Joined: Mon Jun 25, 2012 9:33 am
Posts: 19
Location: United States
Projects: Nostalgic Mist
Organization: Childhood In a Box Studios
I saw quite a lot of topics and FAQs about this issue, but I've been stuck with trying to solve the issue.

Firstly I used Ren'Py's FAQ about remembering user choices.

Code:
menu:
    kasu "Today looks glorious. {w}I wonder which route I should take?"
    "Take long way":
        $ gift = "bracelet"
        stop music
        jump long_way
    "Take shortcut":
        jump shortcut

During this menu the bracelet is something the MC is given as a parting gift if she chooses to take the long way. Pretty self explanatory.

Code:
menu:
    kasu "Yeah, yeah. {w}Hey, there was something I wanted to talk to you about,"
    "Ask about records and music sheets":   
        jump records
    "Talk about dream":
        jump dreams
    "Desperately try to hide bracelet" if gift == "bracelet":
        jump bracelet2

The third menu choice is hidden and is only seen if the user clicked on the long way and received the bracelet as a parting gift.

Either time I click on the short way or long way afterwards when I reach this second menu, I'm given this error:

Code:
I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game\script.rpy", line 253, in script
  File "game\script.rpy", line 259, in python
NameError: name 'gift' is not defined

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "C:\Users\Markedleine\Documents\My Works\renpy-6.14.0-sdk\renpy\execution.py", line 266, in run
  File "C:\Users\Markedleine\Documents\My Works\renpy-6.14.0-sdk\renpy\ast.py", line 1225, in execute
  File "C:\Users\Markedleine\Documents\My Works\renpy-6.14.0-sdk\renpy\exports.py", line 487, in menu
  File "C:\Users\Markedleine\Documents\My Works\renpy-6.14.0-sdk\renpy\python.py", line 1193, in py_eval
  File "game\script.rpy", line 259, in <module>
NameError: name 'gift' is not defined

Windows-7-6.1.7601-SP1
Ren'Py 6.14.0.305
Nostalgic Mist 0.0


I defined gift many times and even created many variables under label start but still nothing changed. The error still resides.
I'm stuck and need some help.

_________________
Currently working on my first VN : Nostalgic Mist
deviantART

Image


Top
 Profile Send private message  
 
PostPosted: Sun Aug 05, 2012 1:06 am 
Veteran

Joined: Tue Jun 05, 2012 2:01 am
Posts: 381
Try:

Code:
menu:
    kasu "Today looks glorious. {w}I wonder which route I should take?"
    "Take long way":
        $ gift = "bracelet"
        stop music
        jump long_way
    "Take shortcut":
        $ gift = "none"
        jump shortcut


More generally, a common issue which leads NameErrors is loading from an out-of-date save.


Top
 Profile Send private message  
 
PostPosted: Sun Aug 05, 2012 9:33 am 
Newbie
User avatar

Joined: Mon Jun 25, 2012 9:33 am
Posts: 19
Location: United States
Projects: Nostalgic Mist
Organization: Childhood In a Box Studios
Oh wow, thank you so much.

Oh, if that's true about NameErrors then I will make sure to update my saves then. Thanks again ^^

_________________
Currently working on my first VN : Nostalgic Mist
deviantART

Image


Top
 Profile Send private message  
 
PostPosted: Sun Aug 05, 2012 10:22 am 
Ren'Py Creator
User avatar

Joined: Mon Feb 02, 2004 10:58 am
Posts: 10785
Location: Kings Park, NY
Completed: Moonlight Walks
Projects: Ren'Py
Note that you can create an after_load label to update the saves for you:

Code:
label after_load:
    if not hasattr(store, 'gift'):
         $ gift = False
    return

_________________
Another Old-Fashioned Bishoujo Gamer
Supporting creators since 2004; Code > Drama
(When was the last time you backed up your game?)
"It is not the critic who counts; not the man who points out how the strong man stumbles, or where the doer of deeds could have done them better. The credit belongs to the man who is actually in the arena, whose face in marred by dust and sweat and blood; who strives valiantly; who errs, who comes short again and again, because there is no effort without error and shortcoming" - Theodore Roosevelt


Top
 Profile Send private message  
 
PostPosted: Sun Aug 05, 2012 10:04 pm 
Newbie
User avatar

Joined: Mon Jun 25, 2012 9:33 am
Posts: 19
Location: United States
Projects: Nostalgic Mist
Organization: Childhood In a Box Studios
So I include this in the script as well?
I'm glad to know some new information :mrgreen:
Thanks again for the help ^^

_________________
Currently working on my first VN : Nostalgic Mist
deviantART

Image


Top
 Profile Send private message  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: Donmai


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Protected by Anti-Spam ACP
Powered by phpBB® Forum Software © phpBB Group