tyrano.plugin.kag.tag.eval={vital:["exp"],pm:{exp:""},start:function(pm){this.kag.evalScript(pm.exp);this.kag.ftag.nextOrder()}};tyrano.plugin.kag.tag.clearvar={pm:{},start:function(pm){this.kag.clearVariable();this.kag.ftag.nextOrder()}};tyrano.plugin.kag.tag.clearsysvar={start:function(){this.kag.variable.sf={};this.kag.ftag.nextOrder()}};
tyrano.plugin.kag.tag.clearstack={pm:{stack:""},start:function(pm){if(pm.stack=="")this.kag.stat.stack={"if":[],"call":[],"macro":[]};else this.kag.stat.stack[pm.stack]=[];this.kag.ftag.nextOrder()}};
tyrano.plugin.kag.tag["close"]={pm:{ask:"true"},start:function(pm){var that=this;if(pm.ask=="true")$.confirm($.lang("exit_game"),function(){that.close()},function(){that.kag.ftag.nextOrder()});else this.close()},close:function(){window.close();if(typeof navigator.app!="undefined")navigator.app.exitApp();if(typeof require!="undefined"&&typeof require("nw.gui")!="undefined")require("nw.gui").Window.get().close()}};
tyrano.plugin.kag.tag["trace"]={pm:{exp:""},start:function(pm){var val=this.kag.embScript(pm.exp);this.kag.log("trace\u51fa\u529b\uff1a"+val);this.kag.ftag.nextOrder()}};tyrano.plugin.kag.tag["title"]={vital:["name"],pm:{name:""},start:function(pm){if(pm.name!=""){this.kag.setTitle(pm.name);this.kag.ftag.nextOrder()}}};tyrano.plugin.kag.tag.iscript={start:function(pm){this.kag.stat.is_script=true;this.kag.stat.buff_script="";this.kag.ftag.nextOrder()}};
tyrano.plugin.kag.tag.endscript={pm:{stop:"false"},start:function(pm){this.kag.stat.is_script=false;this.kag.evalScript(this.kag.stat.buff_script);this.kag.stat.buff_script="";if(pm.stop=="false")this.kag.ftag.nextOrder()}};tyrano.plugin.kag.tag.html={pm:{layer:"",top:0,left:0},start:function(pm){this.kag.stat.is_html=true;this.kag.stat.map_html={};this.kag.stat.map_html.buff_html="";this.kag.stat.map_html.buff_pm=pm;this.kag.ftag.nextOrder()}};
tyrano.plugin.kag.tag.endhtml={start:function(pm){var that=this;var tpm=this.kag.stat.map_html.buff_pm;var html=this.kag.stat.map_html.buff_html;var html_obj=$("<div></div>");html_obj.css("position","absolute");html_obj.css("top",tpm.top+"px");html_obj.css("left",tpm.left+"px");$.setName(html_obj,tpm.name);html_obj.append($(html));var layer_free=this.kag.layer.getFreeLayer();layer_free.css("z-index",9999999);layer_free.append(html_obj);layer_free.show();this.kag.stat.is_html=false;this.kag.stat.map_html=
{};this.kag.ftag.nextOrder()}};tyrano.plugin.kag.tag.emb={vital:["exp"],pm:{exp:""},log_join:"true",start:function(pm){var val=""+this.kag.embScript(pm.exp);this.kag.ftag.startTag("text",{"val":val,"backlog":"join"})}};
tyrano.plugin.kag.tag["if"]={vital:["exp"],pm:{"exp":""},log_join:"true",start:function(pm){if(this.kag.embScript(pm.exp)){this.kag.pushStack("if",true);this.kag.ftag.nextOrder()}else{this.kag.pushStack("if",false);for(var i=0;i<2E3;i++){var r=this.kag.ftag.nextOrderWithTag({"else":"","elsif":"","endif":""});if(r==true)break}if(i>1900)this.kag.error("If\u6587\u306b\u8aa4\u308a\u304c\u3042\u308a\u307e\u3059")}}};
tyrano.plugin.kag.tag["elsif"]={vital:["exp"],pm:{"exp":""},log_join:"true",start:function(pm){if(this.kag.getStack("if")==false&&this.kag.embScript(pm.exp)){this.kag.setStack("if",true);this.kag.ftag.nextOrder()}else{for(var i=0;i<2E3;i++){var r=this.kag.ftag.nextOrderWithTag({"else":"","elsif":"","endif":""});if(r==true)break}if(i>1900)this.kag.error("If\u6587\u306b\u8aa4\u308a\u304c\u3042\u308a\u307e\u3059")}}};
tyrano.plugin.kag.tag["else"]={pm:{"exp":""},log_join:"true",start:function(pm){if(this.kag.getStack("if")==false){this.kag.setStack("if",true);this.kag.ftag.nextOrder()}else{for(var i=0;i<2E3;i++){var r=this.kag.ftag.nextOrderWithTag({"endif":""});if(r==true)break}if(i>1900)this.kag.error("If\u6587\u306b\u8aa4\u308a\u304c\u3042\u308a\u307e\u3059")}}};tyrano.plugin.kag.tag["endif"]={log_join:"true",start:function(){this.kag.popStack("if");this.kag.ftag.nextOrder()}};
tyrano.plugin.kag.tag["call"]={pm:{storage:null,target:null,countpage:true,auto_next:"yes"},start:function(pm){var back_pm={};back_pm.index=this.kag.ftag.current_order_index;back_pm.storage=this.kag.stat.current_scenario;back_pm.auto_next=pm.auto_next;back_pm.caller=pm;this.kag.pushStack("call",back_pm);if(pm.target==null&&pm.storage!=null)this.kag.ftag.nextOrderWithIndex(-1,pm.storage);else this.kag.ftag.nextOrderWithLabel(pm.target,pm.storage)}};
tyrano.plugin.kag.tag["return"]={start:function(){var pm=this.kag.getStack("call");if(pm.caller&&pm.caller.storage)if(pm.caller.storage=="make.ks")if(this.kag.tmp.loading_make_ref==true){this.kag.stat.flag_ref_page=true;this.kag.tmp.loading_make_ref=false}var auto_next=pm.auto_next;this.kag.popStack("call");this.kag.ftag.nextOrderWithIndex(pm.index,pm.storage,undefined,undefined,auto_next)}};
tyrano.plugin.kag.tag.macro={vital:["name"],pm:{name:""},log_join:"true",start:function(pm){var index=this.kag.ftag.current_order_index;var storage=this.kag.stat.current_scenario;this.kag.stat.map_macro[pm.name]={"storage":storage,"index":index};this.kag.tmp.checking_macro=true;for(var i=0;i<2E3;i++){var r=this.kag.ftag.nextOrderWithTag({"endmacro":""});if(r==true)break}if(i>1900)this.kag.error("\u30de\u30af\u30ed\u304c\u9589\u3058\u3066\u3044\u307e\u305b\u3093")}};
tyrano.plugin.kag.tag.endmacro={log_join:"true",start:function(pm){if(this.kag.tmp.checking_macro==true){this.kag.tmp.checking_macro=false;this.kag.ftag.nextOrder();return}var map_obj=this.kag.getStack("macro");if(map_obj){this.kag.popStack("macro");this.kag.stat.mp=this.kag.getStack("macro");this.kag.ftag.nextOrderWithIndex(map_obj.index,map_obj.storage,true)}else;}};tyrano.plugin.kag.tag.erasemacro={vital:["name"],pm:{name:""},start:function(pm){delete this.kag.stat.map_macro[pm.name]}};
tyrano.plugin.kag.tag.savesnap={vital:["title"],pm:{title:""},start:function(pm){this.kag.menu.snapSave(pm.title)}};tyrano.plugin.kag.tag.autosave={vital:[],pm:{title:""},start:function(pm){var that=this;if(pm.title=="")pm.title=this.kag.stat.current_save_str;this.kag.menu.snapSave(pm.title,function(){that.kag.menu.doSetAutoSave();that.kag.ftag.nextOrder()})}};
tyrano.plugin.kag.tag.autoload={vital:[],pm:{title:""},start:function(pm){var game_data=$.getStorage(this.kag.config.projectID+"_tyrano_auto_save");this.kag.menu.loadAutoSave()}};tyrano.plugin.kag.tag.ignore={vital:["exp"],pm:{exp:""},start:function(pm){if(this.kag.embScript(pm.exp)){for(var i=0;i<2E3;i++){var r=this.kag.ftag.nextOrderWithTag({"endignore":""});if(r==true)break}if(i>1900)this.kag.error("ignore\u304c\u9589\u3058\u3066\u3044\u307e\u305b\u3093")}else this.kag.ftag.nextOrder()}};
tyrano.plugin.kag.tag.endignore={start:function(){this.kag.ftag.nextOrder()}};
tyrano.plugin.kag.tag.edit={vital:["name"],pm:{name:"",length:"",color:"black",left:"0",top:"0",size:"20",width:"200",height:"40",maxchars:"1000"},start:function(pm){var j_text=$("<input class='text_box form' name='"+pm.name+"' type='text' value='' />");j_text.click(function(){j_text.focus()});pm=$.minifyObject(pm);var new_style={color:$.convertColor(pm.color),left:parseInt(pm.left),top:parseInt(pm.top),width:pm.width,height:pm.height,"font-size":parseInt(pm.size)};j_text.on("keydown",function(e){e.stopPropagation()});
j_text.css(new_style);j_text.css("position","absolute");j_text.attr("maxlength",pm.maxchars);this.kag.layer.getFreeLayer().append(j_text);this.kag.layer.getFreeLayer().show();this.kag.ftag.nextOrder()}};
tyrano.plugin.kag.tag.preload={vital:["storage"],pm:{storage:"",wait:"false"},start:function(pm){var that=this;if(pm.wait=="true")this.kag.layer.hideEventLayer();var storage=pm.storage;if(typeof storage=="object"&&storage.length>0){var sum=0;for(var i=0;i<storage.length;i++)that.kag.preload(storage[i],function(){sum++;if(storage.length==sum){if(pm.wait=="true")that.kag.layer.showEventLayer();that.kag.ftag.nextOrder()}})}else this.kag.preload(pm.storage,function(){if(pm.wait=="true")that.kag.layer.showEventLayer();
that.kag.ftag.nextOrder()})}};tyrano.plugin.kag.tag.clearfix={pm:{name:""},start:function(pm){if(pm.name!="")$(".fixlayer."+pm.name).remove();else $(".fixlayer").remove();this.kag.ftag.nextOrder()}};tyrano.plugin.kag.tag.commit={start:function(){var that=this;this.kag.layer.getFreeLayer().find(".form").each(function(){var name=$(this).attr("name");var val=$(this).val();var str=name+" = '"+val+"'";that.kag.evalScript(str);that.kag.ftag.nextOrder()})}};
tyrano.plugin.kag.tag.cursor={vital:["storage"],pm:{storage:"default"},start:function(pm){this.kag.setCursor(pm.storage);this.kag.ftag.nextOrder()}};tyrano.plugin.kag.tag.screen_full={vital:[],pm:{},start:function(pm){this.kag.menu.screenFull();this.kag.ftag.nextOrder()}};
tyrano.plugin.kag.tag.sleepgame={vital:[],pm:{storage:"",target:"",next:true},start:function(pm){var that=this;var title=this.kag.stat.current_save_str;this.kag.menu.snapSave(title,function(){that.kag.menu.setGameSleep(pm.next);that.kag.ftag.startTag("jump",pm)},"false")}};
tyrano.plugin.kag.tag.awakegame={vital:[],pm:{variable_over:"true",bgm_over:"true"},start:function(pm){var that=this;if(this.kag.tmp.sleep_game==null)this.kag.ftag.nextOrder();else{var sleep_data=this.kag.tmp.sleep_game;if(pm.variable_over=="true")sleep_data.stat.f=this.kag.stat.f;var options={bgm_over:pm.bgm_over};if(this.kag.tmp.sleep_game_next==true)options["auto_next"]="yes";this.kag.menu.loadGameData($.extend(true,{},sleep_data),options);this.kag.tmp.sleep_game=null}}};
tyrano.plugin.kag.tag.breakgame={vital:[],pm:{},start:function(pm){var that=this;this.kag.tmp.sleep_game=null;this.kag.ftag.nextOrder()}};
tyrano.plugin.kag.tag.dialog={vital:[],pm:{name:"tf.dialog_value",type:"alert",text:"",storage:"",target:"",storage_cancel:"",target_cancel:"",label_ok:"OK",label_cancel:"Cancel"},start:function(pm){var that=this;if(pm.type=="confirm")$.confirm(pm.text,function(){that.finish(pm)},function(){pm.storage=pm.storage_cancel;pm.target=pm.target_cancel;that.finish(pm)});else if(pm.type=="input"){alertify.set({buttonFocus:"none",labels:{ok:pm.label_ok,cancel:pm.label_cancel}});alertify.prompt(pm.text,function(flag,
text){if(flag){var name=pm.name;var val=text;var str=name+" = '"+val+"'";that.kag.evalScript(str)}else{pm.storage=pm.storage_cancel;pm.target=pm.target_cancel}that.finish(pm)});$(".alertify-text").on("keydown",function(e){e.stopPropagation()})}else $.alert(pm.text,function(){that.finish(pm)})},finish:function(pm){if(pm.storage!=""||pm.target!="")this.kag.ftag.startTag("jump",pm);else this.kag.ftag.nextOrder()}};
tyrano.plugin.kag.tag.plugin={vital:["name"],pm:{name:"",storage:"init.ks"},start:function(pm){var storage_url="";var name=pm.name;pm.storage="../others/plugin/"+name+"/"+pm.storage;this.kag.stat.mp=pm;this.kag.ftag.startTag("call",pm)}};tyrano.plugin.kag.tag.sysview={vital:["type","storage"],pm:{type:"",storage:""},start:function(pm){var type=pm.type;var storage=pm.storage;if(this.kag.cache_html[type])delete this.kag.cache_html[type];this.kag.stat.sysview[type]=storage;this.kag.ftag.nextOrder()}};
tyrano.plugin.kag.tag.loadcss={vital:["file"],pm:{file:""},start:function(pm){var file=pm.file;var style='<link rel="stylesheet" href="'+file+"?"+Math.floor(Math.random()*1E7)+'">';$("head link:last").after(style);this.kag.stat.cssload[file]=true;this.kag.ftag.nextOrder()}};
tyrano.plugin.kag.tag.save_img={vital:[],pm:{storage:"",folder:""},start:function(pm){var storage=pm.storage;var folder="";var storage_url="";if(pm.storage=="")pm.storage="default";if(pm.folder!="")folder=pm.folder;else folder="bgimage";if($.isHTTP(pm.storage))storage_url=pm.storage;else storage_url="./data/"+folder+"/"+pm.storage;if(pm.storage=="default")storage_url="";this.kag.stat.save_img=storage_url;this.kag.ftag.nextOrder()}};
tyrano.plugin.kag.tag.nolog={vital:[],pm:{},start:function(pm){this.kag.stat.log_write=false;this.kag.ftag.nextOrder()}};tyrano.plugin.kag.tag.endnolog={vital:[],pm:{},start:function(pm){this.kag.stat.log_write=true;this.kag.ftag.nextOrder()}};tyrano.plugin.kag.tag.pushlog={vital:["text"],pm:{"text":"","join":"false"},start:function(pm){if(pm.join=="true")this.kag.pushBackLog(pm.text,"join");else this.kag.pushBackLog(pm.text,"add");this.kag.ftag.nextOrder()}};
tyrano.plugin.kag.tag.start_keyconfig={pm:{},start:function(pm){this.kag.stat.enable_keyconfig=true;this.kag.ftag.nextOrder()}};tyrano.plugin.kag.tag.stop_keyconfig={pm:{},start:function(pm){this.kag.stat.enable_keyconfig=false;this.kag.ftag.nextOrder()}};
