Jump to content

Xiija

Resident
  • Posts

    912
  • Joined

  • Last visited

Everything posted by Xiija

  1. @Toph Bailey Here is a JSON snippet for SL, in case you want to test a bit, just drop it in a box, click the box, then type.. /99 test ... in local chat . it shows a key with multiple values etc... addReminder( string name , string dateTime, string text ) { if (llJsonGetValue ( Reminders, [name] ) == JSON_INVALID) // if there is not a JSON key-value pair in the JSON object, add one { Reminders = llJsonSetValue ( Reminders, [name, "Date_Time"], dateTime); Reminders = llJsonSetValue ( Reminders, [name, "Reminder_Text"], text); } } string Reminders; string name; default { state_entry() { Reminders = llList2Json( JSON_OBJECT, [] ); llListen(99,"","",""); } touch_start(integer total_number) { llOwnerSay("Populating..."); name = llDetectedName(0); string dateTime = "2020-08-13 16:33 pm"; string text = "Shopping Event"; addReminder( name , dateTime, text ); } listen( integer vIntChn, string vStrNom, key vKeySpk, string vStrMsg ) { if( vIntChn == 99) { string info1 = llJsonGetValue ( Reminders, [name, "Date_Time"]) ; string info2 = llJsonGetValue ( Reminders, [name, "Reminder_Text"]) ; string info3 = llJsonGetValue ( Reminders, [name]) ; string info4 = llJsonGetValue ( Reminders, [] ) ; llOwnerSay( "Data:\n \nTime: " + info1 + "\nEvent: " + info2 + "\n" + name + " info:. " + info3 + "\nEntire DB: " + info4); } } }
  2. @Sabastian Zane No idea what is goin on with your code, but just from the example posted..... could you use something like,... llPlaySound( (string)unimin, 1.0); and just pull the values for the other bits the same?
  3. mebbe make a timer with an animation check in it... http://wiki.secondlife.com/wiki/LlGetAnimation then when yours changes, send the info to the animesh?
  4. i've seen some video games in sl, but they used flash or sumsuch?.. i wonder what will happen to some peoples code functionality when flash goes dark in a few weeks.. https://www.adobe.com/products/flashplayer/end-of-life.html
  5. Both good points, ty ( i also use a channel as the start param )
  6. Logic flow would be something like... 1. dispenser checks the sim for new arrivals with a timer. 2. dispenser uses the llRrezObject event, and passes the newly arrived Avatar's ID to the rezz'd item as a start parameter. 3. rezzed item gets the new avatar's id from it's on_rez event. 4. rezzed item asks for llRequestExperiencePermissions to the avatar, and uses attachToAvatarTemp... and on detach it dies?
  7. @Gayngel do you use POST to store the data with the apps scripts? i've only been able to get GET requests to work
  8. aha!.. yah 46k lol, ok tysm @Nova Convair & @Mollymews guess i'd need to parse bigguns outside of SL
  9. small update with code for the free database idea is here ...
  10. small update, was testing with the free database stuff, and have a basic version... feel free to play with it, or join Repl.It .. and fork this to make your own. Free SL Database Test the basic LSL scripts for testing are... // to add to a database... string myName; string myId; key my_reqKey; string addCustomer = "https://SecondLife-NEDB-01.xiija.repl.co/api/db/input"; default { state_entry() { myId = "f216c381-8e1d-46ba-8861-d4811f0bdbc5"; myName = "Skywalker Scofield"; //myId = llGetOwner(); //myName = llKey2Name( myId ); } touch_start(integer total_number) { string j_obj = llList2Json( JSON_OBJECT, [ "name", myName, "cust_id", myId ]); my_reqKey = llHTTPRequest( addCustomer , [ HTTP_USER_AGENT, "XML-Getter/1.0 (Mozilla Compatible)", HTTP_METHOD, "POST", HTTP_MIMETYPE, "application/json", HTTP_BODY_MAXLENGTH,16384, HTTP_PRAGMA_NO_CACHE,TRUE ], j_obj); llOwnerSay("sending..."); } http_response(key request_id, integer status, list metadata, string body) { if (request_id != my_reqKey ) return;// exit if unknown if(status != 200) {llSay(0,"Unable to get page" + "\nSTATUS: " + (string)status);return;} llOwnerSay("Body: \n" + body); } } to get the info from the database... string myName; string myId; key my_reqKey; string getCustomer = "https://SecondLife-NEDB-01.xiija.repl.co/api/db/output"; default { state_entry() { // myId = "f216c381-8e1d-46ba-8861-d4811f0bdbc5"; // myName = "Skywalker Scofield"; myId = llGetOwner(); myName = llKey2Name( myId ); } touch_start(integer total_number) { my_reqKey = llHTTPRequest( getCustomer , [ HTTP_USER_AGENT, "XML-Getter/1.0 (Mozilla Compatible)", HTTP_METHOD, "GET", HTTP_MIMETYPE, "application/json", HTTP_BODY_MAXLENGTH,16384, HTTP_PRAGMA_NO_CACHE,TRUE ],""); llOwnerSay("getting..."); } http_response(key request_id, integer status, list metadata, string body) { if (request_id != my_reqKey ) return;// exit if unknown if(status != 200) {llSay(0,"Unable to get page" + "\nSTATUS: " + (string)status);return;} list infoz = llJson2List( body ); integer len = llGetListLength( infoz ); integer x; for(; x < len;++x) { llOwnerSay( "\n Customer Name: " + llJsonGetValue( body, [x, "name" ] ) + "\n" ); // or llJsonGetValue( body, [x, "cust_id" ] ) } } } i was trying to get radio station info from a SomaFM json feed, here... https://api.somafm.com/channels.json but it seems LSL can't parse tabs or newlines? .. or at least, i couldn't figure out how to do that.. I was trying this on the SomaFM json file... http_response(key k,integer status, list meta, string body) { if(status != 200) {llSay(0,"Unable to get page" + "\nSTATUS: " + (string)status);return;} if(k == http_request_id) { llOwnerSay( "\n INFO IS: " + llJsonGetValue( body, [ "channels", 0, "title" ] ) + "\n" ); } } but it didn't work on the soma json tested with some psuedo-code and it worked fine... string body = "{\"mansBestFriend\":[ {\"dog\":\"fido\"}, {\"dog\":\"spot\"} ] }"; llSay(0, llJsonGetValue( body, ["mansBestFriend",1,"dog"]));//returns "spot" in localchat so it's either the tabs or newlines.. or both? Any ideas?
  11. yet another example using ... node-json-db .... https://repl.it/@Xiija/jsonDB-test-01 you could change the routes to use post, instead of get, and post a json object as the data
  12. @Fritigern Gothly if you are on repl.it & firebase... you can get your credentials json file from the firebase site Credentials for the repl ... and then make a node repl with something like this in it... ( in this example, i've stored the credentials in a file called ... serviceAccountKey.json const admin = require("firebase-admin"); const serviceAccount = require("./serviceAccountKey.json"); admin.initializeApp({ // credential: admin.credential.applicationDefault() credential: admin.credential.cert(serviceAccount) }) const db = admin.firestore(); const quoteData = { author: 'Bud Smalls', quote: 'Bong me again ??!' }; db.collection('sampleData').doc('Inspiration') .set(quoteData) .then(func =>{ read(); }) .catch(err =>{ console.log("err\n" + err); }); async function read(){ let snapshot = await db.collection('sampleData').get() .then(documents => { documents.forEach((doc) => { item = doc.data(); console.log( "Title: " + doc.id + "\nAuthor: " + item.author + "\nQuote: " + item.quote ); }); }) .catch(err =>{ console.log("err\n" + err); }); }; After that its a basic http call, mebbe to an express route?... to access the database.
  13. on_rez, if triggered might eat the attach event, so you won't get when the object is attached, just it's detach. mebbe try on_rez.. and in that event use... GetAttached
  14. @testgenord1 you can also do an assignment inside your if statement...kinda like... integer on; touch_start (integer num) { if( on = !on) // toggle the variable and check if it is true or not { llOwnerSay("ON"); } else { llOwnerSay("OFF"); } }
  15. just a quicky example, however you prolly don't need a NC unless you have large amounts of data? easier to use a list in the script. key query_id; integer count; string Curr; key kQuery; list people; default { state_entry() { Curr = llGetInventoryName(INVENTORY_NOTECARD,0); if( Curr != "" ) { kQuery = llGetNotecardLine(Curr, count); } } dataserver(key query_id, string data) { if (query_id == kQuery) { if (data == EOF) { count = 0; llOwnerSay("DONE"); llSay(0,"NC info : \n" + llDumpList2String( people,"\n")); } else { people += data; ++count; kQuery = llGetNotecardLine(Curr, count); } } } changed(integer change) { if (change & CHANGED_INVENTORY) { llOwnerSay("The inventory has changed."); llResetScript(); } } }
  16. You can't really check a certain notecard unless you check its number of lines, and each lines values, but this might be kinda close.... integer invCount; default { state_entry () { invCount = llGetInventoryNumber( INVENTORY_ALL ); // get new count on reset } changed (integer changes) { if (changes & CHANGED_INVENTORY) { if( llGetInventoryNumber( INVENTORY_ALL ) == invCount ) // if inv hasn't changed, its an update { llOwnerSay("NC update"); llResetScript(); } } } }
  17. just a basic example from what the others have said... list words = ["happy","sad","funky"]; // assumes all words are lower case default { state_entry() { llListen(0,"","",""); } listen( integer channel, string name, key id, string message ) { list msg_list = llParseString2List(message,[""],[" "]); integer x; for(; x < llGetListLength( msg_list); ++x) { string word = llToLower( llList2String( msg_list, x) ); if (~llListFindList( words,[word] ) ) { llOwnerSay("found: " + word); } } } }
  18. so, with Phate & Wulfies suggestions, your channel setup might be something like... llListenRemove( menu_handler ); llListenRemove( textbox_handler ); menu_channel = 0x80000000 | (integer)("0x"+(string)llGetKey() ) * -1; textbox_channel = menu_chan + 100; menu_handler = llListen(menu_channel,"","",""); textbox_handler = llListen(textbox_channel,"","","");
  19. kk ty Wulfie, i'll post the code i'm using incase anyone wants it.. for the url - https://community.secondlife.com/forums/forum/304-lsl-scripting/ i'm using the javascript - window.addEventListener("load", () => { // style thumb tacks let tacks = document.getElementsByClassName("ipsBadge"); var x; for (x = 0; x < tacks.length; ++x){ tacks[x].style.cssText = "background: lime !important;"; } // style stars let stars = document.getElementsByClassName("fa-star"); var z; for (z = 0; z < stars.length; ++z){ stars[z].style.cssText = "opacity: 1.0 !important; color: lime !important;"; } // style dark mode post area let posts = document.getElementsByClassName("prettyprinted"); var y; for (y = 0; y < posts.length; ++y){ posts[y].style.cssText = "background: #d7f1b3 !important;"; } }, false);
  20. semi non-lsl query , but related to these forums... does anyone use the dark theme here? i'm using it, and when i do, the posting area looks like this ... I'm using a custom style script to lighten the posts enuff to read ... https://mybrowseraddon.com/custom-style-script.html so now it looks like this ... Am i doing something wrong with the dark mode ?... or is everyone seeing the same thing.. a hard to read post area?
  21. mebbe change the open func something like... vector current_pos; open() { bMove = TRUE; vOffset *= -1; current_pos = llGetPos(); integer i; for (i = 0; i < iSteps; i++) { llSetPos( current_pos + i*vOffset); } bMove = FALSE; }
  22. another note: Repl.it is a free service, and has a db you can use, here is a link to a basic db example, which you could change to use http etc ... https://repl.it/@Xiija/Repl-DB-01-1#index.js
  23. not sure if this is what you want, but its simple to send from HUD to receiver? just mebbe associate textures with buttons in the touch event, i.e. if( llDetectedLinkNumber(0) == 2){ string msg = "5d4d5d90-f467-35d1-4850-3bf61a6401e0"; llRegionSay(cmdChannel, msg); } etc etc . Sender: integer cmdChannel ; default { state_entry() { cmdChannel = (integer)("0x"+(string)llGetOwner()); } touch_start(integer total_number) { string msg = "5d4d5d90-f467-35d1-4850-3bf61a6401e0"; llRegionSay(cmdChannel, msg); } } . Reciever: integer cmdChannel; default { state_entry() { cmdChannel = (integer)("0x"+(string)llGetOwner()); llListen( cmdChannel, "","",""); } listen(integer channel, string name, key id, string message) { llSetTexture( message,ALL_SIDES); } }
  24. there is also another google option, with firebase ... it has 2 db's to choose from, and seems to work well .. here is a vid if you are interested.. < click for Firebase Vid >
  25. @diggerroit would need to be in a an attachment most likely, or a rezzed prim with a timer that checks for your online data ?
×
×
  • Create New...