Difference between revisions of "Talk:Chatbot"

From Second Life Wiki
Jump to navigation Jump to search
(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))
m (→‎News: - LSL_Protocol/ListMessage has code now - likely the seed of what will replace the first draft of the Chatbot)
 
(59 intermediate revisions by 4 users not shown)
Line 1: Line 1:
== Example One-liner's That We Could/ Should Soon Add ==
== Call for Volunteers ==


We could/ should soon add yet a few more concise demoes, such as:
You can help by adding bugs, fixing bugs, and adding comments here to tell us why and how you are or are not working with your own Chatbot.


* name the sitting avatar
You can help by running the Chatbot in Linux, even if you have been running only Mac OS X or Windows on your computer.


* move to owner and stop moving
See: http://wiki.secondlife.com/wiki/LSL_Write_Once_Debug_Everywhere#Running_Linux


* rotate to face the sun and stop rotating
== News ==


* show World > Force Sun > Region Default on the face of a cube
The [[LSL_Protocol/ListMessage]] article now has a little code in an example - likely the seed of what will replace the first draft of the Chatbot.


== Chatbot vs. the SL GUI ==
== Wishes ==


The SL GUI does let you rapidly compile and run one command at a time.
We could/ should soon add ...


To run one command once, you can edit and save a short script like:
* rewrite to use the [[LSL_Protocol/ListMessage]] to divide the work of interpreting LSL among indefinitely many scripts via [[llMessageLinked]] and [[link_message]]


<pre>
We could/ should soon add ...
// http://wiki.secondlife.com/wiki/Talk:Chatbot
 
default
* say if [[llGetSunDirection]] changes or not when World > Force Sun > Region Default shows sunrise, noon, sunset, midnight, or what -- likely it doesn't, the object doesn't know what its owning or creating avatar sees
{
 
    state_entry()
We could/ should soon add ...
    {
 
        llSetText("look at me blue", <0.0, 0.0, 1.0>, 1.0);
* move to owner and stop moving.
        llOwnerSay("OK");
 
    }
* parsing of prefix monadic + - arithmetic operators, for scalar and vectors and rotations
}
 
</pre>
* parsing of infix dyadic + - * / % arithmetic operators with precedence, on pairs of values of the same type, on vector/ rotation pairs, on rotation/ vector pairs
 
* forever periodically resynch or somehow merge the [[Chatbot]] and [[Hello Avatar]] examples
 
== Bugs ==
 
This Chatbot script works reasonably well for some of us ... how about you? If not, why not?
 
=== Bug: Channel number omitted, comma included, in echo of list value ===


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:
STEPS TO REPRODUCE:
<pre>/7 [a, b, c] // a list value</pre>


* Twiddle the red, green, and blue intensity, also the "alpha" opacity/ transparency:
EXPECTED RESULTS:
<pre>
<pre>/7 [a, b, c] // a list value
        llSetColor(<0.3, 0.3, 0.3>, ALL_SIDES); // darken
[a, b, c]
        llSetColor(<1, 1, 1>, ALL_SIDES); // lighten
        llSetAlpha(0.7, ALL_SIDES); // make translucent
</pre>
</pre>


* Twiddle the label of the object running the script:
ACTUAL RESULTS:
<pre>
<pre>// [a, b, c] // a list value
        llSetText("look at me green", <0.0, 1.0, 0.0>, 1.0); // label
, [a, b, c]
        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>
</pre>


* Move and rotate while not physical, then kick and spin while physical and bouncy.
See? The channel number 7 is missing from the echo, broken by design.
<pre>
 
        llSetStatus(STATUS_PHYSICS, FALSE); llSleep(0.1);
See? A spurious string ", " of comma and blank appears before the expected result, who knows why.
        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
Another example that produces the spurious ", " is:
        llSetLocalRot(llEuler2Rot(<0.0, 0.0, PI_BY_TWO>)); // face one way
<pre>/7 [llGetFreeMemory(), llGetFreeMemory(), llGetFreeMemory()]</pre>
        llSetLocalRot(llEuler2Rot(ZERO_VECTOR)); // face another way
 
        llSetStatus(STATUS_PHYSICS, TRUE); llSleep(0.1);
Thus likely this bug is with output of type list, not with input of type list.
        llSetBuoyancy(0.9); // bounce well, without floating
 
        llApplyImpulse(<0.0, 0.0, 1.0>, TRUE); // advance along the Z axis
-- [[User:Ppaatt Lynagh|Ppaatt Lynagh]] 07:42, 14 September 2007 (PDT)
        llApplyRotationalImpulse(<0.0, 0.0, 3.0>, TRUE); // yaw about the Z axis
 
        llSetStatus(STATUS_PHYSICS, FALSE); llSetStatus(STATUS_PHYSICS, TRUE); // zero rot inertia
== Bugs That May Have Been Fixed ==
</pre>
 
=== Bug: (316, 48) : ERROR Syntax Error ===
 
The thousand lines of Chatbot script is script enough to confuse some compilers.
 
The [[LSL Write Once Debug Everywhere]] article explains how you can develop LSL scripts that run well and compile without error in many places.
 
The [[LSL Errors]] article explains the astonishing 2007-08 Windows compiler limit of about a dozen cascaded else-if's (astonishing when contrasted to the Mac limit of about five hundred).
 
The talk archive at http://wiki.secondlife.com/w/index.php?title=Talk:Chatbot&oldid=32867#Bug:_.28316.2C_48.29_:_ERROR_Syntax_Error
tells the story of how Col, Huney, Ppaatt and Tim reverse-engineered, documented, and worked around the limits on cascading else-if's.  
 
-- [[User:Ppaatt Lynagh|Ppaatt Lynagh]] 06:14, 26 September 2007 (PDT)
 
== Rethink ==
 
I have by now thought thru a new design for ducking our ill-defined not-quite-cross-platform-reproducible script resource limits by dividing the work out via llMessageLinked.
 
Sorry as yet I'm thinking in the deeply geeky slang of compiler folk. Out in that world, my thinking runs as follows.
 
http://members.aol.com/ppaatt/#%5B%5BReverse%20Polish%20LSL%5D%5D is my definition of Reverse Polish LSL. I figure we want to chat ordinary LSL onto a channel, then see (forward) Polish chatted on a channel. In translating from ordinary LSL, we'd chat the depth-first Polish first, i.e., the leftmost ( ... ) found, with just values as parameters. We'd then see the result chatted on a channel, which will let us form the next expression out.
 
I plan to head that way here as soon as I get some more time slices free to work this. That way will let us divide the else-if's arbitrarily into indefinitely many functions.
 
I figure we can define monadic == to mean evaluate a name.
 
I figure we can use simply-quoted URL-encoding to pass strings around.


* Poke around inside the object running the script:
I figure we want to distinguish no result, void result, non-list non-void result, possibly-empty list result. I figure we count the "no results" til we have enough, to know when no one listening can make sense of the Polish LSL that was chatted.
<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>


*
-- [[User:Ppaatt Lynagh|Ppaatt Lynagh]]
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>

Latest revision as of 21:13, 14 October 2007

Call for Volunteers

You can help by adding bugs, fixing bugs, and adding comments here to tell us why and how you are or are not working with your own Chatbot.

You can help by running the Chatbot in Linux, even if you have been running only Mac OS X or Windows on your computer.

See: http://wiki.secondlife.com/wiki/LSL_Write_Once_Debug_Everywhere#Running_Linux

News

The LSL_Protocol/ListMessage article now has a little code in an example - likely the seed of what will replace the first draft of the Chatbot.

Wishes

We could/ should soon add ...

We could/ should soon add ...

  • say if llGetSunDirection changes or not when World > Force Sun > Region Default shows sunrise, noon, sunset, midnight, or what -- likely it doesn't, the object doesn't know what its owning or creating avatar sees

We could/ should soon add ...

  • move to owner and stop moving.
  • parsing of prefix monadic + - arithmetic operators, for scalar and vectors and rotations
  • parsing of infix dyadic + - * / % arithmetic operators with precedence, on pairs of values of the same type, on vector/ rotation pairs, on rotation/ vector pairs

Bugs

This Chatbot script works reasonably well for some of us ... how about you? If not, why not?

Bug: Channel number omitted, comma included, in echo of list value

STEPS TO REPRODUCE:

/7 [a, b, c] // a list value

EXPECTED RESULTS:

/7 [a, b, c] // a list value
[a, b, c]

ACTUAL RESULTS:

// [a, b, c] // a list value
, [a, b, c]

See? The channel number 7 is missing from the echo, broken by design.

See? A spurious string ", " of comma and blank appears before the expected result, who knows why.

Another example that produces the spurious ", " is:

/7 [llGetFreeMemory(), llGetFreeMemory(), llGetFreeMemory()]

Thus likely this bug is with output of type list, not with input of type list.

-- Ppaatt Lynagh 07:42, 14 September 2007 (PDT)

Bugs That May Have Been Fixed

Bug: (316, 48) : ERROR Syntax Error

The thousand lines of Chatbot script is script enough to confuse some compilers.

The LSL Write Once Debug Everywhere article explains how you can develop LSL scripts that run well and compile without error in many places.

The LSL Errors article explains the astonishing 2007-08 Windows compiler limit of about a dozen cascaded else-if's (astonishing when contrasted to the Mac limit of about five hundred).

The talk archive at http://wiki.secondlife.com/w/index.php?title=Talk:Chatbot&oldid=32867#Bug:_.28316.2C_48.29_:_ERROR_Syntax_Error tells the story of how Col, Huney, Ppaatt and Tim reverse-engineered, documented, and worked around the limits on cascading else-if's.

-- Ppaatt Lynagh 06:14, 26 September 2007 (PDT)

Rethink

I have by now thought thru a new design for ducking our ill-defined not-quite-cross-platform-reproducible script resource limits by dividing the work out via llMessageLinked.

Sorry as yet I'm thinking in the deeply geeky slang of compiler folk. Out in that world, my thinking runs as follows.

http://members.aol.com/ppaatt/#%5B%5BReverse%20Polish%20LSL%5D%5D is my definition of Reverse Polish LSL. I figure we want to chat ordinary LSL onto a channel, then see (forward) Polish chatted on a channel. In translating from ordinary LSL, we'd chat the depth-first Polish first, i.e., the leftmost ( ... ) found, with just values as parameters. We'd then see the result chatted on a channel, which will let us form the next expression out.

I plan to head that way here as soon as I get some more time slices free to work this. That way will let us divide the else-if's arbitrarily into indefinitely many functions.

I figure we can define monadic == to mean evaluate a name.

I figure we can use simply-quoted URL-encoding to pass strings around.

I figure we want to distinguish no result, void result, non-list non-void result, possibly-empty list result. I figure we count the "no results" til we have enough, to know when no one listening can make sense of the Polish LSL that was chatted.

-- Ppaatt Lynagh