How to change Choice box position? (solved)

Is there any way to change the X Y position of the choice window through scripting? I want to change it to 10, 320
(i did find a plugin that does it but the thing doesn't work and the text doesn't show🙂
e26c3a6532b0907f380832791f8cfa44.png
You can made a snippet. Go to windows.js or scene.js something like that in the main plugins of rpg maker.
The find the part that put the window choices x and y.
Copy that and put in your favorite text editor like notes, sublime text notepad+++ etc.
Then change the position.
Save it and put in the plugin manager
You can made a snippet. Go to windows.js or scene.js something like that in the main plugins of rpg maker.
The find the part that put the window choices x and y.
Copy that and put in your favorite text editor like notes, sublime text notepad+++ etc.
Then change the position.
Save it and put in the plugin manager
Spoiler: Here is that section of code
//-----------------------------------------------------------------------------
// Window_ChoiceList
//
// The window used for the event command [Show Choices].

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

Window_ChoiceList.prototype = Object.create(Window_Command.prototype);
Window_ChoiceList.prototype.constructor = Window_ChoiceList;

Window_ChoiceList.prototype.initialize = function(messageWindow) {
this._messageWindow = messageWindow;
Window_Command.prototype.initialize.call(this, 0, 0);
this.openness = 0;
this.deactivate();
this._background = 0;
};

Window_ChoiceList.prototype.start = function() {
this.updatePlacement();
this.updateBackground();
this.refresh();
this.selectDefault();
this.open();
this.activate();
};

Window_ChoiceList.prototype.selectDefault = function() {
this.select($gameMessage.choiceDefaultType());
};

Window_ChoiceList.prototype.updatePlacement = function() {
var positionType = $gameMessage.choicePositionType();
var messageY = this._messageWindow.y;
this.width = this.windowWidth();
this.height = this.windowHeight();
switch (positionType) {
case 0:
this.x = 0;
break;
case 1:
this.x = (Graphics.boxWidth - this.width) / 2;
break;
case 2:
this.x = Graphics.boxWidth - this.width;
break;
}
if (messageY >= Graphics.boxHeight / 2) {
this.y = messageY - this.height;
} else {
this.y = messageY + this._messageWindow.height;
}
};

Window_ChoiceList.prototype.updateBackground = function() {
this._background = $gameMessage.choiceBackground();
this.setBackgroundType(this._background);
};

Window_ChoiceList.prototype.windowWidth = function() {
var width = this.maxChoiceWidth() + this.padding * 2;
return Math.min(width, Graphics.boxWidth);
};

Window_ChoiceList.prototype.numVisibleRows = function() {
var messageY = this._messageWindow.y;
var messageHeight = this._messageWindow.height;
var centerY = Graphics.boxHeight / 2;
var choices = $gameMessage.choices();
var numLines = choices.length;
var maxLines = 8;
if (messageY < centerY && messageY + messageHeight > centerY) {
maxLines = 4;
}
if (numLines > maxLines) {
numLines = maxLines;
}
return numLines;
};

Window_ChoiceList.prototype.maxChoiceWidth = function() {
var maxWidth = 96;
var choices = $gameMessage.choices();
for (var i = 0; i < choices.length; i++) {
var choiceWidth = this.textWidthEx(choices) + this.textPadding() * 2;
if (maxWidth < choiceWidth) {
maxWidth = choiceWidth;
}
}
return maxWidth;
};

Window_ChoiceList.prototype.textWidthEx = function(text) {
return this.drawTextEx(text, 0, this.contents.height);
};

Window_ChoiceList.prototype.contentsHeight = function() {
return this.maxItems() * this.itemHeight();
};

Window_ChoiceList.prototype.makeCommandList = function() {
var choices = $gameMessage.choices();
for (var i = 0; i < choices.length; i++) {
this.addCommand(choices, 'choice');
}
};

Window_ChoiceList.prototype.drawItem = function(index) {
var rect = this.itemRectForText(index);
this.drawTextEx(this.commandName(index), rect.x, rect.y);
};

Window_ChoiceList.prototype.isCancelEnabled = function() {
return $gameMessage.choiceCancelType() !== -1;
};

Window_ChoiceList.prototype.isOkTriggered = function() {
return Input.isTriggered('ok');
};

Window_ChoiceList.prototype.callOkHandler = function() {
$gameMessage.onChoice(this.index());
this._messageWindow.terminateMessage();
this.close();
};

Window_ChoiceList.prototype.callCancelHandler = function() {
$gameMessage.onChoice($gameMessage.choiceCancelType());
this._messageWindow.terminateMessage();
this.close();
};

What part would be responsible for the x y position? i can't figure it out
Spoiler: Here is that section of code
//-----------------------------------------------------------------------------
// Window_ChoiceList
//
// The window used for the event command [Show Choices].

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

Window_ChoiceList.prototype = Object.create(Window_Command.prototype);
Window_ChoiceList.prototype.constructor = Window_ChoiceList;

Window_ChoiceList.prototype.initialize = function(messageWindow) {
this._messageWindow = messageWindow;
Window_Command.prototype.initialize.call(this, 0, 0);
this.openness = 0;
this.deactivate();
this._background = 0;
};

Window_ChoiceList.prototype.start = function() {
this.updatePlacement();
this.updateBackground();
this.refresh();
this.selectDefault();
this.open();
this.activate();
};

Window_ChoiceList.prototype.selectDefault = function() {
this.select($gameMessage.choiceDefaultType());
};

Window_ChoiceList.prototype.updatePlacement = function() {
var positionType = $gameMessage.choicePositionType();
var messageY = this._messageWindow.y;
this.width = this.windowWidth();
this.height = this.windowHeight();
switch (positionType) {
case 0:
this.x = 0;
break;
case 1:
this.x = (Graphics.boxWidth - this.width) / 2;
break;
case 2:
this.x = Graphics.boxWidth - this.width;
break;
}
if (messageY >= Graphics.boxHeight / 2) {
this.y = messageY - this.height;
} else {
this.y = messageY + this._messageWindow.height;
}
};

Window_ChoiceList.prototype.updateBackground = function() {
this._background = $gameMessage.choiceBackground();
this.setBackgroundType(this._background);
};

Window_ChoiceList.prototype.windowWidth = function() {
var width = this.maxChoiceWidth() + this.padding * 2;
return Math.min(width, Graphics.boxWidth);
};

Window_ChoiceList.prototype.numVisibleRows = function() {
var messageY = this._messageWindow.y;
var messageHeight = this._messageWindow.height;
var centerY = Graphics.boxHeight / 2;
var choices = $gameMessage.choices();
var numLines = choices.length;
var maxLines = 8;
if (messageY < centerY && messageY + messageHeight > centerY) {
maxLines = 4;
}
if (numLines > maxLines) {
numLines = maxLines;
}
return numLines;
};

Window_ChoiceList.prototype.maxChoiceWidth = function() {
var maxWidth = 96;
var choices = $gameMessage.choices();
for (var i = 0; i < choices.length; i++) {
var choiceWidth = this.textWidthEx(choices) + this.textPadding() * 2;
if (maxWidth < choiceWidth) {
maxWidth = choiceWidth;
}
}
return maxWidth;
};

Window_ChoiceList.prototype.textWidthEx = function(text) {
return this.drawTextEx(text, 0, this.contents.height);
};

Window_ChoiceList.prototype.contentsHeight = function() {
return this.maxItems() * this.itemHeight();
};

Window_ChoiceList.prototype.makeCommandList = function() {
var choices = $gameMessage.choices();
for (var i = 0; i < choices.length; i++) {
this.addCommand(choices, 'choice');
}
};

Window_ChoiceList.prototype.drawItem = function(index) {
var rect = this.itemRectForText(index);
this.drawTextEx(this.commandName(index), rect.x, rect.y);
};

Window_ChoiceList.prototype.isCancelEnabled = function() {
return $gameMessage.choiceCancelType() !== -1;
};

Window_ChoiceList.prototype.isOkTriggered = function() {
return Input.isTriggered('ok');
};

Window_ChoiceList.prototype.callOkHandler = function() {
$gameMessage.onChoice(this.index());
this._messageWindow.terminateMessage();
this.close();
};

Window_ChoiceList.prototype.callCancelHandler = function() {
$gameMessage.onChoice($gameMessage.choiceCancelType());
this._messageWindow.terminateMessage();
this.close();
};
What part would be responsible for the x y position? i can't figure it out

Spoiler: Code
Code:
var messageY = this._messageWindow.y;
this.width = this.windowWidth();
this.height = this.windowHeight();
switch (positionType) {
case 0:
this.x = 0;
break;
case 1:
this.x = (Graphics.boxWidth - this.width) / 2;
break;
case 2:
this.x = Graphics.boxWidth - this.width;
break;
}
if (messageY >= Graphics.boxHeight / 2) {
this.y = messageY - this.height;
} else {
this.y = messageY + this._messageWindow.height;
}
};
I think it's around that part.
I think this is showing the position of choice window according to position of the message box.
So I'm not home right now, then I cant give a shot.
But if you play with that code changing x and y positions to numbers(size of your resolution)
You can see by yourself where it changes.
Spoiler: Code
Code:
var messageY = this._messageWindow.y;
this.width = this.windowWidth();
this.height = this.windowHeight();
switch (positionType) {
case 0:
this.x = 0;
break;
case 1:
this.x = (Graphics.boxWidth - this.width) / 2;
break;
case 2:
this.x = Graphics.boxWidth - this.width;
break;
}
if (messageY >= Graphics.boxHeight / 2) {
this.y = messageY - this.height;
} else {
this.y = messageY + this._messageWindow.height;
}
};
I think it's around that part.
I think this is showing the position of choice window according to position of the message box.
So I'm not home right now, then I cant give a shot.
But if you play with that code changing x and y positions to numbers(size of your resolution)
You can see by yourself where it changes.
Thanks for the help! i got it to work:
963ad1848813b660803250161a5abecd.png

It was actually quite simple, just pretty confusing with all the "this" everywhere. i was even able to make a switch to turn it on and off when it was needed:
6fe9d54801efbdf4ad6b9d2fcd0ec172.png

this thread can be closed now
Thanks for the help! i got it to work:
963ad1848813b660803250161a5abecd.png

It was actually quite simple, just pretty confusing with all the "this" everywhere. i was even able to make a switch to turn it on and off when it was needed:
6fe9d54801efbdf4ad6b9d2fcd0ec172.png

this thread can be closed now
Happy you make it! Omg, you do great man with this switch thing!
I was trying to do that in other snippets to c.f.
Good luck!
Happy you make it! Omg, you do great man with this switch thing!
I was trying to do that in other snippets to c.f.
Good luck!
Turns out i ran into an error with this:
Spoiler: stack
"TypeError: Cannot read property 'y' of undefined↵ at Window_ChoiceList.updatePlacement (file:///C:/Users/Whitemount/Desktop/Project1/js/rpg_windows.js:3852:39)↵ at Window_ChoiceList.updatePlacement (file:///C:/Users/Whitemount/Desktop/Project1/js/plugins/YEP_MessageCore.js:981:54)↵ at Object.$.BattleChoiceOn (file:///C:/Users/Whitemount/Desktop/Project1/js/plugins/ReFraction%20Battle%20index%20and%20element%20calculations.js:490:31)↵ at Game_Interpreter.eval (eval at <anonymous> (file:///C:/Users/Whitemount/Desktop/Project1/js/plugins/YEP_CoreEngine.js:1740:10), <anonymous>:1:16)↵ at Game_Interpreter.command355 (file:///C:/Users/Whitemount/Desktop/Project1/js/plugins/YEP_CoreEngine.js:1740:5)↵ at Game_Interpreter.executeCommand (file:///C:/Users/Whitemount/Desktop/Project1/js/rpg_objects.js:8930:34)↵ at Game_Interpreter.update (file:///C:/Users/Whitemount/Desktop/Project1/js/rpg_objects.js:8838:19)↵ at Game_Event.updateParallel (file:///C:/Users/Whitemount/Desktop/Project1/js/rpg_objects.js:8748:27)↵ at Game_Event.update (file:///C:/Users/Whitemount/Desktop/Project1/js/rpg_objects.js:8740:10)↵ at Game_Map.updateEvents (file:///C:/Users/Whitemount/Desktop/Project1/js/plugins/YEP_CoreEngine.js:1550:18)
I use this part of my plugin to deal with setting up the formats for the windows:
3497294bd012f43c2c7710d3e74b692d.png

what i am trying to do is to make it so that this will run and be able to set the choice window to the X, Y position defined by variables:
e7b0a119fe21f48abb6c6aba04982fbd.png

but it doesn't run, i get the "y isn't defined" issue, any suggestions?
(edit) i decided that i will instead open a new thread since this is a different issue, it can be closed.

This thread is being closed, due to being solved. If for some reason you would like this thread re-opened, please report this post and leave a message why. Thank you.

Original thread: https://forums.rpgmakerweb.com/threads/how-to-change-choice-box-position-solved.102939/