Themabewertung:
  • 0 Bewertung(en) - 0 im Durchschnitt
  • 1
  • 2
  • 3
  • 4
  • 5
Teleport-Script mit Menue
#1
Das Script:

PHP-Code:
// 12/01/08 List command doesn't work. Useless anyways hehe!
string  _notecard = "hyperjumps";
key avatar;

integer chatChannel = 212;
integer channel=155;
string HELP_MSG = "Wuuschhhhhhhhhh ...";


list    
_teleporterURLs;
list    
_teleporterStatons;
list    
theStatons;

integer _linenum = 0;
integer curStatonOffset = 0;
integer statonChunk = 6;
integer curStatonEnd = 5;
integer totalStatons = 0;
integer dialogActive = 0;
integer curIdx  = -1;
string dispStatonStr = "";

string NEXT_MSG = "Next >>";
string PREV_MSG = "<< Prev";
string LIST_MSG = "List";

string CUR_SET  = "c";
string ALL_SET  = "a";

list 
cmdNextChunk = [">>", "next", "Next"];
list 
cmdPrevChunk = ["<<", "prev", "Prev"];
list 
cmdLsCur     = ["ls", "list"];
list 
cmdLsAll     = ["la", "listall"];
list 
cmdSearch    = ["s", "search"];

string newURL;
string newDesc;

//-----------------------

reset_teleporter()
{
    
llSetText("starting teleporter....",<1,1,1>,1.0 );
    
llListen(77, "", "", "");
    
curStatonOffset = 0;
    
curStatonEnd = 5;
    
_linenum = 0;
    
dialogActive = 0;
    
_teleporterURLs = [];
    
_teleporterStatons = [];
    
totalStatons = 0;
    
curIdx = -1;
    
dispStatonStr = "";
    
llGetNotecardLine(_notecard, _linenum);
}

add_staton(string line)
{
  
//  list words = llParseString2List(line, [" ", " ", "="], []);
    
list words = llParseString2List(line, ["="], []);
    if (
llGetListLength(words) < 2)
    {
        return;
    }
    
string url = llList2String(words, llGetListLength(words) - 1);
    
string staton = "";
    
integer i;

    for (
i=0; i<llGetListLength(words) - 1; i++)
    {
        if (
llStringLength(staton) > 0)
        {
            
staton += " ";
        }
        
staton += llList2String(words, i);
    }

    
_teleporterURLs += [url];
    
_teleporterStatons += [staton];
}


curStatons()
{
    
theStatons = [PREV_MSG, LIST_MSG, NEXT_MSG];

    
integer i;
    
dispStatonStr = "";

    for (
i = curStatonOffset; i <= curStatonEnd; i++)
    {
        if (
curIdx == i)
        {
            
dispStatonStr += "*";
        } else {
                
dispStatonStr += "  ";
        }
        
dispStatonStr += (string) (i + 1) + ") ";
        
dispStatonStr += llList2String(_teleporterStatons, i);
        
dispStatonStr += "\n";

        
theStatons += (string)(i + 1);
    }
}


doNextSet()
{
    
curStatonOffset += statonChunk;
    
curStatonEnd = curStatonOffset + (statonChunk - 1);

    if (
curStatonOffset >= totalStatons)
    {
        
curStatonOffset = 0;
        
curStatonEnd = curStatonOffset + (statonChunk - 1);
    }

    if (
curStatonEnd >= totalStatons)
    {
        
curStatonEnd = totalStatons - 1;
    }
}


doPrevSet()
{
    if (
curStatonOffset > 1  && ((curStatonOffset - statonChunk) < 1))
    {
        
curStatonOffset = 0;
    } else {
            
curStatonOffset -= statonChunk;
    }

    
curStatonEnd = curStatonOffset + (statonChunk - 1);

    if (
curStatonEnd >= totalStatons)
    {
        
curStatonEnd = totalStatons - 1;
    }

    if (
curStatonOffset < 0)
    {
        
curStatonEnd = totalStatons - 1;
        
curStatonOffset = totalStatons - (statonChunk - 1);
    }
}

doListStatons(string mode)
{
    
integer i;
    
integer startPos;
    
integer endPos;

    if (
mode == "a")
    {
        
startPos = 0;
        
endPos = totalStatons - 1;
    }
    else
    {
            
startPos = curStatonOffset;
        
endPos = curStatonEnd;
    }

    for (
i = startPos; i <= endPos; i++)
    {
        
string newURL = llList2String(_teleporterURLs, i);
        
string newDesc = llList2String(_teleporterStatons, i);
         
//llSay(0, (string)(i + 1) + ": " + newDesc + " = " + newURL);
    
}
}


doSearch(list theTerms)
{
    
integer i;
    
string thePhrase = llToLower(llDumpList2String(theTerms, " "));
    
llSay(0, "the term is " + thePhrase);

    for (
i = 0; i < totalStatons; i++)
    {
        
string curString = llList2String(_teleporterStatons, i);
        if (
llSubStringIndex(llToLower(curString), thePhrase) != -1)
        {
            
string newURL = llList2String(_teleporterURLs, i);
            
llSay(0, (string)(i + 1) + ": " + curString + " = " + newURL);
        }
    }
}

//-----------------------

default
{
  
state_entry()  //on_rez(integer start_param)
   
{
       
reset_teleporter();
    }




    
dataserver(key query_id, string data)
    {
        if (
data != EOF)
        {
            
add_staton(data);
            
_linenum++;

            if (
_linenum % 3 == 0)
            {
                
llSetText("starting: \n" + (string)_linenum + " statons ...",
                    <
1,1,1>,1.0 );
            }
            
llGetNotecardLine(_notecard, _linenum);
            return;
        }
        
llListen(channel, "", NULL_KEY, "");

        
totalStatons = llGetListLength(_teleporterURLs);
        
llSay(0, HELP_MSG);
        
dialogActive = 1;
        
llSetText("SoA 2015 - Teleporter", <1,1,1>, 1.0 );
    }

    
touch_start(integer touchNumber)
    {

         
curStatons();

       
llDialog(llDetectedKey(0),
           
dispStatonStr,
           
theStatons, channel);
    
avatar = llDetectedKey(0);
      }

    
listen(integer channel, string name, key id, string message)
    {

        if (
dialogActive == 0)
        {
            
llWhisper(0, " ... still loading statons ...");
            return;
        }

        if (
message == "")
        {
            
message = "cur";
        }


    
//    list words = llParseString2List(message, [" ", "="], []);
       
list words = llParseString2List(message, [" ", " ", "="], []);
         list 
testFind = llList2List(words, 0, 0);

        if (
llListFindList(cmdNextChunk, testFind) != -1)
        {
            
doNextSet();
            
curStatons();
            if (
channel == chatChannel)
            {
                
doListStatons(CUR_SET);
            }
            else
            {
                    
llDialog(id, dispStatonStr,theStatons, channel);
            }
            return;
        }

        else if (
llListFindList(cmdPrevChunk, testFind) != -1)
        {
            
doPrevSet();
            
curStatons();
            if (
channel == chatChannel)
            {
                
doListStatons(CUR_SET);
            }
            else
            {
                    
llDialog(id, dispStatonStr, theStatons, channel);
            }
            return;
        }

        else if (
llListFindList(cmdSearch, testFind) != -1)
        {
            
doSearch(llList2List(words, 1, -1));
            return;
        }

        else if (
llListFindList(cmdLsAll, testFind) != -1)
        {
            
doListStatons(ALL_SET);
            return;
        }


        else if (
llListFindList(cmdLsCur, testFind) != -1)
        {
            
doListStatons(CUR_SET);
            return;
        }


        else if ((integer)
message > 0 && (integer)message < 256)
        {

             
curIdx = (integer)message - 1;

            
string newURL = llList2String(_teleporterURLs, curIdx);
           
// string newDesc = llList2String(_teleporterStatons, curIdx);
vector LookAt = <1,1,1>;

    
integer u= llSubStringIndex(newURL, "<");
integer v=llStringLength(newURL);
newDesc=llGetSubString(newURL,0,u-1);
newURL=llGetSubString(newURL,u,v);
 
// llSay(0, newDesc);


  //llSay(0, newURL);


     
vector dings =(vector)newURL;
    
osTeleportAgent(avatar, newDesc, dings, LookAt);
       
// llMapDestination(newDesc,dings, LookAt);
          
llResetScript(); // llSetParcelMusicURL(newURL);
        
}
    }
} 

Beispiel-Notecard für hyperjumps:


PHP-Code:
menue-punkt1=region1<125, 203, 22)>
menue-punkt2=region2<37, 19, 22)> 


Das Script läuft stabil ! Für Event-Regionen, die Channel anpassen.
Zitieren


Nachrichten in diesem Thema
Teleport-Script mit Menue - von Uwe Furse - 01.08.2015, 03:26
RE: Teleport-Script mit Menue - von Gubbly - 01.08.2015, 12:22
RE: Teleport-Script mit Menue - von Gubbly - 01.08.2015, 13:51

Möglicherweise verwandte Themen…
Thema Verfasser Antworten Ansichten Letzter Beitrag
Question Suche Garagentor script Kalkofe 4 5.112 20.07.2024, 12:06
Letzter Beitrag: Manfred Aabye
Question Tür script gesucht, Tür soll bei Eintritt ein paar meter vorher öffnen Kalkofe 9 7.376 11.10.2023, 05:37
Letzter Beitrag: Christoph Balhaus
  Rufknopf Script für Aufzug gesucht Xenos Yifu 4 5.384 03.04.2022, 19:09
Letzter Beitrag: Mareta Dagostino
  Geber/ Rezz Script Xenos Yifu 10 10.968 28.11.2020, 14:28
Letzter Beitrag: Kubwa
  Suche Script Gruppe Titoss 4 9.964 27.11.2020, 14:52
Letzter Beitrag: Dorena Verne

Gehe zu:


Benutzer, die gerade dieses Thema anschauen: 1 Gast/Gäste