Jump to content

KT Kingsley

Resident
  • Content count

    126
  • Joined

  • Last visited

Community Reputation

95 Excellent

About KT Kingsley

  • Rank
    Advanced Member

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. KT Kingsley

    Display message only once in a timer for loop

    Opps! Sorry, I missed that bit.
  2. KT Kingsley

    Display message only once in a timer for loop

    If you have access to an experience, don't forget key-value pairs as a way of storing data.
  3. KT Kingsley

    Display message only once in a timer for loop

    I confuse myself in LSL almost every time I look at a script.
  4. KT Kingsley

    Json2Text

    Having just started messing around with the LSL Json functions, I thought I would be a good idea to write a function that'd chat out a JSON string neatly formatted: Json2Text (string json) { string TAB = " "; string output; string line; string tabs; integer quotes; integer new_line; integer index; integer length = llStringLength (json); do { string character = llGetSubString (json, index, index); if (character == "\\") { ++index; string next_character = llGetSubString (json, index, index); line += "\\" + next_character; } else if (character == "\"") { line += "\""; quotes = !quotes; } else if (character == "," && !quotes) { line += ",\n"; new_line = TRUE; } else if (character == "{" && !quotes) { line += "\n" + tabs + "{\n"; tabs += TAB; new_line = TRUE; } else if (character == "}" && !quotes) { tabs = llDeleteSubString (tabs, 0, llStringLength (TAB) - 1); line += "\n" + tabs + "}"; } else if (character == "]" && !quotes) { tabs = llDeleteSubString (tabs, 0, llStringLength (TAB) - 1); line += "\n" + tabs + "]"; } else if (character == "[" && !quotes) { line += "\n" + tabs + "[\n"; tabs += TAB; new_line = TRUE; } else line += character; if (new_line) { if (llStringLength (output + line) > 1000) { llOwnerSay ("Json2Text working..." + llStringTrim (output, STRING_TRIM_TAIL)); output = "\n" + line; } else output += line; line = tabs; new_line = FALSE; } } while (++index < length); if (output + line != "") llOwnerSay ("Json2Text working..." + output + line); llOwnerSay ("Json2Text finished."); } I have encountered one problem that I think may be to do with LSL's implementation: when I insert a backslash as a JSON value ("\\") it seems to mess up its own and some or all subsequent llJsonGetValue calls. See the commented-out lines in the test script below. default { state_entry () { integer count; string value = llList2Json ( JSON_OBJECT, [ "JSON test", llList2Json ( JSON_OBJECT, [ "item " + (string) (++count), PI, "item " + (string) (++count), TRUE, "item " + (string) (++count), FALSE, // "item " + (string) (++count), "\\", "item " + (string) (++count), "boring \\old text", "item " + (string) (++count), "\"", "item " + (string) (++count), "\n", "item " + (string) (++count), "\t", "item " + (string) (++count), llList2Json (JSON_ARRAY, [1, "two", PI]), "item " + (string) (++count), "\nleading newline", "item " + (string) (++count), "trailing newline\n", "item " + (string) (++count), "inline\nnewline", // "item " + (string) (++count), "\\", "item " + (string) (++count), "\boring ol\d t\ext", "item " + (string) (++count), "\tleading tab", "item " + (string) (++count), "trailing tab\n", "item " + (string) (++count), "inline\ttab", "item " + (string) (++count), "boring old text", "item " + (string) (++count), JSON_TRUE, "item " + (string) (++count), JSON_TRUE, "item " + (string) (++count), JSON_FALSE, "item " + (string) (++count), JSON_NULL ] ) ] ); llOwnerSay (value); Json2Text (value); // integer count0; // do llOwnerSay ("item " + (string) (++count0) + ": " + llJsonGetValue (value, ["JSON test", "item " + (string) (-~count0)])); // while (count0 < count); } } I shall, of course, welcome comments, criticisms and suggestions.
  5. KT Kingsley

    Non Physical Vehicle Script Tips

    It used to be that for large and complex boats the physical vehicle was pretty simple, while all the complex detail was actually an attachment worn by the skipper.
  6. KT Kingsley

    Display message only once in a timer for loop

    It does work as it should LSL. default { state_entry () { integer x; integer y; llOwnerSay ((string) (++x)); llOwnerSay ((string) (y++)); } } [11:47:06] Object: 1 [11:47:06] Object: 0
  7. In scripting I think it was whether one should use the constant PUBLIC_CHANNEL or just a plain 0 in the say functions.
  8. As this sounds like you'd've done a clean install of SL, it might be that the default logout settings have been reinstated. In Preferences/General, at the bottom is the Away timeout setting. In Firestorm there's the additional Log out after being marked away setting. In the SL viewer you'll have to set the debug setting QuitAfterSecondsOfAFK manually. ETA: Just looked in the SL viewer, and there doesn't seem to be a debug setting called QuitAfterSecondsOfAFK. There is one called QuitAfterSeconds, but that seems to work differently, maybe the time since login? So I suspect I've been talking rubbish here. Sorry.
  9. KT Kingsley

    Moving/zooming/focusing a camera to another avatar

    Using CAMERA_FOCUS_OFFSET, <0.0, 0.0, 0.5> (ish) will get your camera pointing at the target's boobs.
  10. KT Kingsley

    My 'Click' is ignored - Why?

    changed (integer changes) { if (changes & CHANGED_REGION_START) { llInstantMessage... } }
  11. KT Kingsley

    Deploy Plans for the week of 2018-08-06

    Ah, I now see from the SL status page that longer than normal downtimes were to be expected. I guess it's my fault for having just read this thread and the status page RSS and not the status page itself as well.
  12. KT Kingsley

    Deploy Plans for the week of 2018-08-06

    The long-offline region came back after nearly two and a half hours (I did put in a support ticket, but I don't suppose anyone saw it until later) and I've not had any more restarts in either region.
  13. KT Kingsley

    Deploy Plans for the week of 2018-08-06

    I just had that too. Sometimes it's because something horrible that hadn't been spotted in beta shows up, and they decide to roll back to the previous version. This time, though, the server version showing is the one that's been posted above. Meanwhile, another region I use has been offline for over an hour. ETA: Well this is unusual: a third restart, and this one only took a couple of minutes. Same new server version. The other region remains offline after nearly two hours.
  14. KT Kingsley

    My 'Click' is ignored - Why?

    When this has happened to me it's usually been because there's been an invisible something between me and the object I'm trying to click. You can try right-clicking on the object and then selecting "Touch" from the context menu. If "Touch" is greyed out then it's not just you. Also, you could highlight transparent objects with Ctrl+Alt+T to see if there is actually something invisible in the way.
  15. Well, seeing as how it can be done this might make a nice little exercise in scripting for me. Watch out for KTKoins!
×