renply function

Cohibozz

Member
Aug 14, 2018
125
27
hi all.
i've on my screen script this:
Code:
screen mc_room_hm1:
        zorder 0
        modal True
        if 4 < time < 18:
            add "cielo sereno giorno.png"
        else:
            if 17 < time < 21:
                add "cielo sereno sera.png"
            else:
                add "black"
        add "mc_room_hm1.png"
        imagebutton auto "pcmyroom_%s.png" xpos 1210 ypos 380 focus_mask True action Call("pcmyroom")
the part in if statement is for show on bg under the scene the sky to show it on the windows (transparent on scene).

it work perfectly but my question is.

the best way to declare it permanently and use on my screen when i need it?
 

Cohibozz

Member
Aug 14, 2018
125
27
I can declare it in another screen and then call it first of the screen room function with zorder 0 and call room with higher zorder.
But if I want call it inside the screen how to?
 

anne O'nymous

I'm not grumpy, I'm just coded that way.
Modder
Respected User
Donor
Jun 10, 2017
10,263
15,065
the best way to declare it permanently and use on my screen when i need it?
Code:
screen mc_room_sky:
        tag "sky"
        zorder 0
        if 4 < time < 18:
            add "cielo sereno giorno.png"
        elif 17 < time < 21:
            add "cielo sereno sera.png"
        else:
            add "black"
Then you just the screen. It will not be removed unless you reset the whole scene, hide the screen, or display another screen with the same tag.

If you need this "sky" on many location, you can also do something like this :
Code:
init python:
   skies: { "mc_room": [ "cielo sereno giorno.png", "cielo sereno sera.png", "black" ],
                "living_room": [ "cielo giorno living room.png", "cielo sera living room.png", "black" ] }

[...]

screen sky:
        tag "sky"
        zorder 0
        if 4 < time < 18:
            add skies[currentLocation][0]
        elif 17 < time < 21:
            add skies[currentLocation][1]
        else:
            add skies[currentLocation][2]
[...]

label sometimeInMCRoom:
    $ currentLocation = "mc_room"
    [...]

label sometimeInLivingroom:
    $ currentLocation = "living_room"
    [...]
Then the same screen will display the right sky, according to the actual location and the actual time of the day. This without the need to show it again.

If you need to reset the screen time to time, it can be better to it from other screens :
Code:
screen mc_room_hm1:

    modal True

    use sky

    add "mc_room_hm1.png"
    imagebutton auto "pcmyroom_%s.png" xpos 1210 ypos 380 focus_mask True action Call("pcmyroom")
or to define it as , which will display them whatever happen to the screen.
 

the66

beware, the germans are cumming
Modder
Respected User
Donor
Jan 27, 2017
7,624
23,625
or you can try
Code:
image background = ConditionSwitch(
   "4 < time < 18", "cielo sereno giorno.png",
   "17 < time < 21", "cielo sereno sera.png",
   "True", "black.png")
look here ►
 
  • Like
Reactions: Palanto