define persistent.whatsThisMttkMod = "mttkMod 1.3.Week_1 for - Ecchi Sensei week1 - Week_1 -   open source and public domain and not fit for anything"#var not to be used, just have some "comment surviving decompilation"

define mttkModLicense = """THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS
OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."""


label splashscreen_mtk:
    if (persistent.mttkModdedGameName==config.name and (config.version in persistent.mttkModdedVersionsList)):
        if not(renpy.loadable("mod/Lain_Mod.rpyc")):
            show warning01 with fade
            pause
            play sound warning
            hide warning01
            show warning02
            pause
            hide warning02
            show warning03
            pause
            hide warning03
        $ dm_files = renpy.loadable("chars/id/becky_id_dm.png")
        if persistent.DM and not dm_files:
            "You activated Dark Mind but you're not using the latest patch. For more information, click {a=https://lewdpatcher.com/game/ecchi-sensei}{b}>here<{/b}{/a}"
            $ renpy.pause(2.0,hard=True)
        return
    else:
        $ mttkModDefTextThIsWronGameVer()
        ""
        $ renpy.quit(relaunch=False, status=0, save=False)
    return#extra-safety


init python:
    persistent.mttkModdedGameName="Ecchi Sensei week1"
    persistent.mttkModdedVersionsList=["Week_1"]
    def mttkModDefTextThIsWronGameVer():##from mttkModSupport
        ui.frame(xalign=0.5, yalign=0.5, padding=(30, 30), background="#000000")
        ui.vbox()
        ui.text("{color=#fff}------{/color}")
        ui.text("{color=#fff}WRONG mod([persistent.mttkModdedGameName]) or version([persistent.mttkModdedVersionsList]){/color}")
        ui.text("{color=#fff}for this game([config.name]) -version([config.version])! Please close this game and{/color}")
        ui.text("{color=#fff}{size=+10}delete all *MttkMod*.*-files and -folders,{/size}{/color}")
        ui.text("{color=#fff}from the game-folder of this game([config.name]).{/color}")
        ui.text("{color=#fff}Then you can play the game without wrong mod.{/color}")
        ui.text("{color=#fff}------{/color}")
        ui.close()
        return
    persistent.mttkModBoolQuitConfirm = False
    _confirm_quit = persistent.mttkModBoolQuitConfirm
    config.quit_action = Quit(confirm=persistent.mttkModBoolQuitConfirm)
    config.underlay[0].keymap['quickSave']=QuickSave(message=_("Quick save complete."))#chngd;)
    config.keymap['quickSave']='K_F5'
    config.underlay[0].keymap['quickLoad']=QuickLoad(True)#chngd;)
    config.keymap['quickLoad']='K_F9'##end from mttkModSupport
    if persistent.mttkModBoolUseLainGal==None:
        if renpy.loadable("mod/Lain_Mod.rpyc"):
            persistent.mttkModBoolUseLainGal = True
        else:
            persistent.mttkModBoolUseLainGal = False
    if persistent.mttkModBoolUseMiniQuickMenu==None:
        persistent.mttkModBoolUseMiniQuickMenu = True
        quick_menu = True
init 11 python:
    if not hasattr(renpy.config, "label_overrides"):##extra-safety
        config.label_overrides = {}
    config.label_overrides['splashscreen']='splashscreen_mtk'
    persistent.whatsThisMttkMod = None##from mttkModSupport
    delattr(persistent, "whatsThisMttkMod")#as this is for the files only...


##image-typos
image loadingdhs_ = "images/D4dream/loadingdhs_fuyu.png"#typo in Days/D4.rpy (both)
image city1_6 = "images/D5/hotel1_1.jpg"#missing in Days/D5.rpy (both) (taking next)
image flash = "images/white.png"#typo in Days/D7.rpy (both)


##reenable notify...(e.g. for quicksave-feedback)
init 1 screen notify(message):
    zorder 100
    style_prefix "notify"
    if (message=="contact" or message=="message"):
        frame at notify_appear:
            if message == "contact":
                add "notify"
            if message == "message":
                add "message_add"
    else:
        frame at notify_appear:
            #xalign 1.03#would be ~ok~ but "over" the hud....
            xalign 0.0
            yalign 0.12
            text "[message!tq]" color "#aaa" outlines [(1, "#000", 0, 0)]
    timer 3.5 action Hide('notify')


##add some options
init 1 screen CheatMenu():
    add "menu/blueborder.png"
    if persistent.patched:
        if persistent.DM:
            #textbutton _("{b}{color=#ffffff}Dark Mind Version :{/color} {color=#00FF00}ON{/color}{/b}") action [SetField(persistent, "DM",False),Hide("CheatMenu")] xalign 0.5 yalign 0.5
            textbutton _("{b}{color=#ffffff}Dark Mind Version :{/color} {color=#00FF00}ON{/color}{/b}") action [SetField(persistent, "DM",False),Hide("CheatMenu")] xalign 0.5 yalign 0.36
        if not persistent.DM:
            #textbutton _("{b}{color=#ffffff}Dark Mind Version :{/color} {color=#FF0000}OFF{/color}{/b}") action [SetField(persistent, "DM",True),Hide("CheatMenu")] xalign 0.5 yalign 0.5
            textbutton _("{b}{color=#ffffff}Dark Mind Version :{/color} {color=#FF0000}OFF{/color}{/b}") action [SetField(persistent, "DM",True),Hide("CheatMenu")] xalign 0.5 yalign 0.36
    else:
        textbutton _("{b}{color=#ffffff}Dark Mind :{/color} {color=#FF0000}Not installed{/color}{/b}") action Hide("CheatMenu") xalign 0.5 yalign 0.36
    if main_menu:
        if quick_menu:
            if persistent.mttkModBoolUseMiniQuickMenu:
                textbutton _("{b}{color=#999999}RenPy quick-menu: Mini{/color}{/b}") action Hide("CheatMenu") xalign 0.5 yalign 0.46
            else:
                textbutton _("{b}{color=#999999}RenPy quick-menu: Full{/color}{/b}") action Hide("CheatMenu") xalign 0.5 yalign 0.46
        else:
            textbutton _("{b}{color=#999999}RenPy quick-menu: OFF{/color}{/b}") action Hide("CheatMenu") xalign 0.5 yalign 0.46
        textbutton _("{b}{color=#999999}show the RenPy history{/color}{/b}") action Hide("CheatMenu") xalign 0.5 yalign 0.5
    else:
        if quick_menu:
            if persistent.mttkModBoolUseMiniQuickMenu:
                textbutton _("{b}{color=#ffffff}RenPy quick-menu:{/color} {color=#FFFF00}Mini{/color}{/b}") action [SetVariable("quick_menu", False), SetField(persistent, "mttkModBoolUseMiniQuickMenu", False), Hide("CheatMenu")] xalign 0.5 yalign 0.46
            else:
                textbutton _("{b}{color=#ffffff}RenPy quick-menu:{/color} {color=#00FF00}Full{/color}{/b}") action [SetVariable("quick_menu", True), SetField(persistent, "mttkModBoolUseMiniQuickMenu", True), Hide("CheatMenu")] xalign 0.5 yalign 0.46
        else:
            textbutton _("{b}{color=#ffffff}RenPy quick-menu:{/color} {color=#FF0000}OFF{/color}{/b}") action [SetVariable("quick_menu", True), SetField(persistent, "mttkModBoolUseMiniQuickMenu", False), Hide("CheatMenu")] xalign 0.5 yalign 0.46
        textbutton _("{b}{color=#ffffff}show the RenPy-history{/color}{/b}") action [Hide("CheatMenu"), ShowMenu('history')] xalign 0.5 yalign 0.5
    textbutton _("{b}{color=#FF0000}Stop{/color} {color=#ffffff}Music Playback{/color}{/b}") action [Stop("music"), SetVariable("current_song", None), Hide("CheatMenu")] xalign 0.5 yalign 0.54
    if persistent.mttkModBoolQuitConfirm:
        textbutton _("{b}{color=#ffffff}Confirm quitting game:{/color} {color=#00FF00}ON{/color}{/b}") action [SetField(persistent, "mttkModBoolQuitConfirm", False), Hide("CheatMenu")] xalign 0.5 yalign 0.58
    if not persistent.mttkModBoolQuitConfirm:
        textbutton _("{b}{color=#ffffff}Confirm quitting game:{/color} {color=#FF0000}OFF{/color}{/b}") action [SetField(persistent, "mttkModBoolQuitConfirm", True), Hide("CheatMenu")] xalign 0.5 yalign 0.58
    if renpy.loadable("mod/Lain_Mod.rpyc"):
        if persistent.mttkModBoolUseLainGal:
            textbutton _("{b}{color=#ffffff}Use LainMod Gallery:{/color} {color=#00FF00}ON{/color}{/b}") action [SetField(persistent, "mttkModBoolUseLainGal", False), Hide("CheatMenu")] xalign 0.5 yalign 0.62
        if not persistent.mttkModBoolUseLainGal:
            textbutton _("{b}{color=#ffffff}Use LainMod Gallery:{/color} {color=#FF0000}OFF{/color}{/b}") action [SetField(persistent, "mttkModBoolUseLainGal", True), Hide("CheatMenu")] xalign 0.5 yalign 0.62
    ##pot.future-cheat
    #if (not(d6d12) and not(d6d13)):
        #pass
    #elif (d6d12 and d6d13):
        #pass
    #elif d6d12:
        #textbutton "cheat: have had sole time with Ina also" action SetVariable("d6d13", True) xalign 0.5 yalign 0.72
    #elif d6d13:
        #textbutton "cheat: have had sole time with Suzu-chan also" action [SetVariable("d6d12", True), Function(charinfo, "Suzuka", "sex", "descriptionp", "Suzu really is a great woman. I enjoy spending time with her and we kissed already, too...")] xalign 0.5 yalign 0.72



##use of different galleries
init 970 screen navigation():
    if main_menu:
        imagemap:
            #if persistent.patched:
            auto "gui/_lain/navigation/nav_mm_dm_%s.png"
            #else:
                #auto "gui/_lain/navigation/nav_mm_%s.png"
            #if persistent.patched:
            hotspot (0, 0, 360, 180) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action Show("CheatMenu")
            hotspot (0, 0, 360, 180) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action Show("CheatMenu")
            hotspot (59, 182, 214, 91) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action Start()
            hotspot (70, 289, 232, 96) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action ShowMenu("load")
            hotspot (30, 399, 277, 91) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action ShowMenu("preferences")
            if not _in_replay:
                #hotspot (55, 505, 250, 97) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action ShowMenu("scenegal_p1")
                if (renpy.loadable("mod/Lain_Mod.rpyc") and persistent.mttkModBoolUseLainGal):
                    hotspot (55, 505, 250, 97) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action [ui.callsinnewcontext("call_gallery"), ShowMenu("lain_gallery_p1")]
                else:
                    hotspot (55, 505, 250, 97) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action ShowMenu("scenegal_p1")
            else:
                hotspot (55, 505, 250, 97) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action EndReplay(confirm=True)
            hotspot (35, 613, 252, 94) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action ShowMenu("music_gallery",True)
            hotspot (54, 725, 233, 91) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action ShowMenu("about")
            hotspot (32, 829, 292, 97) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action OpenURL("https://www.patreon.com/posts/29377062/")
            #hotspot (0, 926, 360, 154) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action Quit(confirm=not main_menu)
            hotspot (0, 926, 360, 154) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action Quit(confirm=persistent.mttkModBoolQuitConfirm)
    else:
        imagemap:
            #if persistent.patched:
            auto "gui/_lain/navigation/nav_dm_%s.png"
            #else:
                #auto "gui/_lain/navigation/nav_%s.png"
            #if persistent.patched:
            hotspot (0, 0, 360, 180) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action Show("CheatMenu")
            hotspot (59, 182, 214, 91) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action ShowMenu("save")
            hotspot (70, 289, 232, 96) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action ShowMenu("load")
            hotspot (30, 399, 277, 91) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action ShowMenu("preferences")
            if not _in_replay:
                #hotspot (55, 505, 250, 97) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action ShowMenu("scenegal_p1")
                if (renpy.loadable("mod/Lain_Mod.rpyc") and persistent.mttkModBoolUseLainGal):
                    hotspot (55, 505, 250, 97) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action [ui.callsinnewcontext("call_gallery"), ShowMenu("lain_gallery_p1")]
                else:
                    hotspot (55, 505, 250, 97) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action ShowMenu("scenegal_p1")
            else:
                hotspot (55, 505, 250, 97) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action EndReplay(confirm=True)
            hotspot (35, 613, 252, 94) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action ShowMenu("music_gallery",True)
            hotspot (54, 725, 233, 91) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action ShowMenu("about")
            hotspot (32, 829, 292, 97) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action OpenURL("https://www.patreon.com/posts/29377062/")
            #hotspot (0, 926, 360, 154) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action Quit(confirm=not main_menu)
            hotspot (0, 926, 360, 154) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") action Quit(confirm=persistent.mttkModBoolQuitConfirm)


##loading screen (lousily) shows load (instead of save)
image mttkModImgLoadBG_idle = Composite(
    (1920, 1080),
    (0, 0), "gui/_lain/save_load_scr/bg_idle.png",
    (1056, 18), im.Crop("gui/_lain/navigation/nav_idle.png", (90, 298, 168, 66)) )
image mttkModImgLoadBG_hover = Composite(
    (1920, 1080),
    (0, 0), "gui/_lain/save_load_scr/bg_hover.png",
    (1056, 18), im.Crop("gui/_lain/navigation/nav_idle.png", (90, 298, 168, 66)) )
init 1 screen load():
    tag menu
    imagemap:
        auto "mttkModImgLoadBG_%s"
        hotspot (1799, 11, 111, 110) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") activate_sound "etc/sfx/button_exit.ogg" action Return()
    use file_slots(_("Load"))

##"revive" the different colors for the slot-text
init offset=1
define gui.slot_button_text_idle_color = '#ffffff'#'#888888'
define gui.slot_button_text_selected_idle_color = '#ffffff'#'#555555'#damn this is not the newest...#define gui.slot_button_text_selected_idle_color = '#ff8888'#'#555555'
define gui.slot_button_text_hover_color = '#0000ff'#gui.hover_color = '#0099ff'
define gui.slot_button_text_selected_hover_color = '#0000ff'#'#0099ff'
define gui.slot_button_text_insensitive_color = '#555555'#gui.insensitive_color = '#aaaaaa7f'
init offset=0
##make the save-game-page-name editable again and be able to access more save-game-pages more easily
init 1 screen save():
    tag menu
    imagemap:
        auto "gui/_lain/save_load_scr/bg_%s.png"
        hotspot (1799, 11, 111, 110) hovered Play("sound", "etc/sfx/btn_hovered.mp3") unhovered Play("sound", "etc/sfx/btn_unhovered.mp3") activate_sound "etc/sfx/button_exit.ogg" action Return()
    use file_slots(_("Save"))
init 1 screen file_slots(title=""):
    default page_name_value = FilePageNameInputValue(pattern=_("Day {}"), auto=_("Automatic saves"), quick=_("Quick saves"))
    use navigation()
    fixed pos (180, 10):
        order_reverse True
        button:
            style "page_label"
            key_events True
            xalign 0.5
            yalign 0.11#0.12
            action page_name_value.Toggle()
            input:
                style "page_label_text"
                size gui.label_text_size+8
                bold True
                outlines [(2, "#000", 0, 0)]
                value page_name_value
        grid gui.file_slot_cols gui.file_slot_rows:
            style_prefix "slot"
            xalign 0.5
            yalign 0.5
            #spacing gui.slot_spacing
            xspacing gui.slot_spacing
            yspacing gui.slot_spacing+gui.slot_button_text_size
            for i in range(gui.file_slot_cols * gui.file_slot_rows):
                $ slot = i + 1
                if title==_("Save"):
                    button:
                        action [SetField(persistent,'save_slot',str(persistent._file_page) + '-' + str(slot)), FileAction(slot), Play("sound", "etc/sfx/save_save.mp3")]#imho the persistent here(set by dev), is not needed when saving...but you never know;)
                        has vbox
                        add FileScreenshot(slot) xalign 0.5
                        null height 5
                        hbox xalign 0.5:
                            imagebutton:
                                xalign 0.5
                                idle Transform("menu/rename.png", zoom=0.5)
                                hover Transform("menu/rename1.png", zoom=0.5)
                                action NullAction()
                            if not FileSaveName(slot) == "":
                                null width 10
                            if FileNewest(slot):#
                                text FileSaveName(slot):#
                                    style "slot_name_text" color "ff8888" hover_color "#0000ff"#
                            else:#
                                text FileSaveName(slot):
                                    style "slot_name_text"# color "#fff"
                        if FileNewest(slot):#
                            text FileTime(slot, format=_("{#file_time}%d %b %Y, %H:%M"), empty=_("empty slot")):#
                                style "slot_time_text" color "ff8888" hover_color "#0000ff"#
                        else:#
                            text FileTime(slot, format=_("{#file_time}%d %b %Y, %H:%M"), empty=_("empty slot")):#
                                style "slot_time_text"#
                        key "save_delete" action [FileDelete(slot), Play("sound", "etc/sfx/delete_save.mp3")]
                else:
                    button:
                        action [SetField(persistent,'save_slot',str(persistent._file_page) + '-' + str(slot)), FileAction(slot)]#the persistent here(set by dev), is used in the after_load to verify game-version (therefore not needed when saving)
                        has vbox
                        add FileScreenshot(slot) xalign 0.5
                        null height 5
                        hbox xalign 0.5:
                            imagebutton:
                                xalign 0.5
                                idle Transform("menu/rename.png", zoom=0.5)
                                hover Transform("menu/rename1.png", zoom=0.5)
                                action NullAction()
                            if not FileSaveName(slot) == "":
                                null width 10
                            if FileNewest(slot):#
                                text FileSaveName(slot):#
                                    style "slot_name_text" color "ff8888" hover_color "#0000ff"#
                            else:#
                                text FileSaveName(slot):
                                    style "slot_name_text"# color "#fff"
                        if FileNewest(slot):#
                            text FileTime(slot, format=_("{#file_time}%d %b %Y, %H:%M"), empty=_("empty slot")):#
                                style "slot_time_text" color "ff8888" hover_color "#0000ff"#
                        else:#
                            text FileTime(slot, format=_("{#file_time}%d %b %Y, %H:%M"), empty=_("empty slot")):#
                                style "slot_time_text"#
                        key "save_delete" action [FileDelete(slot), Play("sound", "etc/sfx/delete_save.mp3")]
        hbox:
            style_prefix "page"
            xalign 0.5
            yalign 0.93#1.0
            spacing gui.page_spacing
            textbutton _("<") action FilePagePrevious()
            if config.has_autosave:
                textbutton _("{#auto_page}A") action FilePage("auto")
            if config.has_quicksave:
                textbutton _("{#quick_page}Q") action FilePage("quick")
            #for page in range(1, 10):
                #textbutton "Day[page]" action FilePage(page)
            if (persistent._file_page=="auto" or persistent._file_page=="quick"):
                for page in range(1, 11):
                    textbutton "[page]" action FilePage(page)
                textbutton "20" action FilePage(20)
            else:
                $ i = -1
                $ i = int(persistent._file_page)
                if str(i)!=persistent._file_page:##safety
                    $ i = 1
                elif i < 1:##safety2
                    $ i = 1
                elif i < 10:
                    pass
                elif i < 20:
                    textbutton "1" action FilePage( 1 )
                    textbutton "10" action FilePage( 10 )
                elif i < 90:
                    textbutton str( ((abs(i) // 10)*10)-10 ) action FilePage( ((abs(i) // 10)*10)-10 )
                    textbutton str( (abs(i) // 10)*10 ) action FilePage( (abs(i) // 10)*10 )
                else:# >=90
                    textbutton str( ((abs(i) // 10)*10)-40 ) action FilePage( ((abs(i) // 10)*10)-40 )
                    textbutton str( ((abs(i) // 10)*10)-10 ) action FilePage( ((abs(i) // 10)*10)-10 )
                    textbutton str( (abs(i) // 10)*10 ) action FilePage( (abs(i) // 10)*10 )
                for page in range( ( ((abs(i) // 10)*10)+1 ), ( ((abs(i) // 10)*10)+10  ) ):
                    textbutton "[page]" action FilePage(page)
                if i < 10:
                    textbutton "10" action FilePage( 10 )
                    textbutton "20" action FilePage( 20 )
                elif i < 90:
                    textbutton str( ((abs(i) // 10)*10)+10 ) action FilePage( ((abs(i) // 10)*10)+10 )
            textbutton _(">") action FilePageNext()


##my quick_menu
init 1 screen quick_menu():
    zorder 100
    if quick_menu:
        if persistent.mttkModBoolUseMiniQuickMenu:
            hbox:
                style_prefix "quick"
                xalign 0.01
                yalign 1.0
                textbutton _("History") action ShowMenu('history')
                textbutton _("Skip") action Skip()
        else:
            hbox:
                style_prefix "quick"
                xalign 0.5
                yalign 1.0
                textbutton _("Back") action Rollback()
                textbutton _("History") action ShowMenu('history')
                textbutton _("Skip") action Skip() alternate Skip(fast=True, confirm=True)
                textbutton _("Auto") action Preference("auto-forward", "toggle")
                textbutton _("Save") action ShowMenu('save')
                textbutton _("Q.Save") action QuickSave()
                textbutton _("Q.Load") action QuickLoad()
                textbutton _("Prefs") action ShowMenu('preferences')


##added my beloved SPACE-key to get to read the next message ; and a lil betterment to have the message-viewport to scroll to the last sent message...
init 1 screen messager(who):
    modal True
    layer 'ecchi'
    key "K_SPACE" action [Function(t_skip), Scroll("mttkModVPIDmessa", "vertical increase", 443)]#I'm not senselessly mouse-clicking around...
    key "dismiss" action [Function(t_skip), Scroll("mttkModVPIDmessa", "vertical increase", 443)]#unluckily this scroll happens before the new message is drawn!...see down
    $ name = av_contacts[who]['name']
    if av_contacts[who]['online'] == True:
        $ status ="online"
    elif av_contacts[who]['online'] == False:
        $ status ="offline"
    imagemap:
        ground "phone/messengerphone.png"
        hover "phone/messengerphone2.png"
        yalign 0.5 xalign 0.5
        hotspot (226, 1047, 142, 100) action [Hide('messager'),Show("phone_contacts")]
        if not av_contacts[who]['incomming'] == []:
            if av_contacts[who]['incomming'][0] == []:
                $ del av_contacts[who]['incomming'][0]
            if not av_contacts[who]["incomming"] == []:
                if not av_contacts[who]["incomming"][0] == []:
                    hotspot (362, 710, 240, 367) action [Function(t_skip), Scroll("mttkModVPIDmessa", "vertical increase", 443)]#
                    hotspot (0, 714, 232, 363) action [Function(t_skip), Scroll("mttkModVPIDmessa", "vertical increase", 443)]#
                    hotspot (12, 711, 590, 336) action [Function(t_skip), Scroll("mttkModVPIDmessa", "vertical increase", 443)]#
        hotspot (36, 657, 518, 55) action [Function(t_skipall)]
    viewport id "mttkModVPIDmessa":#id needed for Scroll()
        arrowkeys True#better than moving hand to mouse imho
        area (700,180,600,443)
        xminimum 300
        xmaximum 500
        xoffset 3
        yinitial 1.0
        draggable True
        mousewheel True
        scrollbars "vertical"
        has vbox:
            first_spacing 30
            spacing 30
        text ""
        for messages in av_contacts[who]["messages"]:
            frame:
                if 0 in messages:
                    background Solid("#d9398ccd")
                if 1 in messages:
                    left_margin 200
                    background Solid("#10721dcd")
                    xsize 500
                vbox:
                    if "text" in messages:
                        $ message = messages[2]
                        text "{color=#ffffff}[message]{/color}" style "phone_message_what"
                    if "pic" in messages:
                        $ message = messages[2]
                        $ img = messages[3]
                        text "{color=#ffffff}[message]{/color}" style "phone_message_what"
                        imagebutton:
                            idle im.FactorScale(img,0.15,0.23)
                            hover im.FactorScale(img,0.15,0.23)
                            action Show('pic_view',pic=img)
        if av_contacts[who]["incomming_m"]:
            if not av_contacts[who]["incomming"] == [] and not [] in av_contacts[who]["incomming"]:
                frame:
                    if av_contacts[who]["incomming"][0][0][1] == 0:
                        background Solid("#d9398c00")
                    if av_contacts[who]["incomming"][0][0][1] == 1:
                        left_margin 390
                        background Solid("#10721d00")
                        xsize 500
                    vbox:
                        add "wait2"
        else:
            pass
        text "\n"###truly lame, but atm I don't have a better idea...
    add im.FactorScale("heads/normal/"+who+".png",0.115) yalign 0.11 xalign 0.4
    add im.FactorScale("phone/status_charprofile" + status +".png",0.41) yalign 0.106 xalign 0.4
    if name == "Sloth-chan":
        text "[name]" yalign 0.11 xalign 0.50 bold True size 35
    else:
        text "[name]" yalign 0.11 xalign 0.48 bold True size 35



##eof

