Counter: 340, today: 1, yesterday: 0



mpc_jotaroi.js

var chList = new Array();
var chListFile = "mpc_chlist.txt";


var moji= new Array();
moji["a"]= new Array("  #   ",
                     " # #  ",
                     " ###  ",
                     "#   # ",
                     "#   # ");
moji["b"]= new Array("####  ",
                     "#   # ",
                     "####  ",
                     "#   # ",
                     "####  ");
moji["c"]= new Array(" ###  ",
                     "#   # ",
                     "#     ",
                     "#   # ",
                     " ###  ");
moji["d"]= new Array("###  ",
                     "#  # ",
                     "#  # ",
                     "#  # ",
                     "###  ");
moji["e"]= new Array("#### ",
                     "#    ",
                     "#### ",
                     "#    ",
                     "#### ");
moji["f"]= new Array("#### ",
                     "#    ",
                     "###  ",
                     "#    ",
                     "#    ");
moji["g"]= new Array(" ###  ",
                     "#     ",
                     "#  ## ",
                     "#   # ",
                     " #### ");
moji["h"]= new Array("#  # ",
                     "#  # ",
                     "#### ",
                     "#  # ",
                     "#  # ");
moji["i"]= new Array("### ",
                     " #  ",
                     " #  ",
                     " #  ",
                     "### ");
moji["j"]= new Array("   # ",
                     "   # ",
                     "   # ",
                     "#  # ",
                     " ##  ");
moji["k"]= new Array("#   # ",
                     "#  #  ",
                     "###   ",
                     "#  #  ",
                     "#   # ");
moji["l"]= new Array("#    ",
                     "#    ",
                     "#    ",
                     "#    ",
                     "#### ");
moji["m"]= new Array("#    # ",
                     "##  ## ",
                     "# ## # ",
                     "#    # ",
                     "#    # ");
moji["n"]= new Array("#   # ",
                     "##  # ",
                     "# # # ",
                     "#  ## ",
                     "#   # ");
moji["o"]= new Array(" ###  ",
                     "#   # ",
                     "#   # ",
                     "#   # ",
                     " ###  ");
moji["p"]= new Array("####  ",
                     "#   # ",
                     "####  ",
                     "#     ",
                     "#     ");
moji["q"]= new Array(" ###  ",
                     "#   # ",
                     "#   # ",
                     "#  ## ",
                     " #### ");
moji["r"]= new Array("####  ",
                     "#   # ",
                     "####  ",
                     "#  #  ",
                     "#   # ");
moji["s"]= new Array(" ### ",
                     "#    ",
                     " ##  ",
                     "   # ",
                     "###  ");
moji["t"]= new Array("##### ",
                     "  #   ",
                     "  #   ",
                     "  #   ",
                     "  #   ");
moji["u"]= new Array("#   # ",
                     "#   # ",
                     "#   # ",
                     "#   # ",
                     " ###  ");
moji["v"]= new Array("#   # ",
                     "#   # ",
                     "#   # ",
                     " # #  ",
                     "  #   ");
moji["w"]= new Array("#  #  # ",
                     "#  #  # ",
                     " ## ##  ",
                     " ## ##  ",
                     "  #  #  ");
moji["x"]= new Array("#   # ",
                     " # #  ",
                     "  #   ",
                     " # #  ",
                     "#   # ");
moji["y"]= new Array("#   # ",
                     " # #  ",
                     "  #   ",
                     "  #   ",
                     "  #   ");
moji["z"]= new Array("#### ",
                     "   # ",
                     "  #  ",
                     " #   ",
                     "#### ");
                      
                      
function event::onLoad(){
	log(version + " (" + GetScriptEngineInfo()+")");
	loadChList();
}
// scripts\files\mpc_chlist.txt からスクリプトを作動させるチャンネルリストを取得
function loadChList(){
	var file = openFile(chListFile);
	if(file){
		var line;
		while( (line = file.readLine())!= null){
			chList[ line.toLowerCase() ] = 1;
		}
		file.close();
	}
}
// チャンネルリストを保存
function saveChList(){
	var file = openFile(chListFile,false);
	if(file){
		for (var i in chList) {
			if(chList[i])file.writeLine(i.toLowerCase());
		}
		file.truncate();
		file.close();
	}
}

// 発言から
function event::onChannelText(prefix, channel, text){
	if( text == "mpc_jotaroi"){
		send(channel,"開始["+myNick+">mpc_jotaroi>start] 停止["+myNick+">mpc_jotaroi>stop] " + (chList[channel.toLowerCase()]?"稼動中":"停止中"));

	} else if( chList[channel.toLowerCase()] ){

		//g> 検索
		if( text.match(/^mpc_[\s ]*/) ){
// 		send(channel, "mpcヒット!");
			var q = RegExp.rightContext;
			if (q.length > 0) mpchenkan(channel,q);
		}
	}
	//コマンド
	if( text.match(/>mpc_jotaroi>/) ){
		if( text == myNick+">mpc_jotaroi>start"){
			chList[ channel.toLowerCase() ] = 1;
			send(channel,"mpc_jotaroi変換を開始します。");
			saveChList();
		}else if( text == myNick+">mpc_jotaroi>stop"){
			chList[ channel.toLowerCase() ] = 0;
			send(channel,"mpc_jotaroi変換を停止します。");
			saveChList();
		}
	}
}


function mpchenkan(channel , q ){
	var shutsuryoku= new Array("#    # #####  ###      ",
        	                   "##  ## #   # #   #     ",
        	                   "# ## # ####  #         ",
        	                   "#    # #     #   #     ",
        	                   "#    # #      ###  ### ");

//	send(channel,"変換対象は"+q+"ですね。");
	var henkanmoji = q.split("");
	for (j=0;j<henkanmoji.length;j++){
		mojitemp=henkanmoji[j];
		for (i=0;i<5;i++){shutsuryoku[i] +=moji[henkanmoji[j]][i];}
		if(j== henkanmoji.length-1 ){
			if(henkanmoji[j]!="i"){
				for (i=0;i<5;i++){shutsuryoku[i] +=moji["i"][i];}
			}
		}

	}
	

	for (i=0;i<5;i++){	send(channel,shutsuryoku[i] );}

}

トップ   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS