Tads 3 banner + player input

i have a banner that shows inventory, however it show as soon as game starts. Is there away i can hide it - then re add? Trying to make a title screen.

also i have code asking for players name… which works but if they just hit enter it of course doesn’t give a name, is there away i can fix this.

1 Like

If you put all this into an execute() method on an object that inherits from InitObject, then the code should run before the banner gets set up.

titleScreen: InitObject {
    execute() {
        say('Holy cow this is the craziest title screen you've ever seen in your life! Editor, put in some CG explosion animations and MLG memes!');
        // Your preferred "press any key" prompt then goes here.
    }
}
1 Like

Thank you, so much

1 Like

This, meanwhile seems to be a control flow solution. Just encapsulate the input question in a do { ... } while(nameIsInvalid(playerName));

I’m on mobile; sorry for lack of specificity… >>

Btw, nameIsInvalid(playerName) is a function you would design. Like it would have checks such as playerName.trim().length == 0 for empty inputs and stuff. Hopefully this helps a little!

1 Like

Thanks so much

1 Like

There are many ways you could approach the intro screen.
As far as the inventory window, you should be able to control when it shows for the first time. Somewhere there needs to be a call to showBanner, which for windows that you want to show right away might be included in initBannerWindow. But if you don’t want the window showing up right away, don’t call invWindow.showBanner(...) until you’re through with your intro jazz.
For my welcome screen I put the PC in a dummy Room with no title or description or links to anywhere else, and defined a roomBeforeAction that traps any actions other than the options I give like BEGIN, ABOUT, INSTRUCTIONS, RESTORE, and some others. The title graphic is displayed the whole time (actually in its own window so it doesn’t scroll out of view), and once the player enters BEGIN, I call showBanner for the inventory window, move the PC into the first game world loc, hide the title graphic banner, etc.

I also have the statusline hidden until BEGIN…

2 Likes

Thank you. I love Tads, love IF - I just not good coder.

2 Likes