Ce script va de paire avec le "keybumper script"..
C'est lui qui permet à l'objet dans lequel il est inséré...de "lire" les note cards contenant les textures...
Pour plus de compréhension voire tutoriel...(en construction pour le moment :p )
// Copyright (C) 2007 thomax g.
//
// This program is free software; you can redistribute it and/or
modify
// it under the terms of the GNU General Public License as
published by
// the Free Software Foundation; either version 2 of the License,
or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be
useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty
of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
the
// GNU General Public License for more details.
// You should have received a copy of the GNU General Public
License
// along with this program; if not, write to the Free
Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 U
key QID;
key QID_ACK;
key QID_lines;
integer DISPLAYS = 15;
integer line_in_block;
string current_notecard;
integer current_block;
integer MENUCHN = 89838;
integer notecard_entries;
integer current_menu;
integer categories;
list category_list;
string alpha_empty = "keydumper: (alpha,236c39da-3bf7-25ac-b2d7-867d66616420)";
category_load() {
integer i;
categories=0;
category_list = [];
for(i=0; i<= -1 + llGetInventoryNumber(INVENTORY_NOTECARD);i++) {
if(llGetInventoryName(INVENTORY_NOTECARD,i) != "GNU License"
&&
llGetInventoryName(INVENTORY_NOTECARD,i) != "YATO-BF Readme")
{
category_list += [llGetInventoryName(INVENTORY_NOTECARD,i)];
categories++;
}
}
}
category_menu() {
list menu;
integer i;
menu = [];
if(current_menu > 0)
menu += ["BACK"];
else
menu += [" "];
menu += ["NEW CATEGORY"];
if(current_menu*8+8 < categories -
1)
menu +=
["FORWARD"];
else
menu += [" "];
for(i=current_menu*8; (i <=
current_menu*8+8) && (i <= categories - 1);i++) {
menu +=
[llList2String(category_list,i)];
}
llDialog(llGetOwner(), "Category to display
or create a NEW CATEGORY:", menu, MENUCHN);
}
load_notecard_block() {
line_in_block = 0;
QID = llGetNotecardLine(current_notecard,
current_block * DISPLAYS + line_in_block);
}
default
{
state_entry()
{
integer i;
llSensor("",llGetOwner(),AGENT,20,PI);
MENUCHN +=
(integer)llFrand(10000);
// llOwnerSay(0,"YATO
BF ready.");
current_notecard =
"";
current_block = 0;
current_menu = 0;
llListen(MENUCHN, "",
NULL_KEY, "");
for(i=0;i<=DISPLAYS;i++) {
llMessageLinked(LINK_ALL_CHILDREN, 0, "sp"+(string)i+"
"+alpha_empty, NULL_KEY);
}
category_load();
category_menu();
}
on_rez(integer n) {
llResetScript();
}
changed(integer n) {
if(n ==
CHANGED_INVENTORY)
category_load();
}
listen(integer chn, string name, key id, string msg) {
if(chn == MENUCHN) {
if(msg == " ")
return;
if(msg == "NEW CATEGORY") {
llRezAtRoot("keydumper",llGetPos()+<-1,1,-1>,<0,0,0>,<0,0,0,0>,1);
return;
}
if(msg == "BACK") {
current_menu--;
category_menu();
return;
}
if(msg == "FORWARD") {
current_menu++;
category_menu();
return;
}
//llOwnerSay(0, "OK, request dataserver for category: "+msg);
current_notecard = msg;
//llSetText("Category: "+msg,<255,255,255>,1);
llMessageLinked(LINK_ALL_CHILDREN, 99, msg, NULL_KEY);
QID_lines = llGetNumberOfNotecardLines(current_notecard);
return;
}
}
link_message(integer sender, integer num, string msg, key id) {
if(msg ==
"menurequest") {
category_menu();
return;
}
if(msg == "prevpage"
&& current_block > 0) {
current_block--;
load_notecard_block();
return;
}
if(msg == "nextpage"
&& current_block < notecard_entries / DISPLAYS) {
current_block++;
load_notecard_block();
return;
}
if(llSubStringIndex(msg,"largepanel ") == 0) {
llMessageLinked(LINK_ALL_CHILDREN, 0, msg, NULL_KEY);
}
}
dataserver(key queryid, string data) {
if(queryid ==
QID_lines) {
//
llOwnerSay(0, "Dataserver says, this notecard has "+data+"
entries.");
notecard_entries = (integer)data;
current_block = 0;
line_in_block = 0;
load_notecard_block();
}
if(queryid == QID)
{
if(data != EOF) {
llMessageLinked(LINK_ALL_CHILDREN, 0, "sp"+(string)line_in_block+"
"+data, NULL_KEY);
line_in_block++;
if(line_in_block <= DISPLAYS)
QID = llGetNotecardLine(current_notecard, current_block *
DISPLAYS + (line_in_block));
} else {
for(;line_in_block<=DISPLAYS;line_in_block++) {
llMessageLinked(LINK_ALL_CHILDREN, 0, "sp"+(string)line_in_block+"
"+alpha_empty, NULL_KEY);
}
}
}
}
sensor(integer keynum) {
vector
pos=llDetectedPos(0);
llLookAt(pos,.5,.5);
}
}


Commentaires