syntax error help (resolved)

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
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.
Post Reply
Message
Author
carlobalsti11
Newbie
Posts: 2
Joined: Mon Nov 06, 2017 6:54 pm
Contact:

syntax error help (resolved)

#1 Post by carlobalsti11 »

Im fairly new to renpy. been trying to learn bits and pieces from tutorials and available code. so if the solution here is simple i apologize for not realizing.

Code: Select all

    label mapinitial:
        $ location_count = 'Game Map'
        if mapinit_count == 0:
            scene gamemap
            show testdef
            a "I should head to school I guess."
            a "hope this works."
            hide testdef with dissolve
            $ mapinit_count = 1
        else:
            show screen map
    screen map:						12
        $ location_count = 'Game Map'
        if mapstart_count == 0:				14
            add gamemap
            imagebutton:				16
                hover "map/home.png"
                action ["I just left though.",Jump map]	18
                xpos 8
                ypos 154
            imagebutton:
                hover "map/store.png"
                action ["Its closed from dogs eating all the food again.", Jump map]
                xpos 105
                ypos 416
            imagebutton:
                hover "map/school.png"
                action ["Better get to school for thins",Hide ("map"), Jump ("schoolgyminit")]
                xpos 643
                ypos 169
        elif mapstart_count == 1:
            add gamemap
            imagebutton:
                hover "map/home.png"
                action [Hide ("map"),Jump ("homeinit")]
                xpos 8
                ypos 154
            imagebutton:
                hover "map/store.png"
                action NullAction()
                xpos 105
                ypos 416
            imagebutton:
                hover "map/school.png"
                action NullAction()
                xpos 643
                ypos 169
I'm sorry, but an uncaught exception occurred.

After initialization, but before game start.
File "game/map.rpy", line 12, in prepare_screen
screen map:
File "game/map.rpy", line 12, in prepare
screen map:
File "game/map.rpy", line 14, in prepare
if mapstart_count == 0:
File "game/map.rpy", line 14, in prepare
if mapstart_count == 0:
File "game/map.rpy", line 16, in prepare
imagebutton:
File "game/map.rpy", line 16, in prepare
imagebutton:
SyntaxError: invalid syntax (game/map.rpy, line 18)

Any help would be appreciated greatly.
Last edited by carlobalsti11 on Tue Nov 07, 2017 5:59 am, edited 1 time in total.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: syntax error help

#2 Post by Divona »

Code: Select all

action ["I just left though.",Jump map]
What with the text "I just left though." in action? That's not screen action. I assumed you're trying to have the narrator say that line? The easiest way is to jump to the appropriate label that says those line instead. Also, you can't jump to screen "map". Here is my guess of what you're trying to do:

Code: Select all

    label mapinitial:
        $ location_count = 'Game Map'
        if mapinit_count == 0:
            scene gamemap
            show testdef
            a "I should head to school I guess."
            a "hope this works."
            hide testdef with dissolve
            $ mapinit_count = 1
        jump town_map

    label town_map:
        call screen map
            
    screen map():
    
        on "show" action SetVariable("location_count", "Game Map")

        if mapstart_count == 0:
            add gamemap

            imagebutton:
                hover "map/home.png"
                action Jump("map_home")
                xpos 8
                ypos 154
                
            imagebutton:
                hover "map/store.png"
                action Jump("map_store")
                xpos 105
                ypos 416
                
label map_home:

    "I just left though."
    jump town_map
    
label map_store:

    "Its closed from dogs eating all the food again."
    jump town_map
Other thing, imagebutton take at least "idle" image, which doesn't seem like you have. This may bring another error later on:

Code: Select all

Exception: Imagebutton does not have a idle image.
I'm surprised that it doesn't bring that error up now.
Completed:
Image

carlobalsti11
Newbie
Posts: 2
Joined: Mon Nov 06, 2017 6:54 pm
Contact:

Re: syntax error help

#3 Post by carlobalsti11 »

Divona wrote: Tue Nov 07, 2017 4:57 am

Code: Select all

action ["I just left though.",Jump map]
What with the text "I just left though." in action? That's not screen action. I assumed you're trying to have the narrator say that line? The easiest way is to jump to the appropriate label that says those line instead. Also, you can't jump to screen "map". Here is my guess of what you're trying to do:

Code: Select all

    label mapinitial:
        $ location_count = 'Game Map'
        if mapinit_count == 0:
            scene gamemap
            show testdef
            a "I should head to school I guess."
            a "hope this works."
            hide testdef with dissolve
            $ mapinit_count = 1
        jump town_map

    label town_map:
        call screen map
            
    screen map():
    
        on "show" action SetVariable("location_count", "Game Map")

        if mapstart_count == 0:
            add gamemap

            imagebutton:
                hover "map/home.png"
                action Jump("map_home")
                xpos 8
                ypos 154
                
            imagebutton:
                hover "map/store.png"
                action Jump("map_store")
                xpos 105
                ypos 416
                
label map_home:

    "I just left though."
    jump town_map
    
label map_store:

    "Its closed from dogs eating all the food again."
    jump town_map
ah it worked, much obliged. Yeah I dont know what I was thinking assuming that would work, putting speech in the action.
Other thing, imagebutton take at least "idle" image, which doesn't seem like you have. This may bring another error later on:

Code: Select all

Exception: Imagebutton does not have a idle image.
I'm surprised that it doesn't bring that error up now.
was worried about that too, since it didnt say there was an issue i hoped i could just use a flat map with the idle locations painted on, running just now showed that was not the case. have to make that change. thank you very much, theres alot i need to learn, thank you in teaching and helping here

Post Reply

Who is online

Users browsing this forum: No registered users