|
Lola123 Littlething
Registered User
Join date: 19 Aug 2007
Posts: 6
|
07-04-2008 16:01
Hello! I need a script that says the avatars name and dob in chat, can anyone help with this one?  I have one that kinda does this, but they r both seperate scripts and I cant get them to work together.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
07-04-2008 19:54
This should do it. NOTE: Compilation errors now fixed (2008-07-05 15:42 PDT). float MIN_TIMER = 0.05; float REQUEST_TIMEOUT = 2.0;
list toucherNames = []; list dobRequests = []; list requestTimes = []; integer nTouchers = 0;
addToucher(key toucher, string name) { key request = llRequestAgentData(toucher, DATA_BORN); float time = llGetTime();
toucherNames = (toucherNames=[])+toucherNames+[ name ]; dobRequests = (dobRequests=[])+dobRequests+[ request ]; requestTimes = (requestTimes=[])+requestTimes+[ time ]; ++nTouchers;
if (nTouchers == 1) { llSetTimerEvent(REQUEST_TIMEOUT); } }
removeToucher(integer index) { toucherNames = llDeleteSubList(toucherNames, index, index); dobRequests = llDeleteSubList(dobRequests, index, index); requestTimes = llDeleteSubList(requestTimes, index, index); --nTouchers;
if (index == 0) { float period; if (nTouchers > 0) { period = llList2Float(requestTimes, 0)+REQUEST_TIMEOUT-llGetTime(); if (period < MIN_TIMER) { period = MIN_TIMER; } } else { period = 0.0; }
llSetTimerEvent(0.0); } }
default { touch_start(integer nDetected) { integer i; for (i = 0; i < nDetected; ++i) { key toucher = llDetectedKey(i); string name = llDetectedName(i);
addToucher(toucher, name); } }
dataserver(key request, string data) { integer index = llListFindList(dobRequests, [ request ]); if (index < 0) { return; }
string name = llList2String(toucherNames, index); removeToucher(index);
llSay(0, name+": Born "+data); }
timer() { if (nTouchers > 0) { string name = llList2String(toucherNames, 0); removeToucher(0);
llSay(0, name+": DOB request timed out"); } } }
|
|
Lola123 Littlething
Registered User
Join date: 19 Aug 2007
Posts: 6
|
07-05-2008 10:07
Tried to compile and we fixed a few of the errors it gave but at a stoping point and cant get this one to work.
|
|
Hewee Zetkin
Registered User
Join date: 20 Jul 2006
Posts: 2,702
|
07-05-2008 15:43
Okay. I fixed the errors (replaced the original script above). It now compiles in-world and seems to work properly. Enjoy! 
|
|
Lola123 Littlething
Registered User
Join date: 19 Aug 2007
Posts: 6
|
07-05-2008 16:37
Ty Ty! U r awesome Hewee!
|