Difference between revisions of "Talk:Chatbot"

From Second Life Wiki
Jump to navigation Jump to search
m (Strike obsolete text, e.g., the answered wish for parameters and results of the list type)
(list like a dozen visually powerful LSL statements to copy one at a time into the empty OK script (as yet another form of tutorial))
Line 1: Line 1:
== Example One-liner's That We Could/ Should Soon Add ==
We could/ should soon add yet a few more concise demoes, such as:
* name the sitting avatar
* move to owner and stop moving
* rotate to face the sun and stop rotating
* show World > Force Sun > Region Default on the face of a cube
== Chatbot vs. the SL GUI ==
== Chatbot vs. the SL GUI ==


Line 12: Line 24:
     {
     {
         llSetText("look at me blue", <0.0, 0.0, 1.0>, 1.0);
         llSetText("look at me blue", <0.0, 0.0, 1.0>, 1.0);
        llOwnerSay("OK");
     }
     }
}
}
</pre>
</pre>


== Example One-liner's That We Could/ Should Soon Add ==
Into that script you can paste, and save to run, one at a time, commands to run exactly the same demo as the Chatbox script, with very nearly the same syntax:


We could/ should soon add yet a few more concise demoes, such as:
* Twiddle the red, green, and blue intensity, also the "alpha" opacity/ transparency:
<pre>
        llSetColor(<0.3, 0.3, 0.3>, ALL_SIDES); // darken
        llSetColor(<1, 1, 1>, ALL_SIDES); // lighten
        llSetAlpha(0.7, ALL_SIDES); // make translucent
</pre>


* name the sitting avatar
* Twiddle the label of the object running the script:
<pre>
        llSetText("look at me green", <0.0, 1.0, 0.0>, 1.0); // label
        llSetText("look at me black", <0.0, 0.0, 0.0>, 1.0); // label differently
        llSetText("", <0.0, 0.0, 0.0>, 1.0); // do not label
</pre>


* move to owner and stop moving
* Move and rotate while not physical, then kick and spin while physical and bouncy.
<pre>
        llSetStatus(STATUS_PHYSICS, FALSE); llSleep(0.1);
        llSetPos(llGetPos() + <0.0, 0.0, 2.1>); // teleport up the Z axis
        llSetPos(llGetPos() - <0.0, 0.0, 2.1>); // teleport back down the Z axis
        llSetLocalRot(llEuler2Rot(<0.0, 0.0, PI_BY_TWO>)); // face one way
        llSetLocalRot(llEuler2Rot(ZERO_VECTOR)); // face another way
        llSetStatus(STATUS_PHYSICS, TRUE); llSleep(0.1);
        llSetBuoyancy(0.9); // bounce well, without floating
        llApplyImpulse(<0.0, 0.0, 1.0>, TRUE); // advance along the Z axis
        llApplyRotationalImpulse(<0.0, 0.0, 3.0>, TRUE); // yaw about the Z axis
        llSetStatus(STATUS_PHYSICS, FALSE); llSetStatus(STATUS_PHYSICS, TRUE); // zero rot inertia
</pre>


* rotate to face the sun and stop rotating
* Poke around inside the object running the script:
<pre>
        llOwnerSay(llList2CSV([ZERO_VECTOR, FALSE, TRUE, STATUS_PHYSICS, PI])); // reveal some named code values
        llOwnerSay((string) llGetAgentSize(llGetLinkKey(llGetNumberOfPrims()))); // often not ZERO_VECTOR while avatar sits
</pre>


* show World > Force Sun > Region Default on the face of a cube
*
Chat a question for you the object's owner to answer (and then chat the answer that you chose):
<pre>
        llDialog(llGetOwner(), "A clarifying demo?", ["No", "Yes"], 7); // chat some Q & A
</pre>

Revision as of 18:22, 6 September 2007

Example One-liner's That We Could/ Should Soon Add

We could/ should soon add yet a few more concise demoes, such as:

  • name the sitting avatar
  • move to owner and stop moving
  • rotate to face the sun and stop rotating
  • show World > Force Sun > Region Default on the face of a cube

Chatbot vs. the SL GUI

The SL GUI does let you rapidly compile and run one command at a time.

To run one command once, you can edit and save a short script like:

// http://wiki.secondlife.com/wiki/Talk:Chatbot
default
{
    state_entry()
    {
        llSetText("look at me blue", <0.0, 0.0, 1.0>, 1.0);
        llOwnerSay("OK");
    }
}

Into that script you can paste, and save to run, one at a time, commands to run exactly the same demo as the Chatbox script, with very nearly the same syntax:

  • Twiddle the red, green, and blue intensity, also the "alpha" opacity/ transparency:
        llSetColor(<0.3, 0.3, 0.3>, ALL_SIDES); // darken
        llSetColor(<1, 1, 1>, ALL_SIDES); // lighten
        llSetAlpha(0.7, ALL_SIDES); // make translucent
  • Twiddle the label of the object running the script:
        llSetText("look at me green", <0.0, 1.0, 0.0>, 1.0); // label
        llSetText("look at me black", <0.0, 0.0, 0.0>, 1.0); // label differently
        llSetText("", <0.0, 0.0, 0.0>, 1.0); // do not label
  • Move and rotate while not physical, then kick and spin while physical and bouncy.
        llSetStatus(STATUS_PHYSICS, FALSE); llSleep(0.1);
        llSetPos(llGetPos() + <0.0, 0.0, 2.1>); // teleport up the Z axis
        llSetPos(llGetPos() - <0.0, 0.0, 2.1>); // teleport back down the Z axis
        llSetLocalRot(llEuler2Rot(<0.0, 0.0, PI_BY_TWO>)); // face one way
        llSetLocalRot(llEuler2Rot(ZERO_VECTOR)); // face another way
        llSetStatus(STATUS_PHYSICS, TRUE); llSleep(0.1);
        llSetBuoyancy(0.9); // bounce well, without floating
        llApplyImpulse(<0.0, 0.0, 1.0>, TRUE); // advance along the Z axis
        llApplyRotationalImpulse(<0.0, 0.0, 3.0>, TRUE); // yaw about the Z axis
        llSetStatus(STATUS_PHYSICS, FALSE); llSetStatus(STATUS_PHYSICS, TRUE); // zero rot inertia
  • Poke around inside the object running the script:
        llOwnerSay(llList2CSV([ZERO_VECTOR, FALSE, TRUE, STATUS_PHYSICS, PI])); // reveal some named code values
        llOwnerSay((string) llGetAgentSize(llGetLinkKey(llGetNumberOfPrims()))); // often not ZERO_VECTOR while avatar sits

Chat a question for you the object's owner to answer (and then chat the answer that you chose):

        llDialog(llGetOwner(), "A clarifying demo?", ["No", "Yes"], 7); // chat some Q & A