Jump to content

Wandering Soulstar

Resident
  • Content Count

    421
  • Joined

  • Last visited

Everything posted by Wandering Soulstar

  1. Reo, A quick check of the AGENT_* flag descriptions in the wiki shows: GENT_ALWAYS_RUN 0x1000 has running ("Always Run") enabled, or is using tap-tap-hold AGENT_WALKING 0x0080 is walking, running or crouch walking so in effect there is no flag that differentiates between the AV running or walking.
  2. A script to do what? Fairly general request that covers a prim saying 'Hello World' when clicked, to an SL wide estate management system.
  3. Side Note to Rosie - Concerning your comments: I tend to make outfits and save them, with the skin, shape, hair, whichever body part appliers are needed, shoes and so on, which means I probably have several thousand items as duplicates, but it makes changing looks far easier than if I didn't. You do know you can save outfits as links as opposed to copies? The only time I put in copies is when it is an item that is modifiable (shoe colour for example) and I want to save it in that state.
  4. One simple thing I have found that helps to keep my inven under control is a periodic cleaning of all those notecards, LMs, animations, pose stands, etc that come when we buy things. No reason to have LMs to stores repeated in the folders of every outfit I have bought there. For the notecards that may contain useful information, I try to keep just one. If you have multiple items from the same store odds are the nc is a repeat.
  5. Thanks Darkie, Clear on the endless loop, it was a long day yesterday and only was not able to put the full idea into script as my brain was a bit fried. So. while you have cleared some up, this leads to other questions: If this is the PHP running on the server that will respond to the llHTTPRequest from SL: <?php$handle = @fopen("/info/infofile.txt", "r");if ($handle) { while (($buffer = fgets($handle)) !== false) { echo $buffer; } if (!feof($handle)) { echo "Error: unexpected fgets() fail\n"; } else { echo "eof\n"; } fclose($handle);}?> And so it reads line by line the file, echoing each line. So my questions are: When does it know to finish this and send it to SL? Can I force a send, and thus an http_reponse() event handler in SL? When I receive the multi-line string in the http_response() event handler, what do I need to parse the string passed as body to break the string into its constituent lines?
  6. Hi All, As I further my understanding of how to communicate with PHP script out-world, a comment in the wiki on llHTTPRequest() has me wondering. One of the Caveats says: 'Requests must fully complete after 60 seconds, or else the response will be thrown away and the http_response status code will be 499' Now in an example where a PHP script will be sending back multiple lines of data, and so triggering multiple http_response() event handlers (see post Access file on Web Server Help - Noob Question, what I am wondering is if the 60 seconds means from the time the initital Request is made (which I believe it is) or if the 'clock' is reset on each response. Basically wondering if I should be making a request for each line of data needed (see following) or the code as described in the earlier post will work till the end of the file independent of how long it is. key http_request_id; string INFO_URL = "http:\\my_domain.com\info_retriever.php"; string END_FILE = "eof" state read_webfile { state_entry() { http_request_id = llHTTPRequest(INFO_URL, [HTTP_METHOD,"POST",HTTP_MIMETYPE,"text/html; charset=iso-8859-1"], "line=0")); } http_response(key request_id, integer status, list metadata, string body) { if (request_id == http_request_id) { if (body != END_FILE) { //do something with textline from body //Now Call the PHP again, passing the line we were in that came in body http_request_id = llHTTPRequest(INFO_URL, [HTTP_METHOD,"POST",HTTP_MIMETYPE,"text/html; charset=iso-8859-1"], "line=" + (string)lineNum ); } else { state running; } } } }
  7. Brilliant! thanks for the help Darkie .. now if I can only throttle my itching to go write new code until I have finished debugging my las project
  8. Ok .. I think I get it. In your example though you used 'GET' ... in the Wiki it lists 4 options to please in this call: "GET", "POST", "PUT" and "DELETE" If I basically want to send a data string to the PHP which do I use? And what are the significance of the others?
  9. I think I answered my last question ... to get the body of the call to PHP from LSL I us: string http_get_request_body ( void ) Correct?
  10. Me again :-) Following on to my last post regarding accessing files on an external webserver I have realized that there is a whole world of PHP out there for me to play in. For those of you here that code in PHP: What is your reccomendation on a good easy editor to use? A quick google has provided quite a list http://en.wikipedia.org/wiki/List_of_PHP_editors and wanted to narrow down to a couple before I start downloading and trying out. My computer is windows so that at least narrows things a bit.
  11. he he .. yes that would bite me wouldn't it :-) Thanks so much Darkie, I have always been a bit weary about pushing out from SL thinking it was going to be more difficult, but you have opened my eyes to a whole new world, I finally can make use of that web server for more than just my personal mail. On the PHP front, I assume there is some way for the script to get the data passed in the body parameter of the llHTTPRequest call. The wiki shows examples of reading the header that comes, but I was wondering how to get the body parameter?
  12. Thanks for the quick reply Darkie .. seems to be much simpler than I thought. Let me repeat what you have said with examples to be certain I have it correct: 1) Create the following PHP script and upload it to my webserver directory <?php$handle = @fopen("/info/infofile.txt", "r");if ($handle) { while (($buffer = fgets($handle)) !== false) { echo $buffer; } if (!feof($handle)) { echo "Error: unexpected fgets() fail\n"; } else { echo "eof\n"; } fclose($handle);}?> 2) Create the following script in LSL (only have a section here assuming there is more around this that gets us to the state key http_request_id;string INFO_URL = "http:\\my_domain.com\info_retriever.php";string END_FILE = "eof" state read_webfile{ state_entry() { http_request_id = llHTTPRequest(INFO_URL, [], ""); } http_response(key request_id, integer status, list metadata, string body) { if (request_id = http_request_id) { if (body != END_FILE) { //do something with textline from body } else { state running; } } }} 3) Have an file called infofile text in the indicated location on my server that has lines of data that is it?
  13. Hi all, As I am finally winding down (I Hope) my current scripting project, I have already started to think about the next one :-) . Part of this one though is going to delve into an area that I have no real experience in and was hoping that someone could point me to some basic tutorials on how-to, or if there are scripts already written in the public domain that I could use as a start that would be just as good (if not better). What I am looking to do is be able to get a file off a web-server (I have one of those) and read it like I would a notecard in the same prim. Now I do realize that it would not be as simple as that, as I cannot imagine I can download a file into a prim, but that is the end result I am looking for. So .. any suggestions? Thanks in advance! Wanda Soulstar
  14. Perrie, Quite right in that my post was a bit oportunistic, but I was as well trying to help. To keep it from being a full head on sales pitch was why I only posted the link to my post in the mainland - rental section. But you are right and I have edited my post accordingly.
  15. When tou say get it from a notecard, I assume you mean that you have a notecard with parameters and the script would read this on start up? If that is the case look at the function in the wiki llGetNotecardLine
  16. Hi Chaos, Not quite sure what your question exaclt is. Theid paramete in the listen gives you the key from which the message is initiating, and could be a prim or Avatar. The way the code you have provided is written, it will only respond to messages that come from objects (prims) that are owned by the owner of the script . What is the specific conditionyou are trying to test for? Wanda
  17. Alien, Terribly sorry to hear such a tale of what is definitley abuse by an un-scrupulous landlord. As the others have said, nothing LL will do to resolve the dispute, but as well good news as there is nothing they will do against you either. I can say that not all landlords are like this, I for one try to provide the best service and homes as is humanly possible. I sincerly believe that what you encountered here was an aberation and not the norm. Wanda Soulstar
  18. So .. I have been working on the path of having the Building Prims share the load of passing the scripts and have written the code for the HUD .. now off to the Building Prim Control code. I wanted to share the results with you all for any comments ... I should explain a few things beforehand: You will see that the code does not actually make any outside calls. This is because of the way the solution is architected. I have a central HUD Control script, basically a crude message broker. That script takes care of all communications in and out of the HUD. You may also notice that my header definition for the link_message() event handler is slightly different from the standard. This is to indicate what I am actually using the various calling parameters for. So: link_message(integer sender_number, integer number, string message, key id) .. is changed to: link_message(integer sender_number, integer channel, string action, key param) I use the channel variable to filter internal messages to specific 'channels' of communication I use the action variable to identify what action is being or has been called, i.e. what public function of the code module and lastly in the param variable I pass the parameters needed. Thes are normally defined as value1|value2|... , where value can be a further separated value as value1.1^value1.2^... I have not included module level definitions of variables but my general convention is: ALL_CAPS - A module level constant not changed by code in general gVariable - a module level variable variable - a local variable, if it is more than one word I will capitalize the first letter of succeeding words function_name - all functions/subroutines are in lowercase with the words separated by an underscore You will also see in here references to Bootstrap. As I mentioned, the Building Prims will contain a control script that manages the various worker scripts and is the script that communicates with the HUD. There will be situations though where this script as well will need to be updated and so the Bootstrap. It needs to be pushed out first, will remove the local control script and then call back advising that it is ready, which added a bit more complication to the work. I have placed the relevant functions called, after the state code for ease of reading, normally these will appear at the very begining of the script after constant and variable definition. Finally to set the stage: At this point we have selected the scripts we are going to send (gSelScr) and called out to all the prims gathering their Keys (gPrimKeys) ... and we are off: state do_delivery{ state_entry() { //Advise begining delivery of scripts and that it could take some time llOwnerSay("Begining to deliver scripts to prims, this could take a few minutes"); //Start the process .. if only one we are outta here .. otherwise will get a call-back if (send_script_list()) { state running; } } link_message(integer sender_number, integer channel, string action, key param) { if (channel == CTRL_CHANNEL) { //Target List sent to a prim if (action == TARGET_LIST_RCVD) { llSetTimerEvent(0.0); //Load the scripts to the Prim load_scripts(gCurChild, gSelScr); //Next ones if the last then we are done if (send_script_list()) { state running; } } //A Bootstrap script was loaded to the prim else if (action == BOOTSTRAP_READY) { llSetTimerEvent(0.0); //If we are at the end just send it the scripts if (llGetListLength(gPrimKeys) == 0) { //Send the Scripts to Bootstrap load_scripts(gCurChild, gSelScr); //Done state running; } //Other wise we send the list and wait for return else { //Split & Send the list //wait for Confirmation split_send_list(gCurChild); } } } } timer() { //TO BE COMPLETED: How to handle timeouts } state_exit() { llOwnerSay("Scripts Delivered"); }}//Functions used in Script delivery to Building Primsinteger send_script_list(){ integer done = FALSE; integer length = llGetListLength(gPrimKeys); //Get the next Prim gCurChild = llList2String(gPrimKeys, 0); //If we are at the end just send if (length = 1) { //Clear the Prim list .. all done gPrimKeys = []; list sendList = gSelScr; //If in BootStrap we send the BootStrap Script if (gAction == BOOTSTRAP) { sendList = [bOOTSTRAP_CTRL]; } //Send the Scripts load_scripts(gCurChild, sendList); //If in BootStrap we wait for it to answer if (gAction == BOOTSTRAP) { llSetTimerEvent(10.0); } else { //Done done = TRUE; } } //Other wise we send the list and wait for return else { //Remove the child from the list gPrimKeys = llList2List(gPrimKeys, 1, length - 1); //Split & Send the list waiting for Confirmation split_send_list(gCurChild); } return done; }split_send_list(string target){ //Split the remaining list in half integer length = llGetListLength(gPrimKeys); integer half = llFloor(length/2); string passList = llDumpList2String(llList2List(gPrimKeys, half, length - 1), SEP); gPrimKeys = llList2List(gPrimKeys, 0, half - 1); //Send 1/2 the list to the prim llMessageLinked(LINK_ROOT, CTRL_CHANNEL, TARGET_LIST, target + KP_SEP + passList); //Will need acknowledgement prior to sending llSetTimerEvent(10.0);}load_scripts(string target, list scripts){ integer scriptNum = llGetListLength(scripts); integer x; for (x = 0; x <= scriptNum; x++) { string name = llList2String(scripts, x); llRemoteLoadScriptPin((key)target, name, LOAD_PIN, (name == BOOTSTRAP_CTRL), scriptNum); }}//End Functions
  19. Miranda, I see where you are going with this now. It is an interesting solution that I'd have to thing about how it could be structured in the current design architecture ... As I think about it, the solution does seem possible without breaking the design ... basically would need to follow: HUD sends 1/2 the list in a message to a specific Prim using llRegionSayTo HUD then Loads the Script to said Prim Prim then splits the list and sends 1/2 (1/4) to another Prim ... etc Could be an elegant solution and require less coding that having to deal with multiple delivery scripts etc ... Looks like it should be straight forward ... back to coding :-) Wanda
  20. Sorry Miranda .. I do not understand what you mean .. what does LN refer to?
  21. Qie, I did not think that a script set to not running was using available script memory ... does though make some sense if the state of the script when it was stopped is maintained. How though is that different from an object (prim) containing the scripts that is inside another object? As to the buffer issue .. I know, am wondering about that myself, and until I get the HUD past initial coding and can do a stress test on it (my next building project) I will not know.
  22. Very True! In any case I am liking more the idea of having a large number of Delivery scripts, not running, and have the HUD main start them up as needed to deliver a script ... could be workable, manage the script load, and fit with the design.
  23. LepreKhaun, What I have is (in simplified form): One HUD Script N Building Prims each with a controler script and N worker scripts. Only one worker script is active at any one time and these scripts may or may not have been written by me. The Scenario is that the HUD receives an updated, or new, worker script and needs to deliver this script to the Building Prims. The controller script is listening to the HUD. The basic flow is: HUD sends out a call saying 'I have a/some' script(s) to deliver The controllers in the Building Prims respond saying 'I'm here and my Key is ...' As the HUD receives the response from a Buildng Prim it sends the worker script (not running) As you can see the issue is the 3 sec delay caused by llRemoteLoadScriptPin. In a building project it would not be unheard of to have more than 100 building prims, and having it take 5 minutes to distribute one script is just not workable.
×
×
  • Create New...