RMMV

동시 메시지 플러그인 오류 해결법

by 무명시절 posted Jul 23, 2020
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄
Extra Form
종류 플러그인 사용

 

 https://avangs.info/kin/1819133

에서 이어지는 질문입니다(아직도 답이 안나와서...)


일단 플러그인 전문 올려둡니다


 /*:
 *
 * @plugindesc Shows Multiple Messages Simultaneously
 * @author Jake Jilg "mogwai"
 *
 *
 *  When any of these tags are used, the tag will override default Top/Middle/Bottom
 *
 *  Use tags \[top] \[middle] \[bottom] on the same line to show text at the same time.
 * \[bottom]Hello, how are you doing?\[top]¿Hola cómo estás?
 * 
 * Optional tag parameters (only needed on first line) (must be in this order)
 * 
 * \[pos hue:R,G,B] \[top face:FaceName,Index,HueRotate] face hueRotate is optional
 *
 * example \[middle hue:155,0,250 face:People4,2,150]
 *
 * version 0.3
 */

// ------- globals -------

var subWindowLayer;

var messageWindowBottom = {};
var messageWindowMiddle = {};
var messageWindowTop = {};

var simultaneousAquisition = [];

var okGetNum = {
 "bottom": 2,
 "middle": 1,
 "top"   : 0
};

var okGetFace = {
 2 : [],
 1 : [],
 0 : []
};

var okGetTone = {
 2 : [0,0,0],
 1 : [0,0,0],
 0 : [0,0,0]
};

// ------ aliases ----

// create three window children
(function(alias){
 Scene_Base.prototype.createWindowLayer = function() {
  alias.apply(this, arguments);
  var width = Graphics.boxWidth;
  var height = Graphics.boxHeight;
  var x = (Graphics.width - width) / 2;
  var y = (Graphics.height - height) / 2;
  
  subWindowLayer = this._windowLayer;
 };
})(Scene_Base.prototype.createWindowLayer);

// add our two new message window siblings
(function(alias){
 Scene_Map.prototype.createMessageWindow = function() {
  alias.apply(this, arguments);
  
  messageWindowBottom = this._messageWindow;
  messageWindowMiddle = new Window_Message();
  messageWindowTop    = new Window_Message();
  
  // the mainChild is the reactor
  messageWindowBottom._isMainChild = true;
  messageWindowMiddle._isMainChild = false;
  messageWindowTop._isMainChild    = false;
  
  subWindowLayer.addChild(messageWindowTop);
  subWindowLayer.addChild(messageWindowMiddle);
  
  messageWindowBottom._positionType = 2;
  messageWindowMiddle._positionType = 1;
  messageWindowTop._positionType    = 0;
  };  
})(Scene_Map.prototype.createMessageWindow);

// when they clear, we clear too $gameMessage.clear
(function(alias){
 Game_Message.prototype.clear = function() {
  
  alias.apply(this, arguments);
  if(this.positionType() !== undefined)
   simultaneousAquisition = [this.positionType()];
  else
   simultaneousAquisition = [];
  okGetFace = {
   2 : [],
   1 : [],
   0 : []
  };
  okGetTone = {
   2 : [0,0,0],
   1 : [0,0,0],
   0 : [0,0,0]
  };
 };
})(Game_Message.prototype.clear);

// look for sign to simul-text $gameMessage.add
(function(alias){
 Game_Message.prototype.add = function() {
  
  var pe = simultaneousAquisition;
  if(pe.indexOf($gameMessage.positionType()) === -1)
   pe.push($gameMessage.positionType());
  
  arguments[0] = arguments[0].replace(
  /\\\[(top|middle|bottom)( hue:([\d,]+))?( face:([^\]]+))?]/g,
  function(m, tag, m2, hue, m3, face){
   
   $gameMap._interpreter._waitCount += 5;
   
   if(m2 !== undefined){
    var hues = hue.split(",");
    for(var i = 0; i < hues.length; i++){
     hues[i] = parseInt(hues[i]);
    }
    okGetTone[okGetNum[tag]] = hues;
   }
   
   if(m3 !== undefined){
    okGetFace[okGetNum[tag]] = face.split(",");
   }
   
   if(pe.indexOf(okGetNum[tag]) === -1)
    pe.push(okGetNum[tag]);

   // lets hope this string doesn't come up in-game (it's used to parse)
   return "xThIsTx4G03sOn(" + okGetNum[tag] + "):";
   //      ^ sloppy yet functional
  });
  alias.apply(this, arguments);
    };
})(Game_Message.prototype.add);

// when I close, you close... just like that..
(function(alias){
 Window_Message.prototype.close = function() {
  $gameMap._interpreter._waitCount += 5;
  if(this._isMainChild){
   messageWindowMiddle.close();
   messageWindowTop.close();
  }
  alias.apply(this, arguments);
  
  this.isMakeMessage = false;
 };
})(Window_Message.prototype.close);

// when I open, you close... just like that..
(function(alias){
 Window_Message.prototype.open = function(textState) {
  var pe = simultaneousAquisition;
  if(pe.indexOf(this._positionType) !== -1)
   alias.apply(this, arguments);
 };
})(Window_Message.prototype.open);

// I want to look pretty for my window message
(function(alias){
 Window_Message.prototype.updateTone = function() {
  var tone = okGetTone[this._positionType] || [];
  if(tone.length > 0){
   this.setTone(tone[0]||0, tone[1]||0, tone[2]||0);
  }else{
   alias.apply(this, arguments);
  }
 };
})(Window_Message.prototype.updateTone);

// a unique face for a unique monicker
(function(alias){
 Window_Message.prototype.drawFace =function(faceName, faceIndex, x, y, width, height){
  var face = okGetFace[this._positionType];
  
  if(face.length === 0)
   return alias.apply(this, arguments);
  
  var punim = face[0] !== undefined ?
   face[0] : $gameMessage.faceName();
  var faceIndex = face[1] !== undefined ?
   parseInt(face[1]) - 1 : $gameMessage.faceIndex();
  var hue =   face[2] !== undefined ?
   parseInt(face[2]) : 0;
  
  width = width || Window_Base._faceWidth;
  height = height || Window_Base._faceHeight;
  var bitmap = ImageManager.loadFace(punim, hue);
  var pw = Window_Base._faceWidth;
  var ph = Window_Base._faceHeight;
  var sw = Math.min(width, pw);
  var sh = Math.min(height, ph);
  var dx = Math.floor(x + Math.max(width - pw, 0) / 2);
  var dy = Math.floor(y + Math.max(height - ph, 0) / 2);
  var sx = faceIndex % 4 * pw + (pw - sw) / 2;
  var sy = Math.floor(faceIndex / 4) * ph + (ph - sh) / 2;
  
  var contents = this.contents;
  bitmap.addLoadListener(function(){
   contents.blt(bitmap, sx, sy, sw, sh, dx, dy);
  });
 };
})(Window_Message.prototype.drawFace);


// ------ overwrites -------

// 3 endings for 1

Window_Message.prototype.updateMessage = function() {

 var top = messageWindowTop._textState || this._textState;
 var mid = messageWindowMiddle._textState || this._textState;;
 var bot = messageWindowBottom._textState || this._textState;;
 
 var pe = simultaneousAquisition;
 if(pe.indexOf(0) === -1)
  mid = this._textState;
 if(pe.indexOf(1) === -1)
  top = this._textState;
 
    if (this._textState) {
        while (!this.isEndOfText(this._textState)) {
            if (this.needsNewPage(this._textState)) {
                this.newPage(this._textState);
            }
            this.updateShowFast();
            this.processCharacter(this._textState);
            if (!this._showFast && !this._lineShowFast) {
                break;
            }
            if (this.pause || this._waitCount > 0) {
                break;
            }
        }
        if (this.isEndOfText(bot) && this.isEndOfText(mid) && this.isEndOfText(top)) {
            this.onEndOfText();
        }
        return true;
    } else {
        return false;
    }
};

// 3 message starts for 1
Window_Message.prototype.startMessage = function() {
 
 var text = $gameMessage.allText();
 if(text.match(/xThIsTx4G03sOn\(\d\):/) !== null){
  var txt = text.split(/xThIsTx4G03sOn/g);
  var text = "";
  for(var i = 0; i < txt.length; i++){
   if(txt[i].charAt(1) === (this._positionType+""))
    text += txt[i].substr(4) + "\n";
  }
  text = text.replace(/\n{2}/g,"\n");
 }
 this.isMakeMessage = true;
 
 if(this._isMainChild){
  if(!messageWindowMiddle.isMakeMessage){
   messageWindowMiddle.pause = false;
   messageWindowMiddle.startMessage();
  }
  if(!messageWindowTop.isMakeMessage){
   messageWindowTop.pause = false;
   messageWindowTop.startMessage();
  }
 }
   
    this._textState = {};
    this._textState.index = 0;
    this._textState.text = this.convertEscapeCharacters(text);
    this.newPage(this._textState);
    this.updatePlacement();
    this.updateBackground();
  this.open();
};

// each window has it's own position type
Window_Message.prototype.updatePlacement = function() {
    //this._positionType = $gameMessage.positionType();
    messageWindowBottom._positionType = 2;
 messageWindowMiddle._positionType = 1;
 messageWindowTop._positionType    = 0;
 
    this.y = this._positionType * (Graphics.boxHeight - this.height) / 2;
    this._goldWindow.y = this.y > 0 ? 0 : Graphics.boxHeight - this._goldWindow.height;
};

// if we move the windows to $gameMessage.positionType(), they overlap
Window_Message.prototype.areSettingsChanged = function() {
    return (this._background !== $gameMessage.background());
            //this._positionType !== $gameMessage.positionType()
};


 

 설명: 메시지 창에 \[top], \[middle],\[bottom]이란 단어를 달면 메시지가 해당 지역으로 이동되어 출력됨(자세한 사항은 링크 참조)


지금껏 발견한 오류(빨간색이 가장 중요, 나머진 중요도 낮음):

1. 창의 위치가 아래가 아니라면 아래윈도우도 같이 나옴(텍스트 입력시 아래도 같은 텍스트)

2. 창의 위치가 같다면 다음 메세지가 바로 나오나 이 플러그인을 켜두면 닫히고 다시 열려 출력됨

3. 모든 커멘드는 창의 위치가 아래에 위치해 있을 때만 제대로 출력됨 창의

만일 창의 위치가 중간이나 위 일때 커멘드를 입력, 예를 들어 "아...\[bottom]아..."(위치는 중간) 이렇게 입력했을 경우

중간 위치의 나와야 될 '아'는 나오지도 않고 아래에서만 '아'가 나옴


제발 이것좀 해결해 주세요 지금 번역기로 겨우 쳐서 포럼에 질문까지 달아봤는데 아무도 관심이 없어요!!!



 

 

 

■ 질문전 필독!
  • 질문할 내용이 이 게시판이나 강좌에 이미 있는지 확인합니다.
  • 하나의 게시물에는 하나의 질문만 합니다.
  • 제목은 질문의 핵심 내용으로 작성합니다.
  • 질문 내용은 답변자가 쉽게 이해할 수 있도록 최대한 상세하게 작성합니다.
  • 스크립트의 전문이 필요할 경우 txt 파일 등으로 첨부해 주시기 바랍니다.
  • 답변받은 게시물은 삭제하지 않습니다.
  • 답변이 완료된 경우 해당 답변해주신 분들께 감사의 댓글을 달아줍니다.
    • 처음 오신 분들은 공지 게시물을 반드시 읽어주세요!

※ 미준수시 사전경고 없이 게시물을 삭제합니다.