2009年8月15日土曜日

llGetNotecardLine

何かユニークな文字列などあった場合、
スクリプトを直接変更させるのは、できる人には良いけれど、
コンフィグノートカードを使った方がトラブルが少ないかも?

そんな商品が多い気がしてきました。
どうなんでしょうね?!



integer read_line;

String notecard_name = "config";

key query_id;



load_start(){

llOwnerSay("Now Loading..");

read_line = 0;

if (llGetInventoryType(notecard_name) == INVENTORY_NOTECARD) {

query_id = llGetNotecardLine(notecard_name, read_line); // request first line

}else{

llOwnerSay("Not found notecard " + notecard_name + ", Touch for retry.");

}

}



default {

state_entry(){

state load;

}

}



state main { // メイン処理のステート

state_entry(){



}

}



state load{

state_entry(){

load_start();

}



touch_start(integer detected){

if (llGetOwner() == llDetectedKey(0)){

load_start();

}

}



dataserver(key queryid, string data) {

if (queryid == query_id) {

if (data != EOF) {

// ここへ読み取ったデータ処理を追加

read_line ++;

query_id = llGetNotecardLine(notecard_name, read_line);

}else{

llOwnerSay("Loading complete.");

state main; // メイン処理のステートへ遷移

}

}

}

}

1 件のコメント: