[SCRIPTING] [RMMV] CUSTOM NAME INPUT

Posts

Pages: 1
I want to make a "note to self" system, which basically lets you write anything and it's displayed on the screen as part of the HUD. I want to do it by character name. I already have a script that allows me to display a character name as HUD, but I can't seem to find a usable custom name input script. Because it can't look like a name input, it should be as simple and clean as possible, just "Type something" and the letters below or a typing space.

Also, the scripts I've already tried don't follow the rest of the game's font.

Can I try to help you? You said it had to be as simple as possible.

Enter a "Script" event command, paste it into this code:
author=BossMaker
temp_note = prompt("Input note text:","");
if(temp_note == null || temp_note == "") {
/* Opicional */
alert("Canceled!");
}else{
/*Insert command HUD with var "temp_note" */
alert(temp_note); //Example
}
/* Clear var */
temp_note = null;
author=BossMaker
Can I try to help you? You said it had to be as simple as possible.

Enter a "Script" event command, paste it into this code:
author=BossMaker
temp_note = prompt("Input note text:","");

if(temp_note == null || temp_note == "") {
/* Opicional */
alert("Canceled!");
}else{
/*Insert command HUD with var "temp_note" */
alert(temp_note); //Example
}
/* Clear var */
temp_note = null;


Wow, I didn't know it was possible to do that!
Anyway, it doesn't satisfy what I'm looking for for two reasons. First, the "text type" window aesthetics clash with the game, unlike the regular name input. Second, the name must remain on screen at all times. Let me show you a screenshot:


The note appears as the name of the character... so the note is changed by name input, but I don't want it to look like a character name input.

Also, I made this topic to hire, and there's more specifications there.
https://rpgmaker.net/forums/topics/24531/
I understood that you wanted the simplest possible.

Now the way you want I need three things:

1) an example image of how you would like the field to insert the text, I will use CSS + JAVASCRIPT.

2) I need the Plugin command that modifies the character name, because it might be that the code is large.
But if it does not I'll look in the CORE script.

3) I need to know if the game texts are images or default RpgMV (sources via CSS).
To be sure of how write.

I will create a Plugin to be able to use parameters.

Note: I speak Portuguese if I need to, I am always in "Centro Rpg" and CondadoBraveheart.

Edit:
Is that what you want?

https://gph.is/g/EqJx7Da
Thanks a lot!

I don't have the image yet, but it'll look a lot like that example of yours. Can you just leave it like a black text box and I'll just show the picture from a regular command separately? Because I haven't thought of or designed the background of the "note to self" thing yet. But if it's better that it's integrated to the script, I could do it right now.


I don't really know the script command to change name. I'll try to paste an entire plugin below.


The font I'm using is a regular font called Arcadepix. It's not an image font.




//-----------------------------------------------------------------------------
// inputName by Lima
//
//

Input.keyMapper = {
8: 'back',
9: 'tab', // tab
13: 'ok', // enter
16: 'shift', // shift
17: 'control', // control
18: 'control', // alt
27: 'escape', // escape
32: 'ok', // space
33: 'pageup', // pageup
34: 'pagedown', // pagedown
37: 'left', // left arrow
38: 'up', // up arrow
39: 'right', // right arrow
40: 'down', // down arrow
45: 'escape', // insert
65: 'a',
66: 'b',
67: 'c',
68: 'd',
69: 'e',
70: 'f',
71: 'g',
72: 'h',
73: 'i',
74: 'j',
75: 'k',
76: 'l',
77: 'm',
78: 'n',
79: 'o',
80: 'p',
81: 'q',
82: 'r',
83: 's',
84: 't',
85: 'u',
86: 'v',
87: 'w',
88: 'x',
89: 'y',
90: 'z',
96: 'escape', // numpad 0
98: 'down', // numpad 2
100: 'left', // numpad 4
102: 'right', // numpad 6
104: 'up', // numpad 8
120: 'debug' // F9

};

//-----------------------------------------------------------------------------
// Window_NameInput
//
// The window for selecting text characters on the name input screen.

function Window_NameInput() {
this.initialize.apply(this, arguments);
}

Window_NameInput.prototype = Object.create(Window_Selectable.prototype);
Window_NameInput.prototype.constructor = Window_NameInput;
Window_NameInput.LATIN1 =
[ 'A','B','C','D','E', 'a','b','c','d','e',
'F','G','H','I','J', 'f','g','h','i','j',
'K','L','M','N','O', 'k','l','m','n','o',
'P','Q','R','S','T', 'p','q','r','s','t',
'U','V','W','X','Y', 'u','v','w','x','y',
'Z','','^','_', 'z','{','}','|','~',
'0','1','2','3','4', '!','#','$','%','&',
'5','6','7','8','9', '(',')','*','+','-',
'/','=','@','<','>', ':',';',' ','Page','OK' ];
Window_NameInput.LATIN2 =
;



Window_NameInput.RUSSIA =
;
Window_NameInput.JAPAN1 =
;
Window_NameInput.JAPAN2 =
;
Window_NameInput.JAPAN3 =
[ 'A','B','C','D','E', 'a','b','c','d','e',
'F','G','H','I','J', 'f','g','h','i','j',
'K','L','M','N','O', 'k','l','m','n','o',
'P','Q','R','S','T', 'p','q','r','s','t',
'U','V','W','X','Y', 'u','v','w','x','y',
'Z','','^','_', 'z','{','}','|','~',
'0','1','2','3','4', '!','#','$','%','&',
'5','6','7','8','9', '(',')','*','+','-',
'/','=','@','<','>', ':',';',' ','??','??' ];

Window_NameInput.prototype.initialize = function(editWindow) {
var x = 10;
var y = editWindow.y + editWindow.height + 8;
var width = 0;
var height = this.windowHeight();
Window_Selectable.prototype.initialize.call(this, x, y, width, height);
this._editWindow = editWindow;
this._page = 0;
this._index = 0;
this.activate();
};

Window_NameInput.prototype.windowHeight = function() {
return this.fittingHeight(9);
};

Window_NameInput.prototype.table = function() {
if ($gameSystem.isJapanese()) {
return ;
} else if ($gameSystem.isRussian()) {
return ;
} else {
return ;
}
};

Window_NameInput.prototype.maxCols = function() {
return 10;
};

Window_NameInput.prototype.maxItems = function() {
return 90;
};

Window_NameInput.prototype.character = function() {
return this._index < 88 ? this.table() : '';
};

Window_NameInput.prototype.isPageChange = function() {
return this._index === 88;
};

Window_NameInput.prototype.isOk = function() {
return this._index === 89;
};

Window_NameInput.prototype.itemRect = function(index) {
return {
x: index % 10 * 42 + Math.floor(index % 10 / 5) * 24,
y: Math.floor(index / 10) * this.lineHeight(),
width: 42,
height: this.lineHeight()
};
};

Window_NameInput.prototype.refresh = function() {
var table = this.table();
this.contents.clear();
this.resetTextColor();
for (var i = 0; i < 90; i++) {
var rect = this.itemRect(i);
rect.x += 3;
rect.width -= 6;
this.drawText(table, rect.x, rect.y, rect.width, 'center');
}
};

Window_NameInput.prototype.updateCursor = function() {
var rect = this.itemRect(this._index);
this.setCursorRect(rect.x, rect.y, rect.width, rect.height);
};

Window_NameInput.prototype.isCursorMovable = function() {
return this.active;
};

Window_NameInput.prototype.cursorDown = function(wrap) {
if (this._index < 80 || wrap) {
this._index = (this._index + 10) % 90;
}
};

Window_NameInput.prototype.cursorUp = function(wrap) {
if (this._index >= 10 || wrap) {
this._index = (this._index + 80) % 90;
}
};

Window_NameInput.prototype.cursorRight = function(wrap) {
if (this._index % 10 < 9) {
this._index++;
} else if (wrap) {
this._index -= 9;
}
};

Window_NameInput.prototype.cursorLeft = function(wrap) {
if (this._index % 10 > 0) {
this._index--;
} else if (wrap) {
this._index += 9;
}
};

Window_NameInput.prototype.cursorPagedown = function() {
this._page = (this._page + 1) % this.table().length;
this.refresh();
};

Window_NameInput.prototype.cursorPageup = function() {
this._page = (this._page + this.table().length - 1) % this.table().length;
this.refresh();
};

Window_NameInput.prototype.processCursorMove = function() {
var lastPage = this._page;
Window_Selectable.prototype.processCursorMove.call(this);
this.updateCursor();
if (this._page !== lastPage) {
SoundManager.playCursor();
}
};

Window_NameInput.prototype.processHandling = function() {
if (this.isOpen() && this.active) {


if (Input.isTriggered('ok')) {
this.onNameOk();
}

if (Input.isTriggered('back') || Input.isLongPressed('back')) {
this.processCancel();
}

if (Input.isTriggered('a') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();

}else if(Input.isTriggered('a')){
letra = Window_NameInput.LATIN1;
this.processOk();
}

if (Input.isRepeated('b') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if(Input.isTriggered('b')){
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('c') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if(Input.isTriggered('c')){
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('d') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('d')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}

if (Input.isRepeated('e') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('e')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}



if (Input.isRepeated('f') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('f')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('g') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('g')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('h') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('h')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('i') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('i')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('j') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('j')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}



if (Input.isRepeated('k') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('k')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('l') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('l')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('m') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('m')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('n') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('n')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('o') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('o')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('p') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('p')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}

if (Input.isRepeated('q') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('q')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('r') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('r')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('s') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('s')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('t') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('t')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('u') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('u')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('v') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('v')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('w') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('w')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}


if (Input.isRepeated('x') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('x')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}

if (Input.isRepeated('y') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('y')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}

if (Input.isRepeated('z') && Input.isPressed('shift')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}else if (Input.isRepeated('z')) {
letra = Window_NameInput.LATIN1;
this.processOk();
}
}
};

Window_NameInput.prototype.isCancelEnabled = function() {
return true;
};

Window_NameInput.prototype.processCancel = function() {
this.processBack();
};

Window_NameInput.prototype.processJump = function() {
if (this._index !== 89) {
this._index = 89;
SoundManager.playCursor();
}
};

Window_NameInput.prototype.processBack = function() {
if (this._editWindow.back()) {
SoundManager.playCancel();
}
};

Window_NameInput.prototype.processOk = function() {
if (this.character()) {
this.onNameAdd();
} else if (this.isPageChange()) {
SoundManager.playOk();
this.cursorPagedown();
} else if (this.isOk()) {
this.onNameOk();
}
};

Window_NameInput.prototype.onNameAdd = function() {
if (this._editWindow.add(letra)) {
SoundManager.playOk();
} else {
SoundManager.playBuzzer();
}
};

Window_NameInput.prototype.onNameOk = function() {
if (this._editWindow.name() === '') {
if (this._editWindow.restoreDefault()) {
SoundManager.playOk();
} else {
SoundManager.playBuzzer();
}
} else {
SoundManager.playOk();
this.callOkHandler();
}
};






Actually this script only replaces the "Window_NameInput ()" function that exists in the file "js / rpg_windows.js".

So basically my idea is different.

I'm running out of time to understand the default Rpg Maker code so it might take a while.
What I advise you is to change the "WindowsSkin" at the moment of inserting the note by a simple using black background.

Edit:
I found the command, but it will still take some time to create the "inputName" the way you want it.

Try use MSPaint to give an example of how it should stay.

$gameActors.actor(ID).setName("New name");

ID: position on DB, example, 1 are Haroldo

Sample:
$gameActors.actor(1).setName("Gustavo");

Trying to reply I just noticed I haven't quite imagine how the note input should look like. I'll give it some more thought and get back to you.
Pages: 1