location system with list and imagebutton

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.
Message
Author
User avatar
Ocelot
Lemma-Class Veteran
Posts: 2402
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: location system with list and imagebutton

#16 Post by Ocelot »

Is there anything changing location after initial assignment?
< < insert Rick Cook quote here > >

Psion
Regular
Posts: 25
Joined: Fri Dec 11, 2020 4:01 pm
Contact:

Re: location system with list and imagebutton

#17 Post by Psion »

well, i have map system that works, if i understand your question correctly. it works fine.

Code: Select all


screen topBAR():
    imagebutton:
        xpos 25
        ypos 100
        focus_mask True
        hover "/ui/map/mapicon.jpg"
        idle "/ui/map/mapicon.jpg"
        action SetVariable("clickType", "mapOpen"), Return(None)
        
label mapNav:
    $ UIreturn = renpy.call_screen("map")
    if clickType == "mapCancel":
        return
    if clickType == "mapSelect":
        $ location = UIreturn
    return

screen map():
    add "/ui/map/mapbg.jpg"
    imagebutton:
        xpos 25
        ypos 100
        hover "/ui/map/mapicon.jpg"
        idle "/ui/map/mapicon.jpg"
        action SetVariable("clickType", "mapCancel"), Return(None)

    for q in Rooms:
        if q.mapped:
            $ TempName = "/ui/map/map_" + q.name + ".png"
            imagebutton:
                idle TempName
                hover TempName
                focus_mask True
                action SetVariable("clickType", "mapSelect"), Return(q.name)

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2402
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: location system with list and imagebutton

#18 Post by Ocelot »

Oh, I noticed the problem. You are returning q.locs, which is a list of strings, not a single string. I think, you meant to use Return(w) in imagebutton code.
< < insert Rick Cook quote here > >

Psion
Regular
Posts: 25
Joined: Fri Dec 11, 2020 4:01 pm
Contact:

Re: location system with list and imagebutton

#19 Post by Psion »

Yes, finaly! It works! Thank you very much.
Also tnx for hinting and explainig, not just giving the answer, i learned so much.

Post Reply

Who is online

Users browsing this forum: Google [Bot]