Page 1 of 1

[SOLVED] Define Images After Initialization?

Posted: Wed Aug 12, 2020 11:20 pm
by WhiteFog
There may also be an easier way to do this, but this is the route my brain took.

So the opening of the game goes like so-

Code: Select all

label start:
    "Choose your appearance!"
    call screen character_select
Then said screen look like so...

Code: Select all

screen character_select:
    grid 5 2:
        imagebutton auto "MC/01MCNeutral1Uniform_%s.png" action Confirm('Is this correct?', yes=Return("1"), no=None, confirm_selected=False)
        imagebutton auto "MC/01FemMCNeutral1Uniform_%s.png" action Confirm('Is this correct?', yes=Return(2), no=None, confirm_selected=False)
        imagebutton auto "MC/02MCNeutral1Uniform_%s.png" action Confirm('Is this correct?', yes=Return(3), no=None, confirm_selected=False)
        imagebutton auto "MC/02FemMCNeutral1Uniform_%s.png" action Confirm('Is this correct?', yes=Return(4), no=None, confirm_selected=False)
        imagebutton auto "MC/03MCNeutral1Uniform_%s.png" action Confirm('Is this correct?', yes=Return(5), no=None, confirm_selected=False)

        imagebutton auto "MC/03FemMCNeutral1Uniform_%s.png" action Confirm('Is this correct?', yes=Return(6), no=None, confirm_selected=False)
        imagebutton auto "MC/04MCNeutral1Uniform_%s.png" action Confirm('Is this correct?', yes=Return(7), no=None, confirm_selected=False)
        imagebutton auto "MC/04FemMCNeutral1Uniform_%s.png" action Confirm('Is this correct?', yes=Return(8), no=None, confirm_selected=False)
        imagebutton auto "MC/05MCNeutral1Uniform_%s.png" action Confirm('Is this correct?', yes=Return(9), no=None, confirm_selected=False)
        imagebutton auto "MC/05FemMCNeutral1Uniform_%s.png" action Confirm('Is this correct?', yes=Return(0), no=None, confirm_selected=False)
The whole intro looks like this-

Code: Select all

label start:
    "Choose your appearance!"
    call screen character_select
    $ morgan = _return
    if morgan == 0:
        image mcav = "mc/0av.png"
    elif morgan == "1":
        image mcav = "mc/1av.png"
    elif morgan == 2:
        image mcav = "mc/2av.png"
    elif morgan == 3:
        image mcav = "mc/3av.png"
    elif morgan == 4:
        image mcav = "mc/4av.png"
    elif morgan == 5:
        image mcav = "mc/5av.png"
    elif morgan == 6:
        image mcav = "mc/6av.png"
    elif morgan == 7:
        image mcav = "mc/7av.png"
    elif morgan == 8:
        image mcav = "mc/8av.png"
    elif morgan == 9:
        image mcav = "mc/9av.png"
Unfortunately, and my one guess is that it's because the images are defined at initialization, no matter what I try, my mcav (Main Character Avatar) always ends up as 9av.png.

Obviously this is also spaghetti code and I'm sure there's a neater way to do it, but I would like to know if there's an easier way to simply use the art selected for the avatar. We've got 2 genders with 5 styles each, so having some way to actually show that on screen would be lovely.

Thank you in advance for ideas and clarifications!

Re: Define Images After Initialization?

Posted: Thu Aug 13, 2020 3:59 am
by IrinaLazareva

Code: Select all

default morgan = 0
image mcav = "mc/[morgan]av.png"

label start:
    "Choose your appearance!"
    call screen character_select
    $ morgan = _return

Re: Define Images After Initialization?

Posted: Thu Aug 13, 2020 9:33 am
by WhiteFog
I'll be damned. Much easier and it works! Thanks!