Jump to content

Xiija

Resident
  • Content Count

    651
  • Joined

  • Last visited

Community Reputation

169 Excellent

2 Followers

About Xiija

  • Rank
    Lotus Eater

Recent Profile Visitors

907 profile views
  1. Mebbe like a vendor system, once you click a generator, it is "in use" and no one else can click it till it is done, and once a person has clicked one, it sends a msg to all other generators that this person is already using another generator in the system?
  2. for a temp fix, you could hack the end of the borken JSOn ? key XMLRequest; default { state_entry() { } touch_start(integer total_number) { llOwnerSay("Sending HTTP Request, ..."); string tail = "Malachi 3:2"; // "joshua1:9"; // Malachi 3:2 tail = llEscapeURL(tail); string URL = "http://bible-api.com/"; XMLRequest = llHTTPRequest( URL + tail , [HTTP_USER_AGENT, "XML-Getter/1.0 (Mozilla Compatible)", HTTP_METHOD, "GET", HTTP_MIMETYPE, "application/json;charset=utf-8", // "text/plain;charset= CP-1252", ISO-8859-1, utf-8 HTTP_BODY_MAXLENGTH,16384, HTTP_PRAGMA_NO_CACHE,TRUE], ""); } http_response(key k,integer status, list meta, string body) { if(k == XMLRequest) { if(status != 200) { llOwnerSay("\nRrror code : " + (string)status); return; } else { body = llDeleteSubString(body, -5, -1); // ***hack off end, ** body = body + "\":'non'}"; // ***and add json ending tag*** llOwnerSay("\nVerse: \n" + llJsonGetValue( body, ["text"]) ); } } } }
  3. I did a fake json file to test functionality.. works ok, so it's all on the API dood key XMLRequest; default { state_entry() { } touch_start(integer total_number) { llOwnerSay("Sending HTTP Request, ..."); string URL2 = "https://my-json-server.typicode.com/Xiija/FakeDB/db"; XMLRequest = llHTTPRequest( URL2 , [HTTP_USER_AGENT, "XML-Getter/1.0 (Mozilla Compatible)", HTTP_METHOD, "GET", HTTP_MIMETYPE, "application/json;charset=utf-8", HTTP_BODY_MAXLENGTH,16384, HTTP_PRAGMA_NO_CACHE,TRUE], ""); } http_response(key k,integer status, list meta, string body) { if(k == XMLRequest) { if(status != 200) { llOwnerSay("\nRrror code : " + (string)status); return; } else { llOwnerSay("returnedJSON: \n" + llJsonGetValue( body, ["comments","0","body"]) ); } } } } the return was... [07:12] http get api thing 2: Sending HTTP Request, ... [07:13] http get api thing 2: returnedJSON: My body is ONE! from my JSON file ... https://github.com/Xiija/FakeDB/blob/master/db.json
  4. I'm not sure what you mean by truncated?.. i put my script in a box, and it gives me the full verse? the params in the request are just basic ones i use for generic requests. I'll test the json thing and see how that goes heh ETA: tested, i see why the JSON is not working, and the truncation now... the end of the json should be.... "translation_note": "Public Domain"} but all that is getting thru is ...... "translation_not ...( making the JSON invalid) mebbe the timeout or content length on the API side? the Joshua one is 578 bytes, ...and the content length set at the api is is 509 ::shrugs::
  5. mebbe parse the body? It seems to be using either ISO-8859-1 or CP-1252 charset from the API ? no idea how to fix that except to use a string replace func? (this is a prim- touch to GET, change for your needs ) string strReplace(string str, string search, string replace) { return llDumpList2String(llParseStringKeepNulls((str = "") + str, [search], []), replace); } key XMLRequest; default { state_entry() { } touch_start(integer total_number) { llOwnerSay("Sending HTTP Request, ..."); string tail = "joshua1:9"; // "joshua1:9"; // Malachi 3:2 tail = llEscapeURL(tail); string URL = "http://bible-api.com/"; XMLRequest = llHTTPRequest( URL + tail , [HTTP_USER_AGENT, "XML-Getter/1.0 (Mozilla Compatible)", HTTP_METHOD, "GET", HTTP_MIMETYPE, "application/json;charset=utf-8", // "text/plain;charset= CP-1252", ISO-8859-1, utf-8 HTTP_BODY_MAXLENGTH,16384, HTTP_PRAGMA_NO_CACHE,TRUE], ""); } http_response(key k,integer status, list meta, string body) { if(k == XMLRequest) { if(status != 200) { llOwnerSay("\nRrror code : " + (string)status); return; } else { string txt = llGetSubString(body, llSubStringIndex(body, "\"text\":" )+ llStringLength( "\"text\":"), llSubStringIndex(body, "}]," )-5); // replace non utf-8 characters... â , â , â, â txt = strReplace(txt, "â", "'"); txt = strReplace(txt, "â", " "); txt = strReplace(txt, "â", " "); llOwnerSay("Verse: \n" + txt); } } } }
  6. Are you set on using path finding?.. or have you tried a sensor repeat with MoveToTarget?
  7. for the RGB stuff, mebbe this will help? http://wiki.secondlife.com/wiki/Category:LSL_Color
  8. non binary toggle... integer x; integer num = 9; default { state_entry() { } touch_start(integer total_number) { if( x=x^num ) llOwnerSay("On: " + (string)x); // says ON: 9 else llOwnerSay("Off: " + (string)x); // says Off: 0 } }
  9. It's been so long since i used this, i can't remember if i made it or not lol... Non Sensor Range Checker: integer range(vector vec1, vector vec2, float rng) { if( vec1.x >= (vec2.x - rng) && vec1.x <= (vec2.x + rng) && vec1.y >= (vec2.y - rng) && vec1.y <= (vec2.y + rng) ) return TRUE; else return FALSE; } vector target = <175.0, 32.0, 3023.70508>; integer area = 5; default { state_entry() { llSetTimerEvent(5.0); } touch_start(integer total_number) { } timer() { vector pos = llGetPos(); if( range( pos, target, area) ) { llOwnerSay("In Range"); } else { llOwnerSay("Not In Range"); } } }
  10. @viggy , you would need to save the store status somewhere if your website is static. Repl.It has some ability to do a server, not sure if that is what is needed tho heh... an example: ( a chat server ) the Repl- https://repl.it/@Xiija/chat02 and the site- https://chat02--xiija.repl.co
  11. On your website, in your JS, you could do... var queryString = decodeURI( window.location.search ); console.log("queryString is : " + queryString); then use the variable to change your webpage info. ... so you would send an http GET request to your website with a search param... i.e. for your SecondLife get req url.... http://www.mywebsite.com?cafe-open and in the above example, the queryString variable would end up being .... ?cafe-open ( here is a Codepen with an example .... ) https://codepen.io/XMODS/full/KYmxYz?cafe-open ( click "change view > editor view " .. to see the code ) for persistent storage of a variable, you would need a server, or google sheet, mebbe php ?
  12. something like this in your changed event?... (untested) if (sittingAvatar == NULL_KEY) { llStopSound(); return; } string sound = llList2String( soundnames, llFloor(llFrand( sounds )) ); llPlaySound(sound, volume);
  13. Something like... (untested) integer count; list songs = [uuid#1, uuid#2, etc etc]; default { touch_start(integer total_number) { llLoopSound( llList2Key(sounds,count), 0.5 ); ++count; count %= llGetListLength(sounds); } }
  14. so, a kinda hacky trick... when you send your data to the form, use a "marker" your marker could be anything.. like .... ~start~ or .... ~end~ in this example, i used something easy to find.... @!@ ..... was my marker. so if the data you send is ...." HTTPtest 2-16-2019" ... just add your marker to that to get... @!@HTTPtest 2-16-2019 on the sheet, my cell ... ( c6) ...looked like this .... @!@HTTPtest 2-16-2019 string sheetID = "1MNKwhVqK8U8urzTWa_q0YtlGnYVn7SnICZBylstR2KE"; string sheetURL = "https://docs.google.com/spreadsheets/d/1MNKwhVqK8U8urzTWa_q0YtlGnYVn7SnICZBylstR2KE/pubhtml?gid=653993593&single=true&gid=0&output=txt&range=C6"; key selfCheckRequestId; default { state_entry() { } touch_start(integer total_number) { selfCheckRequestId = llHTTPRequest( sheetURL, [HTTP_METHOD, "GET", HTTP_VERBOSE_THROTTLE, FALSE, HTTP_BODY_MAXLENGTH, 16384], ""); } http_response(key id, integer status, list metaData, string body) { if (id == selfCheckRequestId) { string marker = "@!@"; integer start = llSubStringIndex(body,marker); integer end = llSubStringIndex(body, "</td>"); string fetch = llGetSubString(body,start + llStringLength(marker), end-1); llOwnerSay("\n response: \n" + fetch); } } } the inworld response from putting this code in a box and touching it was... the value of cell c6 (with the marker bit removed) as i said , this is hacky ... it may break depending on where "</td>" appears on the sheet... you ~could~ add an ending marker to your sent data ... mebbe it would look like ... @!@HTTPtest 2-16-2019 @!!@ to make is more safe to parse? the NEW google stuff has an API ( you have to get a key) ... https://developers.google.com/sheets/api/
×
×
  • Create New...