Converting this imagemap to UI or Screens

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
Lishy
Miko-Class Veteran
Posts: 555
Joined: Mon Oct 18, 2010 9:14 pm
Contact:

Converting this imagemap to UI or Screens

#1 Post by Lishy »

Hi!

Longstory short, due to some weird compatibility issues between ImageMaps and Windows 7 on my laptops, we need to convert these these two codes to use UI or Screens. Unfortunately, I'm not really familiar with screens or UI, and I've been trying and failing for the past half hour.

Could anyone help me convert this code, please?

Thank you!

ExtraMenu.rpy

Code: Select all

init:
    
    image extra_normal = "img/extramenu/extra.png"
    image extra_locked = "img/extramenu/extral.png"
    image extra_hover  = "img/extramenu/extrah.png"
    
    
label extra_menu_close:
    
    stop music fadeout 0.5
    $ hardfade()
    $ mm_skiptitletrans = True
    jump _invoke_main_menu
    return


label extra_menu:
    
    $ stop_skip_afm()
    
    play music "bgm/extrabgm.ogg"
    
    if persistent.review_unlocked:
        show extra_normal
    else:
        show extra_locked
        
    python:
        ui.layer("master")
        set_close_func("extra_menu_close")
        ui.close()
    
    $ renpy.transition(Dissolve(0.5))
    $ renpy.pause(0.5)
    
    if persistent.review_unlocked:
        $ result = renpy.imagemap("extra_normal", "extra_hover",
                                  [
                                       (209, 98, 433, 146, "review"), 
                                       (209, 178, 433, 226, "monologuelist"), 
                                       (209, 248, 433, 296, "exit")
                                  ],
                                  focus="imagemap")
        if result == "review":
            stop music fadeout 0.5
            $ hardfade()
            call all_cast_review_menu
        elif result == "monologuelist":
            stop music fadeout 0.5
            $ hardfade()
            call monologue_menu

        elif result == "exit":
            jump extra_menu_close
    else:
        $ result = renpy.imagemap("extra_locked", "extra_hover",
                                  [ 
                                      (209, 178, 433, 226, "monologuelist"), 
                                      (209, 248, 433, 296, "exit")
                                  ],
                                  focus="imagemap")
        if result == "monologuelist":
            stop music fadeout 0.5
            $ hardfade()
            call monologue_menu

        elif result == "exit":
            jump extra_menu_close

    jump extra_menu
    
IntermissionMenu.rpy

Code: Select all

init:
    
    image intermission_normal = "img/intermissionmenu/intermission.png"
    image intermission_hover  = "img/intermissionmenu/intermissionh.png"
    

label intermission_menu:
    
    $ enter_menu()
    $ clear_log()
    $ stop_skip_afm()
    
    if renpy.music.get_playing() != "bgm/extrabgm.ogg":
        play music "bgm/extrabgm.ogg"
    
    $ renpy.show("intermission_normal")
    $ renpy.transition(Dissolve(0.5))
    
    $ result = renpy.imagemap("intermission_normal", "intermission_hover",
                              [
                                  (209, 138, 433, 186, "monologues"),
                                  (209, 218, 433, 266, "save&load"), 
                                  (209, 298, 433, 346, "next")
                              ],
                              style=style.imagemap_button["Sound"],
                              focus="imagemap")
    
    if result == "monologues":
        stop music fadeout 0.5
        $ hardfade()
        call monologue_menu
    elif result == "save&load":
        $ renpy.take_screenshot()
        $ hardfade(0.15)
        call save_screen
    elif result == "next":
        stop music fadeout 0.5
        $ hardfade()
        $ enter_story()
        return

    jump intermission_menu
    
-

SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Converting this imagemap to UI or Screens

#2 Post by SundownKid »

This tutorial/VN might be of assistance: http://lemmasoft.renai.us/forums/viewto ... 53#p284753

It explains how to make UIs with screens and imagebuttons.

User avatar
Sslaxx
Regular
Posts: 52
Joined: Thu Jul 18, 2013 7:35 pm
Deviantart: sslaxx
Github: Sslaxx
Skype: Sslaxx
Location: Malvern, UK
Discord: Sslaxx#0159
Contact:

Re: Converting this imagemap to UI or Screens

#3 Post by Sslaxx »

SundownKid wrote:This tutorial/VN might be of assistance: http://lemmasoft.renai.us/forums/viewto ... 53#p284753

It explains how to make UIs with screens and imagebuttons.
How much of that is still best practice with 6.99?
Stuart "Sslaxx" Moore.

SundownKid
Lemma-Class Veteran
Posts: 2299
Joined: Mon Feb 06, 2012 9:50 pm
Completed: Icebound, Selenon Rising Ep. 1-2
Projects: Selenon Rising Ep. 3-4
Organization: Fastermind Games
Deviantart: sundownkid
Location: NYC
Contact:

Re: Converting this imagemap to UI or Screens

#4 Post by SundownKid »

Sslaxx wrote:
SundownKid wrote:This tutorial/VN might be of assistance: http://lemmasoft.renai.us/forums/viewto ... 53#p284753

It explains how to make UIs with screens and imagebuttons.
How much of that is still best practice with 6.99?
I have no idea, but all of it should be... Screen Language is still working nearly the same. I think one change might be that you have to put parenthesis now for the screen prediction code to work, like:

Code: Select all

screen thingy():
     button "Stuff"
And screens can take parameters now:

Code: Select all

screen center_text(s, size=42):
     text s size size

Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot]