Leander Tyles Posted June 21, 2013 Share Posted June 21, 2013 Hi, my project is rather confusing so ill tell you a little about what im trying to accomplish. i have a 'teleporter rental system' which purposly goes to random x,y,z positions everytime its used,im trying to make it so tenants+partners get sent to the same coordinates at the moment when a persons sits it checks the webserver in order to findout if they a tenant or not,then a bunch of infomation is returned included in the message body is wether that person has a partner or not, if they dont it`ll say "NONE" string partner = llList2String(bodyCSV, 3); -OK SO HERES THE PART I NEED HELP WITH [STEP 1] when a tenant sits on the teleporter, if they have a partner... check if thier name is in the list [STEP 2] if thier partner name is in the list, retreive thier coordinates so i can warp straight to it [STEP 3] if the person trying to teleport has a partner but thier name isnt in the list thenrecord the sitting guys llGetPos() in the list when he reaches the destination -------then hopefully everything should work out. can sombody provide me with code examples to achieve my goal, im terrible with lists they always confuse me.i tried to make a subscription kiosk in the past, didnt goto well ill try to learn from visitor greeter scripts or groupjoin signs they usualy involve lists saving the coords on the webserver might be easier solution but too many problems i dont want to think about. only thing i have to worry about this way is the list becoming to large and crashing the script Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 21, 2013 Share Posted June 21, 2013 If you can store the information about whether a person has a partner on your web server, why not also store the partner's UUID there? You have less of a memory issue if you keep the UUIDs there instead of building lists in your LSL script. So, return the partner's UUID when the person sits on your teleporter. If the partner is on the sim, teleport to him/her. (I'm assuming that all of your potential TP destinations are on the same sim, so these are not intersim TPs.) If not, teleport to a random spot. I'd deal with adding a partner's UUID to the web database as a separate operation, since there's no clean way to gather that information during the TP operation. changed (integer change){ if (change & CHANGED_LINK) { gAv = llAvatarOnSitTarget(); //Global variable if (gAv ) { gHTTPReqID = llHTTPRequest(Your_servers_URL,[parameters], (string)gAv); // In whatever form your web server expects the request }}http_response (key Request, integer status, list metadata, string data){ if Request == gHTTPReqID ) { key Partner = (key) data; vector Where; // This will be your TP destination list IsInSim = llGetAgentList(AGENT_LIST_REGION,[]); if (~llListFindList(IsInSim,[Partner]) ) // If partner is on the sim, Where is the partner's location { Where = llList2Vector(llGetObjectDetails(Partner,[OBJECT_POS]),0); } else //If not, Where is a selected randomly from your list of possible destinations on the sim { Where = llList2Vector(gLocations, (integer)llFrand(llGetListLength(gLocations) ); } vector BackHere = llGetPos(); llSetRegionPos(Where); // Send the person to the destination llUnSit(gAv); // Stand up llSetRegionPos(BackHere); // Send the seat back home} Link to comment Share on other sites More sharing options...
Leander Tyles Posted June 21, 2013 Author Share Posted June 21, 2013 yea luckily i do record the uuids already, i just didnt want to record the house position on the webserver for multiple reasons, sim crash, server offline etc.. heres all the infomation thats returned, list bodyCSV = llCSV2List(body); key uuid = llList2Key(bodyCSV, 0); string name = llList2String(bodyCSV, 1); key partneruuid = llList2Key(bodyCSV, 2); string partner = llList2String(bodyCSV, 3); string expiration = llList2String(bodyCSV, 4); integer unixExpiration = llList2Integer(bodyCSV, 5); string design = llList2String(bodyCSV, 6); your code example is very exciting to me, returning an avatars position and teleporting straight to them is alot simpler im concerned about problems that may occur if i do it this way tho 1) partner may be in the sim but not neccaserily in thier apartment ( i could check if llovermyland perhaps but still no gaurantee that they in thier house) 2) what if tenant+partner was both in the lobby waiting to use the teleporter, they wud be stuck in an endless loop thier hmm maybe i could just warn the person trying to teleport that thier partner is in the sim, would they like to goto them its a possibility i suppose, then if it fails they can say no next time and ofcourse if they are both in the lobby at the time, first person will have to ensure he presses No. so they get sent to the house and not to his partner probally standing beside him Link to comment Share on other sites More sharing options...
Rolig Loon Posted June 21, 2013 Share Posted June 21, 2013 I think I'm missing something too. If you're intending to have people end up in their own homes, why would you ever want to have them TP to a random location? It would seem more logical to store their home locations and have them TP to the correct one. If you don't want to store the locations on your server for some reason, you could store them in a single strided list. (gLocations = [uUID1,loc 1, UUID2,loc 2, UUID3, loc 3 ....] ) Each stride could consist of one partner's UUID and the home location. If you create such a list, you could modify my earlier code to look like this.... changed (integer change){ if (change & CHANGED_LINK) { gAv = llAvatarOnSitTarget(); //Global variable if (gAv ) { integer idx = llListFindList(gLocations,[gAv]); //See if this av's name is in the gLocations list if (~idx) // If it is .... { vector BackHere = llGetPos(); llSetRegionPos(llList2Vector(gLocations,idx+1)); //Go to gAv's home location llUnSit(gAv); llSetRegionPos(BackHere); } else //Let's see if the Partner's name is in the location list { gHTTPReqID = llHTTPRequest(Your_servers_URL,[parameters], (string)gAv); // In whatever form your web server expects the request } }}http_response (key Request, integer status, list metadata, string data){ if Request == gHTTPReqID ) { key Partner = (key) data; integer idx = llListFindList(gLocations,[Partner]); //See if the Partner's name is in the gLocations list if (~idx) // If it is .... { vector BackHere = llGetPos(); llSetRegionPos(llList2Vector(gLocations,idx+1)); //Go to Partner's home location llUnSit(gAv); llSetRegionPos(BackHere); } }} That would also take care of the two problems that you identified as well. Link to comment Share on other sites More sharing options...
Recommended Posts
Please take a moment to consider if this thread is worth bumping.
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now