Here is the new code and information:
integer listPos; // Just to be sure I wasn't mising something... all main variables are now global.
vector targetPos;
integer channel = -10;
list avatarsDetected = [ ];
list keysDetected = [ ];
list posDetected = [ ];
string Gname;
string tool;
integer nextStep;
string nextAvatarName;
string nextAvatarKey;
vector nextAvatarPos;
string menuText = "Select the person to receive surprise coupon!!";
useKey(key targetKey)
{
//Just wanted to check my data, and lo and behold.. no targetPos...
llSay(0,(string)targetKey); //Returns valid key
llSay(0,(string)targetPos); //Returns <0,0,0> everytime no matter who you pick
llSay(0,(string)listPos); //Returns position in list (as far as I can tell it must be right since name and key match
llSay(0,Gname); //Returns correct name when clicked on Dialog Menu
//Since I got it working I thought it would be cool to rez a "coupon" next to a customer
//that would be of just whoever one randomly chose to be the lucky person that could get
//a full sale copy of an item in the store or something... kind of draw attention to things, etc.
//---You could even oversize your sale panel for a big effect
I really like this idea the more//I thought on it....
}
default
{
state_entry(){
llListen(channel, "", llGetOwner(), ""
;}
link_message(integer sender_num, integer num, string str, key id)
{
if (str == "GetCustomer"
{llSensor("", NULL_KEY, AGENT, 30, PI);
}
}
listen(integer channel, string name, key id, string message)
{
Gname = message;
listPos = llListFindList(avatarsDetected, (list)message);
targetPos = llList2Vector(posDetected, listPos);
useKey(llList2Key(keysDetected, listPos));
}
sensor(integer numDetected)
{
if (numDetected > 12) numDetected = 12;
avatarsDetected = [ ];
keysDetected = [ ];
posDetected = [ ];
for (nextStep = 0; nextStep < numDetected; nextStep++)
{
nextAvatarName = llDetectedName(nextStep);
nextAvatarKey = llDetectedKey(nextStep);
nextAvatarPos = llDetectedPos(nextStep);
if (llStringLength(nextAvatarName) > 24) nextAvatarName = llGetSubString(nextAvatarName, 0, 23);
avatarsDetected = (avatarsDetected=[]) + avatarsDetected + nextAvatarName;
keysDetected = (keysDetected=[]) + keysDetected + nextAvatarKey;
posDetected = (posDetected=[]) + posDetected + (string)nextAvatarPos;
}
llDialog(llGetOwner(), menuText, avatarsDetected, channel);
}
}
Basically, all I added was a THIRD LIST.
All it is supposed to do is grab the vector position of the very SAME avatars it is already recording.
Granted I have never used the DetectedPos function before, but there really isn't much info on the wikki... from what I gleaned from it, and the fact that I didn't get any errors, I think it is right though on format.
All I get are zeros for vectors. Everything else works like it did before, so I am using the script as it sits just fine, but after I came up with the 'coupon / "Nth" visitor today' idea... I really like it.
Although I do plan to make a nifty gadget with this and the scripts linked to it, (Well basically a HUD with options for auto-rez inventory, updating your store, etc.) I plan to make this and everything publicly available because of everyones help. I can't thank everyone enough.
Take care,
-Hap
[sample output: ]
[19:41] Customer Service HUD at3: c123f1ca-b1c5-4a90-b6d5-36daf13679f3
[19:41] Customer Service HUD at3: <0.00000, 0.00000, 0.00000>
[19:41] Customer Service HUD at3: 1
[19:41] Customer Service HUD at3: Lucinda Obviate
[----------------------]

