Simple solution here
https://discuss.eroscripts.com/t/to4st-game-integration-mods/99000
Credits to @to4st , codes are based on ButtplugImplementation.js from Succubus Academia mod.
- Download Custom Player from the link above
- Edit “Game Directory/tyrano/plugins/kag/kag.tag_ext.js”
2-1. It’s really hard to read, just beautify js file using https://beautifier.io/
2-2. Add code into “Game Directory/tyrano/plugins/kag/kag.tag_ext.js” file line 1
(change gameName to anything you want)
scriptPlayer = {
gameName: "avy_game",
activeScriptName: null,
getRequest: function(url) {
var xhr = new XMLHttpRequest();
xhr.open('get', url);
xhr.setRequestHeader('Host', '127.0.0.1:5050');
xhr.setRequestHeader('Accept', '*/*');
xhr.setRequestHeader('User-Agent', 'SA');
xhr.send();
},
filterScriptName: function(scriptName) {
return scriptName.substr(0, scriptName.lastIndexOf('.')) || scriptName;
},
playScript: function(scriptName) {
scriptName = this.filterScriptName(scriptName);
this.activeScriptName = scriptName;
var url = `http://127.0.0.1:5050/game/gallery?game=${this.gameName}&code=${scriptName}&speed=1`;
this.getRequest(url);
},
stopScript: function(scriptName) {
var filteredScriptName = this.filterScriptName(scriptName);
if (this.activeScriptName == filteredScriptName) {
var url = `http://127.0.0.1:5050/game/gallery`;
this.getRequest(url);
}
}
};
2-3. Add code into “Game Directory/tyrano/plugins/kag/kag.tag_ext.js” file line 89, right before “that.kag.tmp.video_playing = false;” code
scriptPlayer.stopScript(pm.storage);
2-4. Add code into “Game Directory/tyrano/plugins/kag/kag.tag_ext.js” file line 110, right before “video2.load();” code
video2.addEventListener("play", function(event) {scriptPlayer.playScript(video_pm.storage);});
video2.addEventListener("seeked", function(event) {scriptPlayer.playScript(video_pm.storage);});
video2.addEventListener("pause", function(event) {scriptPlayer.stopScript(video_pm.storage);});
2-5. Add code into “Game Directory/tyrano/plugins/kag/kag.tag_ext.js” file line 155, right before “video.load();” code
video.addEventListener("play", function(event) {scriptPlayer.playScript(pm.storage);});
video.addEventListener("seeked", function(event) {scriptPlayer.playScript(pm.storage);});
video.addEventListener("pause", function(event) {scriptPlayer.stopScript(pm.storage);});
- Add funscripts to “Custom Player Directory/scripts/game_name_you_defined_in_step_2-2”