Difference between revisions of "Talk:Chatbot"

From Second Life Wiki
Jump to navigation Jump to search
(add wish for more idiomatic string parms/ results, add wish for list parms/ results)
m (close out the wishes now answered in Chatbot (i.e., llSetLocalRot llApplyImpulse llApplyRotationalImpulse))
Line 1: Line 1:
== Examples That We Could/ Should Soon Add ==
== Examples That We Could/ Should Soon Add ==


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


<pre>
<pre>
llSetAlpha
/7 llSetPos("+"(llGetPos(), <0, 0, 2>));
zero rotation
/7 "*"(ZERO_ROTATION, ZERO_ROTATION)
 
step toward owner
push linear
face the sun
push rotational
/7 llApplyRotationalImpulse(<3.0, 0.0, 0.0>, TRUE); // roll about the X axis
/7 llApplyRotationalImpulse(<0.0, 3.0, 0.0>, TRUE); // pitch about the Y axis
/7 llApplyRotationalImpulse(<0.0, 0.0, 3.0>, TRUE); // yaw about the Z axis
/7 llSetStatus(STATUS_PHYSICS, FALSE); llSetStatus(STATUS_PHYSICS, TRUE); // zero inertia
 
move away from owner, move toward owner
face the sun, turn away
 
name the sitting avatar
name the sitting avatar
</pre>
We could/ should soon add vector/ rotation arithmetic in prefix syntax (cf., the syntax of overloaded operators in C++):
<pre>
"*"(ZERO_ROTATION, ZERO_ROTATION)
</pre>
</pre>


== Bugs/ Wishes ==
== Bugs/ Wishes ==
* parms and results of type string
String parms and results work, but only arcanely, as yet. The resultOf function calls cbList2String to decode string type parms and call its inverse to encode string results. That technique works, but the naive maintainer of the code expects to call llList2String instead and not bother with the inverse. We could/ should refactor to meet those expectations: call cbList2String in callEach for each parameter pushed, before calling resultOf.


* parms and results of type list
* parms and results of type list


List parms and results don't work yet. We could/ should demo encoding list parms and results as slices of a global list, e.g., "[]" for the empty list else "[first,last]" for other lists
LSL doesn't do lists of lists, so as yet parameters of type list don't work (e.g., llSetPrimitiveParams is hard to call) and results of type list don't work yet (e.g., llParseString2List is hard to call).
We could/ should tweak the code to fix this. We could index each list found and then pass and return that index in place of the list.


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


I do think the SL GUI should let me toggle a switch to do this, i.e., to teach any prim of mine to listen to my LSL chat, for the sake of script folk like me who think by chatting. Meanwhile, I write code like this to let me chat commands to my prims anyhow. I wrote this sample just after walking thru the delightfully concise [[Help:Getting_started_with_LSL|Getting Started with LSL]] tutorial, which only taught me to call [[llSetColor]] and [[llSetText]].
I do think the SL GUI should let me toggle a switch to make my prim chattable, i.e., to teach any prim of mine to listen to my LSL chat, for the sake of script folk like me who think by chatting. Meanwhile, I write code like this to let me chat commands to my prims anyhow. I wrote this sample just after walking thru the delightfully concise [[Help:Getting_started_with_LSL|Getting Started with LSL]] tutorial, which only taught me to call [[llSetColor]] and [[llSetText]].


How I use the Chatbot is that I paste in commands from a menu I build elsewhere in a text editor. We could/ should demo how short a similar edit-compile-test can be, despite the SL GUI, if we write a script to execute one statement and print its parameters and result. For example, we could keep a script window open to llSetText to the last string saved there.
How I use the Chatbot is that I paste in commands from a menu I build elsewhere in a text editor. We could/ should demo how short a similar edit-compile-test can be, despite the SL GUI, if we write a script to execute one statement and print its parameters and result. For example, we could keep a script window open to llSetText to the last string saved there.
<pre>
default
{
    state_entry()
    {
        llSetText("look at me blue", <0.0, 0.0, 1.0>, 1.0);
    }
}
</pre>

Revision as of 21:14, 5 September 2007

Examples That We Could/ Should Soon Add

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

/7 llSetPos("+"(llGetPos(), <0, 0, 2>));
/7 "*"(ZERO_ROTATION, ZERO_ROTATION)
step toward owner
face the sun
name the sitting avatar

Bugs/ Wishes

  • parms and results of type list

LSL doesn't do lists of lists, so as yet parameters of type list don't work (e.g., llSetPrimitiveParams is hard to call) and results of type list don't work yet (e.g., llParseString2List is hard to call). We could/ should tweak the code to fix this. We could index each list found and then pass and return that index in place of the list.

Chatbot vs. the SL GUI

I do think the SL GUI should let me toggle a switch to make my prim chattable, i.e., to teach any prim of mine to listen to my LSL chat, for the sake of script folk like me who think by chatting. Meanwhile, I write code like this to let me chat commands to my prims anyhow. I wrote this sample just after walking thru the delightfully concise Getting Started with LSL tutorial, which only taught me to call llSetColor and llSetText.

How I use the Chatbot is that I paste in commands from a menu I build elsewhere in a text editor. We could/ should demo how short a similar edit-compile-test can be, despite the SL GUI, if we write a script to execute one statement and print its parameters and result. For example, we could keep a script window open to llSetText to the last string saved there.

default
{
    state_entry()
    {
        llSetText("look at me blue", <0.0, 0.0, 1.0>, 1.0);
    }
}