Javascript spaces in argument [Solved]

Subbi86

Newbie
Dec 27, 2018
63
385
Hi,

I'm currently finishing up translation of Until my girlfriend is pregnant, but I just noticed the gallery descriptions are not inserted correctly. This is of course because Japanese doesn't really know space characters while writing, unfortunately.

I believe the function for setting the text is this:

JavaScript:
// ● 説明文の設定
Game_System.prototype.setPictureGalleryText = function(listId, text) {
    var obj = this.pictureGalleryData(listId);
    obj.text = text;
    this.pictureGalleryList()[listId] = obj;
};
and I've been trying to find out how I can pass a longer string as an argument, because right now, if any space is encountered in the argument it breaks off the input.
Input in CommonEvents.json looks like this:

JSON:
{"code":356,"indent":0,"parameters":["PictureGallery SetText 2 \\N[2] abduction and confinement plan"]}
If you look in the Gallery, above the picture only the variable \N[2] (which translates to Hazuki Ichinose) becomes visible, the rest is ignored.

Can anyone perhaps point me in the direction of a solution? Other than just making it one long string with - characters, haha.
I've added the full javascript as an attachment.
 
Last edited:

guest1492

Member
Apr 28, 2018
350
288
I have no idea how RPGM reads and interprets JSON, but I think you should try one of the following:
Code:
{"code":356,"indent":0,"parameters":["PictureGallery SetText 2 '\\N[2] abduction and confinement plan'"]}
{"code":356,"indent":0,"parameters":["PictureGallery SetText 2 `\\N[2] abduction and confinement plan`"]}
{"code":356,"indent":0,"parameters":["PictureGallery SetText 2 \"\\N[2] abduction and confinement plan\""]}
 

Subbi86

Newbie
Dec 27, 2018
63
385
Hey, thanks for the reply.
I tried all those options, but nope, unfortunately, I just see the first quote appear, nothing else.
I tried pasting \u0020 (unicode javascript character for a space character) but that just pastes in a space and the line gets broken off.
 

guest1492

Member
Apr 28, 2018
350
288
OK then, I think you need to edit that file you uploaded. Towards the end, you'll find:
Code:
            case 'SetText':
                var listId = Number(args[1]);
                var text = args[2];
                $gameSystem.setPictureGalleryText(listId, text);
                break;
Change that to:
Code:
            case 'SetText':
                var listId = Number(args[1]);
                var text = args.slice(2).join(' ');
                $gameSystem.setPictureGalleryText(listId, text);
                break;