Title screen script [Ace]

I'm struggling with this problem:

I'm using a special script for the font and layout of my title screen but I want to add another option.

When I do this one of the other options (New Game) will disappear.

How can I change it without losing the font script? (purple part)

Script after adding the option "Extra"


#--------------------------------------------------------------------------

 # ● Create Commands

 #--------------------------------------------------------------------------           

 def create_commands

     @command_window.visible = false

     @commands_index_old = -1

     @commands = []

     @commands_shake_duration = 0

     index = 0

     for com in 0...3

         sprite = Sprite.new

         case index

            when -1; com_name = "New_Game"

            when 0; com_name = "Continue"

            when 1; com_name = "Shutdown"

            when 2; com_name = "Extra"

        end 

         sprite.bitmap = Cache.title2(com_name.to_s) rescue nil

         if sprite.bitmap == nil

            sprite.bitmap = Bitmap.new(200,32)

            sprite.bitmap.font.size = 24

            sprite.bitmap.font.bold = true

            sprite.bitmap.font.italic = true

            sprite.bitmap.draw_text(0, 0, 200, 32, com_name.to_s,1)

         end

         sprite.x = COMMANDS_POS[0] - 100 - (index * 20)

         sprite.y = index * sprite.bitmap.height + COMMANDS_POS[1]

         sprite.z = 100 + index

         sprite.opacity = 0

         index += 1

         @commands.push(sprite)

     end

     @command_max = index  

   end
 

Script before adding "extra (extra is still in the script but won't show)


#--------------------------------------------------------------------------

 # ● Create Commands

 #--------------------------------------------------------------------------           

 def create_commands

     @command_window.visible = false

     @commands_index_old = -1

     @commands = []

     @commands_shake_duration = 0

     index = 0

     for com in 0...3

         sprite = Sprite.new

         case index

            when 0; com_name = "New_Game"

            when 1; com_name = "Continue"

            when 2; com_name = "Shutdown"

            when 3; com_name = "Extra"

        end 

         sprite.bitmap = Cache.title2(com_name.to_s) rescue nil

         if sprite.bitmap == nil

            sprite.bitmap = Bitmap.new(200,32)

            sprite.bitmap.font.size = 24

            sprite.bitmap.font.bold = true

            sprite.bitmap.font.italic = true

            sprite.bitmap.draw_text(0, 0, 200, 32, com_name.to_s,1)

         end

         sprite.x = COMMANDS_POS[0] - 100 - (index * 20)

         sprite.y = index * sprite.bitmap.height + COMMANDS_POS[1]

         sprite.z = 100 + index

         sprite.opacity = 0

         index += 1

         @commands.push(sprite)

     end

     @command_max = index  

   end
Try for com in 0...3 => for com in 0...4

What do you think my intention is with this change?
Thx for your sugestion zeriab, the option is showing now but now I'm dealing with another problem that didn't occur before I changed the script.

The cursor doesn't select the option... I feel stupid for asking this but, do I have to change the script again and what do i have to change?
Look at the name of the method: def create_commands

Doesn't sound like the right place for code dealing with the actual selection. Where might that be located?

*hugs*
I think I got it now, thx this really helped me a lot!!

🤣
Good work 😀

I wish you luck in your scripting journey.

Feel free to ask other questions. I am usually happy to point in a direction. Hopefully also a good direciton.

*hugs*

Original thread: https://forums.rpgmakerweb.com/threads/title-screen-script-ace.23989/