Accueil Date de création : 08/05/08 Dernière mise à jour : 11/06/09 15:54 / 215 articles publiés
 

Script pour panneau de textures..  (Scripts) posté le samedi 17 mai 2008 15:49

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);
    }
}

lien permanent

Script pour tourner les pages....lorsque l'on clique dessus...  (Scripts) posté le samedi 17 mai 2008 15:57

// 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

default
{
    state_entry()
    {
    }

    touch_start(integer total_number)
    {
        llMessageLinked(LINK_ROOT, 0, "nextpage", NULL_KEY);
    }
}

lien permanent

Script pour avoir un menu..  (Scripts) posté le samedi 17 mai 2008 16:02

// 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

default
{
    state_entry()
    {
    }

    touch_start(integer total_number)
    {
        llMessageLinked(LINK_ROOT, 0, "menurequest", NULL_KEY);
    }
}

lien permanent

Script "single panel"  (Scripts) posté le samedi 17 mai 2008 16:07

Script pour faire apparaitre une texture spécifique sur un panneau avec plusieurs textures..

// 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

string this;
integer namelength;
string current_name;
string current_key;

default
{
    state_entry()
    {
        this = llGetObjectName();
        namelength = llStringLength(this);
    }
    on_rez(integer n) {
        llResetScript();
    }

    touch_start(integer total_number)
    {
        llMessageLinked(LINK_ROOT, 0, "largepanel ("+current_name+","+current_key+")", NULL_KEY);
    }
    link_message(integer sender, integer num, string msg, key id) {

        if(llGetSubString(msg,0,llSubStringIndex(msg," ") - 1) == this) {                                       
            msg = llDeleteSubString(msg, 0, llSubStringIndex(msg,"("));
            msg = llDeleteSubString(msg, llSubStringIndex(msg,")"),llStringLength(msg));
            list mp = llParseString2List(msg,[","],[]);
            current_name = llList2String(mp,0);
            current_key = llList2String(mp,1);
            llSetPrimitiveParams([PRIM_TEXTURE, ALL_SIDES, current_key, <1, 1, 0>, <0, 0, 0>, 0.0]);
        }
    }
}

lien permanent

YATO-BF 0.3b  (Scripts) posté le samedi 17 mai 2008 16:17

Script allant de paire avec le "keybumper script"..

// 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);
    }
}

lien permanent




fermer la barre

Vous devez être connecté pour écrire un message à jullyeallen

Vous devez être connecté pour ajouter jullyeallen à vos amis

 
Créer un blog