Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- key kSeat;
- integer iRecording;
- list lSequence = [];
- string sLastStamp;
- string iTimestampOffset;
- Init () {
- llOwnerSay("init" );
- kSeat = NULL_KEY;
- //lSequence = [];
- iRecording = 0;
- llListen (4, "", llGetOwner (), "");
- }
- integer Millisec(string Stamp) {
- return (integer)llGetSubString(Stamp, 8, 9) * 86400000 + // Days
- (integer)llGetSubString(Stamp, 11, 12) * 3600000 + // Hours
- (integer)llGetSubString(Stamp, 14, 15) * 60000 + // Minutes
- llRound(((float)llGetSubString(Stamp, 17, -2) * 1000.0)) // Seconds.Milliseconds
- - 617316353; // Offset to fit between [-617316353,2147483547]
- }
- string left(string src, string divider) {
- integer index = llSubStringIndex( src, divider );
- if(~index)
- return llDeleteSubString( src, index, -1);
- return src;
- }
- string right(string src, string divider) {
- integer index = llSubStringIndex( src, divider );
- if(~index)
- return llDeleteSubString( src, 0, index + llStringLength(divider) - 1);
- return src;
- }
- default
- {
- state_entry () {
- Init ();
- }
- on_rez(integer start_param) {
- Init ();
- }
- listen(integer channel, string name, key id, string message) {
- if (channel==4) {
- if (message == "hump"){
- kSeat = llGetKey();
- llOwnerSay ("Alpha is looking kind of horny...");
- llOwnerSay ("@sit:"+(string)kSeat+"=force");
- llSleep(5.0);
- integer i;
- integer length = llGetListLength(lSequence);
- //string sSegment;
- string sMseconds;
- do
- //string sSegment = llList2String(lSequence, i);
- llOwnerSay(llList2String(lSequence, i) );
- //mseconds = left(sSegment, ":");
- //llOwnerSay(left(llList2String(lSequence, i), ":");
- // llSleep(seconds);
- //llOwnerSay(llList2String(lSequence, i) );
- while(++i < length);
- } else if (message == "record"){
- lSequence = [];
- iRecording = 1;
- sLastStamp = llGetTimestamp();
- llOwnerSay ("Recording sequence...");
- } else if (message == "stop"){
- iRecording = 0;
- llOwnerSay ("Stopping recording.");
- } else if (message == "play") {
- llOwnerSay ("Playing sequence.");
- iRecording = 0;
- integer i;
- llOwnerSay("lSequence list: " + llDumpList2String(lSequence, "**"));
- integer length = llGetListLength(lSequence);
- //string sSegment;
- string sMseconds;
- list lTimestamps = llList2ListStrided(lSequence,0,-1,3);
- list lNumbers = llList2ListStrided(lSequence,1,-1,3);
- list lCommands = llList2ListStrided(lSequence,2,-1,3);
- integer iLength = llGetListLength(lTimestamps);
- llOwnerSay("list length" + (string)iLength );
- llOwnerSay("numbers list: " + llDumpList2String(lCommands, "**"));
- do
- //string sSegment = llList2String(lSequence, i);
- //llOwnerSay(llList2String(lSequence, i) );
- llOwnerSay(llList2String(lTimestamps, i) + " " + llList2String(lNumbers, i) + " " + llList2String(lCommands, i));
- //llOwnerSay(llList2String(lNumbers, i) );
- //llOwnerSay(llList2String(lCommands, i) );
- //mseconds = left(sSegment, ":");
- //llOwnerSay(left(llList2String(lSequence, i), ":");
- // llSleep(seconds);
- //llOwnerSay(llList2String(lSequence, i) );
- while(++i < iLength);
- llOwnerSay("Done playing. lSequence list: " + llDumpList2String(lSequence, "**"));
- }
- }
- }
- link_message(integer sender_num, integer num, string list_argument, key id)
- {
- if(iRecording == 1){
- //iTimestampOffset = (Millisec(llGetTimestamp()) - Millisec(sLastStamp));
- list lCommand = [(string)(Millisec(llGetTimestamp()) - Millisec(sLastStamp)), (string)num, list_argument];
- //lSequence = lSequence + sCommand;
- llOwnerSay ((string)lCommand);
- lSequence += lCommand;
- sLastStamp = llGetTimestamp();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement