Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //self explanatory shit
- integer current_notecard;
- integer current_notecard_line;
- integer lines_in_current_notecard;
- integer DEBUG = FALSE;
- //whether its online data or number of lines data
- integer FLAG_GET_NUMLINES;
- integer FLAG_GET_NAME;
- integer FLAG_GET_STATUS;
- integer DISPLAY = -1;
- integer count;
- integer max = 9001;
- //Display stuff
- list display;
- //Dataserver shit
- key req;
- string name;
- string status = "_";
- string uuid;
- string loadbar;
- list load = ["|---","-|--","--|-","---|","----"];
- integer zoomb;
- loadbarstuff()
- {
- zoomb = (zoomb + 1) % llGetListLength(load);
- loadbar = llList2String(load,zoomb);
- }
- float red = 1;
- float green;
- float blue;
- vector color;
- colortick()
- {
- if(red >= 1.0)
- {
- if (blue > 0.1)
- {blue = blue - 0.1;}
- else
- {green = green + 0.1;}
- }
- if(green >= 1.0)
- {
- if (red > 0.1)
- {red = red - 0.1;}
- else
- {blue = blue + 0.1;}
- }
- if(blue >= 1.0)
- {
- if (green > 0.1)
- {green = green - 0.1;}
- else
- {red = red + 0.1;}
- }
- color = <red,green,blue>;
- }
- stalk_list_dump(string t)
- {
- integer x;
- for(x=0;x<llGetInventoryNumber(INVENTORY_NOTECARD);x++)
- {
- if(llToLower(llGetInventoryName(INVENTORY_NOTECARD,x))==t)
- {
- current_notecard = x;
- current_notecard_line = 0;
- FLAG_GET_NUMLINES = TRUE;
- FLAG_GET_NAME = FALSE;
- FLAG_GET_STATUS = FALSE;
- DISPLAY = x;
- }
- }
- }
- default
- {
- on_rez(integer r)
- {
- llResetScript();
- }
- changed(integer c)
- {
- if(c & CHANGED_INVENTORY)
- {
- llOwnerSay("Updating Stalkbox");
- llResetScript();
- }
- if(c & CHANGED_TELEPORT)
- llResetScript();
- }
- state_entry()
- {
- llListen(0,"","","");
- if(DEBUG == TRUE)
- llSay(0,"initializing");
- integer x;
- for(x=0;x<llGetInventoryNumber(INVENTORY_NOTECARD);x++)
- {
- display += "";
- }
- FLAG_GET_NUMLINES = TRUE;
- req = llGetNumberOfNotecardLines(llGetInventoryName(INVENTORY_NOTECARD,current_notecard));
- }
- listen(integer c, string n, key i, string m)
- {
- if(llGetOwnerKey(i)==llGetOwner())
- {
- m = llToLower(m);
- if(llSubStringIndex(m,"stalklist") == 0)
- {
- string targ = llGetSubString(m,llSubStringIndex(m," ")+1,-1);
- llOwnerSay("Showing online accounts for: " + targ);
- stalk_list_dump(targ);
- }
- }
- }
- dataserver(key i, string data)
- {
- if(i == req)
- {
- count++;
- if(DEBUG == TRUE)
- llSay(0,data);
- if(FLAG_GET_NUMLINES == TRUE)
- {
- lines_in_current_notecard = (integer)data;
- FLAG_GET_NUMLINES = FALSE;
- FLAG_GET_NAME = TRUE;
- if(DEBUG == TRUE)
- llSay(0,"Got " + (string)lines_in_current_notecard + " lines in notecard " + llGetInventoryName(INVENTORY_NOTECARD,current_notecard) + "\nGetting Notecard info for line " + (string)current_notecard_line + ".");
- req = llGetNotecardLine(llGetInventoryName(INVENTORY_NOTECARD,current_notecard),0);
- }
- else if(FLAG_GET_NAME == TRUE)
- {
- if(data != EOF)
- {
- if(DEBUG == TRUE)
- llSay(0,"checking for notes");
- if(llSubStringIndex(data,"#") == 0)
- {
- //It's a note about that person or account
- //Skip it
- current_notecard_line++;
- req = llGetNotecardLine(llGetInventoryName(INVENTORY_NOTECARD,current_notecard),current_notecard_line);
- }
- else
- {
- if(DEBUG == TRUE)
- llSay(0,"Got name data");
- name = llGetSubString(data,0,llSubStringIndex(data,"#")-1);
- uuid = llGetSubString(data,llSubStringIndex(data,"#")+1,-1);
- if(DEBUG == TRUE)
- llSay(0,"Name = " + name + "\nUUID = " + uuid);
- FLAG_GET_STATUS = TRUE;
- FLAG_GET_NAME = FALSE;
- if(DEBUG == TRUE)
- llSay(0,"Requesting online data for uuid");
- req = llRequestAgentData((key)uuid,DATA_ONLINE);
- }
- }
- else
- {
- if(DEBUG == TRUE)
- llSay(0,"EOF: Updating display list");
- display = llListReplaceList(display,[llGetInventoryName(INVENTORY_NOTECARD,current_notecard) + " " + status],current_notecard,current_notecard);
- if(DEBUG == TRUE)
- llSay(0,"resetting status and flags");
- status = "_";
- FLAG_GET_NUMLINES = TRUE;
- FLAG_GET_STATUS = FALSE;
- if(DEBUG == TRUE)
- llSay(0,"modulo on current notecard. resetting display flags");
- if(DISPLAY == current_notecard)
- DISPLAY = -1;
- current_notecard = (current_notecard + 1) % llGetInventoryNumber(INVENTORY_NOTECARD);
- if(DEBUG == TRUE)
- llSay(0,"resetting current notecard line request to 0");
- current_notecard_line = 0;
- if(DEBUG == TRUE)
- llSay(0,"current notecard is " + (string)current_notecard + "\nRequesting number of notecard lines for " + llGetInventoryName(INVENTORY_NOTECARD,current_notecard));
- req = llGetNumberOfNotecardLines(llGetInventoryName(INVENTORY_NOTECARD,current_notecard));
- if(DEBUG == TRUE)
- llSay(0,"Setting text");
- if(DEBUG == TRUE)
- llSetText("Current Notecard: " + (string)current_notecard + "\nCurrent Line: " + (string)current_notecard_line + "\n" + llDumpList2String(display,"\n"),<0,1,0>,10);
- //else
- //{
- //loadbarstuff();
- //llSetText(llDumpList2String(display,"\n") + "\n" + loadbar,<0,1,0>,10);
- //}
- }
- }
- else if(FLAG_GET_STATUS == TRUE)
- {
- if(data == "1")
- {
- if(DEBUG == TRUE)
- llSay(0,name + " online");
- if(DISPLAY == current_notecard)
- {
- llOwnerSay(llGetInventoryName(INVENTORY_NOTECARD,current_notecard) + " is online on account: " + name);
- }
- status = "X";
- }
- else
- {
- if(DEBUG == TRUE)
- {
- llSay(0,name + " offline");
- }
- }
- FLAG_GET_STATUS = FALSE;
- FLAG_GET_NAME = TRUE;
- current_notecard_line++;
- if(DEBUG == TRUE)
- llSay(0,"Requesting notecard line " + (string)current_notecard_line + " for notecard " + llGetInventoryName(INVENTORY_NOTECARD,current_notecard));
- req = llGetNotecardLine(llGetInventoryName(INVENTORY_NOTECARD,current_notecard),current_notecard_line);
- }
- colortick();
- loadbarstuff();
- llSetText(llDumpList2String(display,"\n") + "\n" + loadbar + "\nCurrent scan: " + llGetInventoryName(INVENTORY_NOTECARD,current_notecard),color,10);
- }
- if(count > max)
- llResetScript();
- else return;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement