Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sugarcube 2: Avatar in Sidebar

I want to assign every player a random avatar at the beginning of the game. This assigned avatar should then be seen in the sidebar.

So I would write for example on the start page:
<<set $avatar to either ("[img[ava1]]", "[img[ava2]]")>>
<<remember $avatar>>

Your avatar is $avatar

and in the special passage StorySubtitle just:
$avatar

1. Is this the perfect solution in the first place?
2. What if I would like to assign the avatar on the start page, but first show it in the sidebar on the second page?


thank you in advance!!





Comments

  • edited December 2016
    ok I think I have got it on my own.

    I am going to put
    <<set $avatar to either ("[img[ava1]]", "[img[ava2]]")>>
    in the StoryInit Passage instead and not on the passage itself and to show the avatar only after the first page I put
    <<if turns() gt 1>>$avatar<</if>>
    on the special passage StorySubtitle
  • That should work.

    One note, however, you should not be adding a space between the function name and it's invocation/parameter list parenthesis. For example:
    /* BAD */
    either (...)
    
    /* GOOD */
    either(...)
    
  • ok thank you, didnt know this!
Sign In or Register to comment.