Choices Script with no textbox

Hi. I'm having problems with the UMS Script I have regarding Choices.
I've tried to modify it myself, but i can't find how to make what i need, and some options i have enabled make the script crash under certain conditions, especially when I have to display two set of Choices in a row,
Right now I want a simple Choices script that displays the Choices centered with the text box fitting the text, in the middle of the screen in a separate window, and that the previous text dissapears.
1.png

This is how it's showing right now (deleting some stuff so the script doesnt crash).

I found a script that helps for multiple options, but it's complicated to use in teh event windows.
Spoiler: SCRIPT
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
# Message Choice Window
# Author: ForeverZer0
# Version: 1.0
# Date: 8.5.2010
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=
#
# Introduction:
# This script will allow you to set up more than the 4 choices that RPGXP
# limits you to. The window will behave much like the default window and is
# very easy to use.
#
# Features:
# - Set up as many choices as you need (within reason)
# - Custom window width, x, and y, or have it center automatically
# - Can allow/disallow the player from canceling out of window
# - Uses a single script call
# - Does not effect the Window_Message class
#
# Instructions:
# - Configuration is just below.
# - Use this script call:
#
# Choices.setup(WIDTH, CHOICES, CANCEL?, X, Y)
#
# WIDTH = width of window
# CHOICES = Array of choices that will be shown. These must be written as a
# string. ex. ['one', 'two', 'three', 'four']
# CANCEL? = Allowed player to cancel with B button? (true/false)
# X, Y = The x and y that the window will be displayed at.
#
# - Not all of these arguments have to be used. The only two that are required
# are the WIDTH and CHOICES array. The rest can be omitted.
# - If the CANCEL? argument is not supplied, it will be true by default.
# - If the X or Y argument is not supplied, the window will auto-center on
# the omitted axis.
#
# - What happens is when a choice is selected, it will set a variable to the
# that choice's number (first choice is 1, second is 2, etc., etc.)
# - If the player is allowed to cancel and the B button is pressed, the
# variable will be set to 0
# - Now all you must do is create conditional branches below the script call
# with the condition for each being your variable equal to the respective
# choice's number.
#
#=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=

#===============================================================================
# ** Choices
#===============================================================================

module Choices

# CONFIGURATION
#------------------------------------------------------------------------

Variable_ID = 15
# ID of variable you would like to use for choices.
Window_Opacity = 160
# Opacity of choice window (160 is Window_Message default)

#------------------------------------------------------------------------
# DO NOT CONFIGURE ANYTHING BELOW THIS LINE

def self.setup(width, choices, cancel = true, x = nil, y = nil)
return unless $scene.is_a?(Scene_Map)
$game_system.map_interpreter.message_waiting = true
$game_temp.choice_cancel_type = cancel
$scene.choice_window = Window_Command.new(width, choices)
$scene.choice_window.x = x == nil ? (640 - $scene.choice_window.width)/2 : x
$scene.choice_window.y = y == nil ? (480 - $scene.choice_window.height)/2 : y
$scene.choice_window.back_opacity = Window_Opacity
end
end

#===============================================================================
# ** Scene_Map
#===============================================================================

class Scene_Map

attr_accessor :choice_window

alias zer0_choice_window_main main
def main
zer0_choice_window_main
@choice_window.dispose if @choice_window != nil
end

alias zer0_choice_window_upd update
def update
if @choice_window != nil && @choice_window.active
@choice_window.update
update_choice_window
end
zer0_choice_window_upd
end

def update_choice_window
if Input.trigger?(Input::😎
unless $game_temp.choice_cancel_type
$game_system.se_play($data_system.buzzer_se)
return
end
$game_system.se_play($data_system.cancel_se)
$game_variables[Choices::Variable_ID] = 0
terminate_choice_window
elsif Input.trigger?(Input::C)
$game_system.se_play($data_system.decision_se)
$game_variables[Choices::Variable_ID] = @choice_window.index + 1
terminate_choice_window
end
end

def terminate_choice_window
$game_system.map_interpreter.message_waiting = false
@choice_window.dispose
@choice_window = nil
end
end

#===============================================================================
# ** Interpreter
#===============================================================================

class Interpreter
attr_accessor :message_waiting
end

However, this script lets me put the choices kind of nicely:
2.png


However, the size is not good. Tehre's too much space Blank at the right of the text that I want removed, but I have no idea how to take the Auto fitting option from my UMS Script and use it there.
So, basically, to make it simple, is someone could modify that script to make the box fit with the text's width and to be centered, i'd be very thankful.
But, if you could make a new script that modifies the normal Choices text to be located in the middle of the screen and centered, that'd be even better as it would be much easier to work with.

If you have any question about it just ask me and i'll try to explain myself better
I take it that you want something like this???

again_changing.png


Go into Ccoa's UMS, and go down to line 1512. Normally, it would look like this
Code:
      else # side        if $game_system.choice_justification == LEFT
          # check to make sure there's room on the left side
Add some lines of code to make it look like THIS instead:
Code:
      else # side
        if $game_system.choice_justification == CENTER
          @choice_window.x = (640 - @choice_window.width)/2
        end       
        if $game_system.choice_justification == LEFT
          # check to make sure there's room on the left side

Yep, I just added a CENTER option for the show choices window... but that's horizontal centering.


Now go down to line 1548 where you normally would see this (after entering the above code:

Code:
        end
      end
    end
    # If number input
    if $game_temp.num_input_variable_id > 0
      if @input_number_window == nil

And add some more lines to make it look like THIS:

Code:
        end
      end
      if $game_system.choice_position == CENTER
        @choice_window.y = (480 - @choice_window.height)/2
      end
    end
    # If number input
    if $game_temp.num_input_variable_id > 0
      if @input_number_window == nil

That will give you vertical alignment of the choices window.

I tested it with the following call:
Code:
@>Script: $game_system.choice_position =
 :      : CENTER
@>Script: $game_system.choice_justification =
 :      : CENTER
@>Script: $game_temp.num_choices = 3
@>Show Choices: One, Two, Three, Four
 : When [One]
   @> Text: one
   @>
 : When [Two]
   @> Text: two
   @>
 : When [Three]
   @> Text: three
   @>
 : When [Four]
   @> Text: four
   @>
 : Branch End
@>Show Choices: Five Six Seven Eight
 : When [Five]
   @> Text: five
   @>
 : When [Six]
   @> Text: six
   @>
 : When [Sevene]
   @> Text: seven
   @>
 : When [Eight]
   @> Text: eight
   @>
 : Branch End
@>Show Choices: Nothing
 : When [Nothing]
   @> Text: nothing (cancel)
   @>
 : Branch End
@>
I take it that you want something like this???

View attachment 121420

Go into Ccoa's UMS, and go down to line 1512. Normally, it would look like this
Code:
      else # side        if $game_system.choice_justification == LEFT
          # check to make sure there's room on the left side
Add some lines of code to make it look like THIS instead:
Code:
      else # side
        if $game_system.choice_justification == CENTER
          @choice_window.x = (640 - @choice_window.width)/2
        end       
        if $game_system.choice_justification == LEFT
          # check to make sure there's room on the left side

Yep, I just added a CENTER option for the show choices window... but that's horizontal centering.


Now go down to line 1548 where you normally would see this (after entering the above code:

Code:
        end
      end
    end
    # If number input
    if $game_temp.num_input_variable_id > 0
      if @input_number_window == nil

And add some more lines to make it look like THIS:

Code:
        end
      end
      if $game_system.choice_position == CENTER
        @choice_window.y = (480 - @choice_window.height)/2
      end
    end
    # If number input
    if $game_temp.num_input_variable_id > 0
      if @input_number_window == nil

That will give you vertical alignment of the choices window.

I tested it with the following call:
Code:
@>Script: $game_system.choice_position =
 :      : CENTER
@>Script: $game_system.choice_justification =
 :      : CENTER
@>Script: $game_temp.num_choices = 3
@>Show Choices: One, Two, Three, Four
 : When [One]
   @> Text: one
   @>
 : When [Two]
   @> Text: two
   @>
 : When [Three]
   @> Text: three
   @>
 : When [Four]
   @> Text: four
   @>
 : Branch End
@>Show Choices: Five Six Seven Eight
 : When [Five]
   @> Text: five
   @>
 : When [Six]
   @> Text: six
   @>
 : When [Sevene]
   @> Text: seven
   @>
 : When [Eight]
   @> Text: eight
   @>
 : Branch End
@>Show Choices: Nothing
 : When [Nothing]
   @> Text: nothing (cancel)
   @>
 : Branch End
@>
I take it that you want something like this???

View attachment 121420

Go into Ccoa's UMS, and go down to line 1512. Normally, it would look like this
Code:
      else # side        if $game_system.choice_justification == LEFT
          # check to make sure there's room on the left side
Add some lines of code to make it look like THIS instead:
Code:
      else # side
        if $game_system.choice_justification == CENTER
          @choice_window.x = (640 - @choice_window.width)/2
        end   
        if $game_system.choice_justification == LEFT
          # check to make sure there's room on the left side

Yep, I just added a CENTER option for the show choices window... but that's horizontal centering.


Now go down to line 1548 where you normally would see this (after entering the above code:

Code:
        end
      end
    end
    # If number input
    if $game_temp.num_input_variable_id > 0
      if @input_number_window == nil

And add some more lines to make it look like THIS:

Code:
        end
      end
      if $game_system.choice_position == CENTER
        @choice_window.y = (480 - @choice_window.height)/2
      end
    end
    # If number input
    if $game_temp.num_input_variable_id > 0
      if @input_number_window == nil

That will give you vertical alignment of the choices window.

I tested it with the following call:
Code:
@>Script: $game_system.choice_position =
 :      : CENTER
@>Script: $game_system.choice_justification =
 :      : CENTER
@>Script: $game_temp.num_choices = 3
@>Show Choices: One, Two, Three, Four
 : When [One]
   @> Text: one
   @>
 : When [Two]
   @> Text: two
   @>
 : When [Three]
   @> Text: three
   @>
 : When [Four]
   @> Text: four
   @>
 : Branch End
@>Show Choices: Five Six Seven Eight
 : When [Five]
   @> Text: five
   @>
 : When [Six]
   @> Text: six
   @>
 : When [Sevene]
   @> Text: seven
   @>
 : When [Eight]
   @> Text: eight
   @>
 : Branch End
@>Show Choices: Nothing
 : When [Nothing]
   @> Text: nothing (cancel)
   @>
 : Branch End
@>
I tried doing that, but I I'm not using Ccoa's so the results didn't work as expected (i tried to put the script, but it said it wss too big to allow it).
I'm also trying editing the script I put in the spoiler and adding it the centered text option from the UMS i'm using, but it's not working either.
Do you know which is the part of the script that delimits the width of the text box to fit the contents of it? And how do I make so Width in said script is using that?

EDIT: I'm do using Ccoa's. If i use the text alignment to center and two choices in a row is what makes it crash. Also, making the fixes you did make the scrip crash completely Dx

EDIT 2: I was using the version 1.1 so that's why nothing worked... I still have problems if the alignment is set to centered using this command:
$game_system.text_justification = CENTER
11.png

I cang et the options in the middle, but I can't manage to erase the text box that comes prior the choices...
Also, choices crash when the text is centered... Dx

EDIT: If i put a 1 frame pause the game deletes the text... that's easy progress hahaha now just need to know how to fix the crashing when aligned to the center and GG

EDIT 2: New UMs don't let me change the windowskin with the nomal built-in system...

EDIT 3: Testing it in-game, the center doesnt always work... I have no idea why
This is the "center" I get:
22.png

1.jpg

It seems that the game is not reading the @choice_window.x = (680- @choice_window.width)/2
but it is reading the Y at elast a little better...
These are the commands I have before that:

$game_system.ums_mode = FIT_WINDOW_TO_TEXT
$game_system.text_skip = true
$game_system.window_justification = CENTER
$game_system.text_justification = LEFT #if i use center here the game crashes
$game_system.choice_position = CENTER
$game_system.choice_justification = CENTER
$game_temp.num_choices = 1


I literally have no idea what i'm doing wrong
From your first post, it sounds like you tried to edit the script yourself. This could have broken it. I suggest you redownload and reinstall the script, then reapply the changes mentioned above, to make sure you haven't done something that causes it to crash.
From your first post, it sounds like you tried to edit the script yourself. This could have broken it. I suggest you redownload and reinstall the script, then reapply the changes mentioned above, to make sure you haven't done something that causes it to crash.
I downloaded the version 1.8 of Ccoa's UMS, so today I started from 0 and still isn't working
Double-post notice: xChikyx
Double-post notice: xChikyx
didn't want to make a big edit, especially because I was working on the thing at the time
I followed what @DerVVulfman mentioned and it worked well.

@choice_window.x = (680- @choice_window.width)/2
It should be 640 here instead of 680 because XP resolution is 640x480. Also the choice window will never be centered if you use FIT_WINDOW_TO_TEXT mode.
I followed what @DerVVulfman mentioned and it worked well.


It should be 640 here instead of 680 because XP resolution is 640x480. Also the choice window will never be centered if you use FIT_WINDOW_TO_TEXT mode.
I tried both 640 and 680 and neither worked (kept 680 at the end because its what the script had for other alignments)
and It did work with FIT_WINDOW_TO_TEXT... That's the weird part. I was going to record a video so I could show you. In one of the tries I made 3 choices in a row, changing the windowskin on each question to be blue, while default one is red, with text before the first. Using all the same commands before. And what happened was this:
Text in red. Choice window perfectly centered in red (didn't change the skin). Second Choice window not centered and with the windowskin changed to blue. Third Choice window perfectly centered with the skin in red (for some reason it changed it back to red).
I'll try changing the FIT_WINDOW_TO_TEXT off and see if it works... Hope it's that, even if that would be extremely annoying hahaha I would have to put a whole call script before each text and before each choices... I already need to do that to change the windowskin because for some reason the 1.8 don't let me change it using the built in option... *sigh* I complicate my life so much... I'll tell you how it goes... At least it would make the game looks polished af, but damn it would take me so much time...

EDIT: Checked with FIT_WINDOW_TO_TEXT off and it's not working either

EDIT 2: I FINALLY FIXED IT!
I put both alignments at the end of the section where DerWulfman told me to put the Y alignment. It works fine, and the fit window to text does not interfere. The alignment to the center still crashes it, so i have to keep calling a script to adjust thata s well as the windowskin.
But yeah, it worked, I'm putting you in the credits hahaha Thank you very much

Original thread: https://forums.rpgmakerweb.com/threads/choices-script-with-no-textbox.112233/