Jump to content
PhoenixSoul

Changing 'enter name' to 'enter (something else)'

Recommended Posts

First of all, I do NOT know if this would require an external script, or if this could be done with just a few modifications, but here's what I'm looking for.

 

Okay, so we have the following in event commands:

 

Name Input

Conditional Branch: Actor has ' ' name applied

 

Whoa, hold up. Right there, you have enough for a password/code system.

One issue: It asks for a different name, and there's not a way to change that, from what I've seen.

 

Like, how would one change 'Enter Name', to 'Enter Password' or 'Enter Code', and so on?

 

Anyone who could help with this, much appreciated, merci beaucoup!

Share this post


Link to post
Share on other sites

It doesn't ask by default... but you can add it if you wish.

#==============================================================================
# ** Name Input Description
#------------------------------------------------------------------------------
#  This snippet adds one line of text above typing space.
#  Written by { Rikifive }
#==============================================================================

class Window_NameEdit < Window_Base
  #--------------------------------------------------------------------------
  # * Draw Description
  #--------------------------------------------------------------------------
  def draw_desc
    desc = "YOUR TEXT HERE"
    change_color(tp_cost_color)
    draw_text(face_width,0,contents_width-face_width,line_height,desc,1)
  end
  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  alias :prev_refresh :refresh
  def refresh
    prev_refresh
    draw_desc
  end
end

This snippet just adds that one line of text at the top like this:

9RSfv31.png

 

It's not even worth to make a configuration, so just edit the snippet somewhere in the middle to suit it to your needs. You can also put a variable there etc., to be able to change it on the fly.

 

Eventually I made a custom scene, where you can input a string into a variable, rather than having to use actor's name. It allows you to setup description, string put by default and length (up to 30 characters), all different for each NPC if needed- through eventing; before calling the input menu.

You can use the variable to whatever you want afterwards, to allow saying something custom in the message box, to put that through conditional branch and of course change the name of the character- and not only...

l88cKsp.gif

Share this post


Link to post
Share on other sites

@Rikifive "BALLS!" lolz

 

Hmmm...

 

I'd have to mess around with this a bit to know how to change the 'YOUR TEXT HERE' by using a variable...

 

That and the text color would likely be better to use a number or RGB values...

Edited by PhoenixSoul

Share this post


Link to post
Share on other sites
desc = $game_variables[25]

would set the description to a variable #25, for example.

Before entering the input menu, put a script call:

$game_variables[25] = "Enter Secret Code"

and it will show up as a description.

Share this post


Link to post
Share on other sites

@Rikifive I did not know that one could input a text string in a variable...

 

Now that's interesting.

 

Now to tackle the text color and to export text string input to a variable, lolz (also how to input more than 16 characters)

Edited by PhoenixSoul

Share this post


Link to post
Share on other sites

As for color,

replace this:

change_color(tp_cost_color)

with

change_color($game_variables[26])

 

and then setup the font before opening the name input menu.

 

Now when wanting to open that menu, put a script call:

$game_variables[25] = "Enter Secret Code";
$game_variables[26] = Color.new(255,155,50);

and then call the name input menu.

 

Setting color is in RGB format; from 0 to 255 for each color.

 

 

 

Exporting is also easy, just set a variable to the actor name you just typed, so for example, AFTER name change, put a script call:

$game_variables[27] = $game_actor[10].name

and now your var[27] equals to the string you just typed there.

 

It would be possible to not have to use actors as placeholders, but it would require modifying other part of the default script; either yet another variable/switch (conditional branch) or making a new scene. - using name will work, so I guess it won't hurt to use it that way.

 

 

 

 

To input more than 16 characters, you'd have to edit the script to get rid of the face, because it simply won't fit more. What's more,  you'd have to set yet another variable to tell the max length, as the editor won't let you set more than 16. Editor's behavior cannot be modified.

At that point it would be just better to make a new, similar scene. (which is what you see in that gif)

Share this post


Link to post
Share on other sites

I mean, it wouldn't be a big problem, but you'd have to always specify max length in the script call, as the value from database wouldn't have any effect. And getting rid of that face, of course... I say it would be better to have a separate scene, where it would be pretty much the same, except you could customize it more, rather than wreck the default one. Then, you could normally use the name change command from the editor as it is by default AND have that extra input scene, that would have the edits, but require a manual script call. Basically it would take about 5 lines of code in the "Script..." command to successfully call the custom input scene with the customizations you want, compared to quick setup via editor. At the moment you're using two lines + one event command to bring that input menu; instead of that there would be ~5 lines of code, which shouldn't be an issue for you- each line basically would be one setting.

 

It may sound slightly complex, but it's actually something really simple.

Share this post


Link to post
Share on other sites

Hehe, I did the thing with expanding the text and deleting the face once... I made a thing for renaming items a while ago, and I made a new subclass of the name window to do it:

 

class Window_ItemNameEdit < Window_NameEdit
  #--------------------------------------------------------------------------
  # * Public Instance Variables
  #--------------------------------------------------------------------------
  attr_reader   :name                     # name
  attr_reader   :index                    # cursor position
  attr_reader   :max_char                 # maximum number of characters
  #--------------------------------------------------------------------------
  # * Object Initialization
  #--------------------------------------------------------------------------
  def initialize(item, max_char)
    x = (Graphics.width - 360) / 2
    y = (Graphics.height - (fitting_height(4) + fitting_height(9) + 8)) / 2
    Window_Base.instance_method(:initialize).bind(self).call(x, y, 360, fitting_height(4))
    @item = item
    @max_char = max_char
    @default_name = @name = item.name[0, @max_char]
    @index = @name.size
    deactivate
    refresh
  end

  #--------------------------------------------------------------------------
  # * Refresh
  #--------------------------------------------------------------------------
  def refresh
    contents.clear
    draw_icon_with_hue(@item.icon_index, @item.icon_hue, left - 26, 36)
    @max_char.times {|i| draw_underline(i) }
    @name.size.times {|i| draw_char(i) }
    cursor_rect.set(item_rect(@index))
  end
  
  #--------------------------------------------------------------------------
  # * Get Coordinates of Left Side for Drawing Name
  #--------------------------------------------------------------------------
  def left
    name_width = (@max_char + 1) * char_width
    return contents_width - name_width
  end
  
#~   #--------------------------------------------------------------------------
#~   # * Get Rectangle for Displaying Item
#~   #--------------------------------------------------------------------------
#~   def item_rect(index)
#~     Rect.new(left + index * char_width, 36, char_width, line_height)
#~   end
  
end

class Scene_ItemName < Scene_MenuBase
  #--------------------------------------------------------------------------
  # * Prepare
  #--------------------------------------------------------------------------
  def prepare(item, max_char)
    @item = item
    @max_char = max_char
  end
  #--------------------------------------------------------------------------
  # * Start Processing
  #--------------------------------------------------------------------------
  def start
    super
    @edit_window = Window_ItemNameEdit.new(@item, @max_char)
    @input_window = Window_NameInput.new(@edit_window)
    @input_window.set_handler(:ok, method(:on_input_ok))
  end
  #--------------------------------------------------------------------------
  # * Input [OK]
  #--------------------------------------------------------------------------
  def on_input_ok
    @item.name = @edit_window.name
    return_scene
  end
end

Probably not that hard to just dump the string in a variable instead.

 

Note: I use this with a instanced items script. In normal VX Ace items are just references to the database object, so just changing an item's name like this won't work.

Edited by Kayzee

Share this post


Link to post
Share on other sites

@Rikifive It is cool that you're being a guide, but yeah...

I've much more to learn on the basic level. I'll get there eventually.

 

I can enable/disable the scriptlet you provided earlier. I know how to set it to look for a switch.

 

@Kayzee I see that script affects items. Cool it exists, not exactly what I need though.

Share this post


Link to post
Share on other sites

Hehe, I just was showing my script to show how I constructed it mostly, in case it was helpful for writing other stuff that modified the naming screen. I could make it put the input in a variable or whatever else, I just thought I would show Riki how I did it in case it helped. Glad Riki helped you out though!

 

Also just noticed this line in my code:

Window_Base.instance_method(:initialize).bind(self).call(x, y, 360, fitting_height(4))

It took me a moment to remember what the heck I was doing there: I couldn't simply call super, because I needed to skip a level. And so I made use of Ruby's wonderful ability to basically cheat and call another class's methods manually. :P

Edited by Kayzee

Share this post


Link to post
Share on other sites

Hehe, I saw it, I just didn't feel like adding much. Neat thing with making new pages of characters though! I think I saw that before, but never though much on it. But now I am tempted to use it.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

  • Recently Browsing   0 members

    No registered users viewing this page.

×