Ren'Py i wanted to add an icon that opens up a map

Yass4Fake

Arabasta is a nightmare
Game Developer
Jun 27, 2019
43
27
hey i want to add an i con midgame that opens up a map after a so dialuoges but i kept getting errors this is my code

Python:
image map_menu = "map_menu.png"

label map_menu:
    show map_menu
imagebutton :
    pos(100, 100)
    auto "images/map_icon_%.png"
    action Jump("map_menu")
 

Milvidi

Member
Game Developer
Feb 26, 2018
200
498
Code:
image map_menu = "map_menu.png"

label start: (or whatever name you want)
    call screen map_button

label map_menu:
    show map_menu
    
screen map_button:
    imagebutton :
        pos(100, 100)
        auto "images/map_icon_%.png"
        action Jump("map_menu")
imagebutton has to be inside a screen. Then you will either show or call that screen inside a label.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172
hey i want to add an i con midgame that opens up a map after a so dialuoges but i kept getting errors this is my code
imagebutton is a screen statement, it need to be part of a screen...

Python:
screen UI():
    imagebutton:
        auto "images/map_icon_%s.png"
        action Show( "map_menu" )

screen map_menu():
    [...]

label start:
    show screen UI
    [...]
 

Yass4Fake

Arabasta is a nightmare
Game Developer
Jun 27, 2019
43
27
Code:
image map_menu = "map_menu.png"

label start: (or whatever name you want)
    call screen map_button

label map_menu:
    show map_menu
   
screen map_button:
    imagebutton :
        pos(100, 100)
        auto "images/map_icon_%.png"
        action Jump("map_menu")
imagebutton has to be inside a screen. Then you will either show or call that screen inside a label.
i did what you told me (or at least what i understanded) and nothing shows up on the screen
 

Milvidi

Member
Game Developer
Feb 26, 2018
200
498
i did what you told me (or at least what i understanded) and nothing shows up on the screen
Please show me your new code. Because if you copy and paste my code into a brand new project, then it works.
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Donor
Respected User
Jun 10, 2017
10,302
15,172
[...] then it works.
Not exactly, but not by your fault.
You wrote your code by editing the one he put in OP, and it happen that his code is broken. It have
auto "images/map_icon_%.png" in place of auto "images/map_icon_%s.png".
But yeah, once this small typo corrected, it works without problems.