ソラマメブログ
< 2008年08>
S M T W T F S
          1 2
3 4 5 6 7 8 9
10 11 12 13 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30
31            
アクセスカウンタ
オーナーへメッセージ
読者登録
メールアドレスを入力して登録する事で、このブログの新着エントリーをメールでお届けいたします。 解除は→こちら
現在の読者数 3人

2007年10月16日

呼び鈴(リンデンスクリプト Tips)

本日は友達の依頼で呼び鈴を作ってみました。
ベルを押すとオーナーにIMを送って知らせます。
オーナーがオフラインの場合は、訪問者にチャット画面上で知らせます。


(ここのオーナーさんは、RURU CLUBでThunder's Barを経営しているサンダさんですw)

ベル(リンゴ)を押すとオーナー及び訪問者のチャット画面上にメッセージを表示します。
(訪問者側チャット画面)

オーナーがオフラインだと


(オーナー側チャット画面)




「スクリプト」
//
//   BELL SCRIPT   v1.0
//
//                                       Created by Zero2000 Kid     2007/10/14

key getagent;
string agentname;
string ownname;

// sound
string wavfile = "doorbell_02.wav";
// yobirin
string subject = "%2e%ef%bd%a1%2e%3a%2a%ef%bd%a5%e5%91%bc%e3%81%b3%e9%88%b4%ef%bd%a5%2a%3a%2e%ef%bd%a1%2e%20";
// sangahoumonsimasita
string msg1 = "%e3%81%95%e3%82%93%e3%81%8c%e8%a8%aa%e5%95%8f%e3%81%97%e3%81%be%e3%81%97%e3%81%9f%e3%80%82";
// san irashaimase
string msg2 = "%e3%81%95%e3%82%93%e3%80%80%e3%81%84%e3%82%89%e3%81%a3%e3%81%97%e3%82%83%e3%81%84%e3%81%be%e3%81%9b%ef%bc%be%ef%bc%be%e3%80%82";
// orikaesi IM simasu
string msg3 = "%e6%8a%98%e3%82%8a%e8%bf%94%e3%81%97%ef%bc%a9%ef%bc%ad%e3%81%84%e3%81%9f%e3%81%97%e3%81%be%e3%81%99%e3%80%82";
// sorry
string msg4 = "%e7%94%b3%e3%81%97%e8%a8%b3%e3%81%82%e3%82%8a%e3%81%be%e3%81%9b%e3%82%93%e3%80%82";
// OFFLINE desu
string msg5 = "%e3%81%af%e3%80%81%e7%8f%be%e5%9c%a8%e3%82%aa%e3%83%95%e3%83%a9%e3%82%a4%e3%83%b3%e3%81%a7%e3%81%99%e3%80%82";

default {
       
	state_entry() {
		llSetText(llUnescapeURL(subject),<1,1,1>, 1.0);
		ownname=llKey2Name(llGetOwner());
	}
	       
	on_rez(integer int) {
		llResetScript(); 
	}

	touch_start(integer t) {
		// PLAY SOUNDE
		llPlaySound(wavfile,0.8);
		// IM FOR OWENER
		agentname=llDetectedName(0);
		llInstantMessage(llGetOwner(),agentname + llUnescapeURL(msg1));
		// ONLINE CHECK
		getagent = llRequestAgentData(llGetOwner(), DATA_ONLINE); 
	}
	       
	dataserver(key queryid, string data) {
		if (queryid==getagent) {
			if ((integer)data) {
				llWhisper(0,agentname + llUnescapeURL(msg2));
				llWhisper(0,llUnescapeURL(msg3) + "(" + llKey2Name(llGetOwner()) + ")");
			} else {
				llWhisper(0,llUnescapeURL(msg4) + ownname + llUnescapeURL(msg5));
			}
		}
	}
}



「スクリプトの説明」
(1)ベルをタッチするとllPlaySoundでチャイム音を鳴らします。
(2)llDetectedNameで、タッチした人の名前を取得し、llInstantMessageでオーナーにメッセージを送ります。
(3)llRequestAgentDataでオーナーの、オンライン状況をチェックします。
(4)dataserverイベントでオンライン状況を取得し、状態に応じてllWhisperで訪問者にメッセージを表示します。

*チャイム音には、doorbell_02.wavというサウンドファイルを使用しています。
 欲しい方は、IMくださいw。


「おまけ」
(友情出演:RURU CLUB MANAGER さんてんw)




リンデンスクリプト Tips Intexへ


この記事へのトラックバックURL