Welcome to the Second Life Forums Archive

These forums are CLOSED. Please visit the new forums HERE

Processing multiple llRequestAgentData returns

Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
02-28-2008 09:17
I'm struggling to find a stable & trustworthy solution to the following problem. Every potential solution I think of seems to have holes in it...

I want to scan an area and make a list of keys of those Agents who have 'No Payment Info on File'. To do this I am using llSensorRepeat and llRequestAgentData as follows:

1) llSensorRepeat and loop to put all detected keys into a list called 'QueryList'

2) Then loop for the number of detected Agents: llRequestAgentData(llList2Key(QueryList, x), DATA_PAYINFO)

3) Within the dataserver event, a returned data string of "0" indicates that the Agent has 'No Payment Info on File'. It is these Agent's that I'm interested in for this script.

so far, so good (I think)...

The problem seems to be relating the string data being returned in the dataserver event back to the Agent key on whom the llRequestAgentData call was originally made.

If only one Agent is detected in the scan, and therefore only one llRequestAgentData call is made then obviously there is no problem.

The problem I am having is that llSensorRequest could possibly detect 16 Agents, and I need to track who was detected, what their payment status is and then put the key of those with 'No Payment Info on File' into a separate list (for further processing)

Hope I've explained that clearly & thanks in advance for your help...
Baron Hauptmann
Just Designs / Scripter
Join date: 29 Oct 2005
Posts: 358
02-28-2008 09:25
If I am understanding your problem correctly . . . then have yet another list to keep track of the Query calls. In your dataserver event, compare the query against your List, and see which query is coming back. When you know which query is coming back, then you can relate that to the key in the list of Avatars found. Does that make sense?
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
02-28-2008 11:22
Thanks Baron. Yep, you seem to have understood the problem :)

This is what I have come up with (syntax checked, but untested)....

If anyone can see a better way, or how this code might be improved and made more efficient, I'd be grateful for the info....


CODE

// list of all Agents detected and awaiting checking
list QueryList;

// list of the llRequestAgentData validation request key
list ValidationList;

// list of keys of 'No Payment Info on File' Agents
list ProcessNPIList;

PerformScan()
{
llSensor("",NULL_KEY,AGENT,35.00,PI);
}

default
{
state_entry()
{
PerformScan();
}

sensor(integer total_number)
{
integer x;
for (x = 0; x < total_number; x++)
{
QueryList += (list)llDetectedKey(x);
key ValidateRequestData = llRequestAgentData(llList2Key(QueryList,x), DATA_PAYINFO);
ValidationList += (list)ValidateRequestData;
}
}

dataserver(key requested, string data)
{
if ((integer)data == 0)
{

// the key for the NPI Agent will be in the same position in QueryList as the requested key is in ValidationList
ProcessNPIList += llList2Key(QueryList, llListFindList(ValidationList, (list)requested));

// now process the ProcessNPIList entries
// now clear down the lists

PerformScan();
}
}
}
Void Singer
Int vSelf = Sing(void);
Join date: 24 Sep 2005
Posts: 6,973
02-28-2008 11:28
you may want to keep both lists of on-file and not-on-file, so you don't reprocess the same avs over and over.... even limiting the on-file list size to a small number would help, reducing the number of calls to request data.
_____________________
|
| . "Cat-Like Typing Detected"
| . This post may contain errors in logic, spelling, and
| . grammar known to the SL populace to cause confusion
|
| - Please Use PHP tags when posting scripts/code, Thanks.
| - Can't See PHP or URL Tags Correctly? Check Out This Link...
| -
Debbie Trilling
Our Lady of Peenemünde
Join date: 17 Oct 2006
Posts: 434
02-28-2008 12:19
From: Void Singer
you may want to keep both lists of on-file and not-on-file


Hi, yes. This is only a sub-set of the whole script. The actual script includes an 'Exceptions' list of (staff and acceptable NPI) Agent names that do not require processing.

But I think you're right, there should also be a further on-file list of Agents who have had their payment history checked in, say, the last 15 mins and were found to have a payment history.

I don't think the product will require a list of not-on-file Agents as they are unlikely to be in the vicinity for any length of time ;)