![Page 1: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/1.jpg)
A.I. in Second Life
Akihiro Eguchi
![Page 2: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/2.jpg)
Why Second Life?Real world like environment
where we can visually show the demo of our work
E.g.◦Workflow◦Ontology◦Smart Object◦Autonomous Avatar Navigation◦Avatar Capable of Logical Reasonings◦Chatbots …
![Page 3: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/3.jpg)
Retail Workflow
http://www.youtube.com/watch?v=_KY5LwFy-4s
![Page 4: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/4.jpg)
Smart Objects
http://www.youtube.com/watch?v=Je3As2Vp6gU
Akihiro Eguchi, Craig W. Thompson, "Towards a Semantic World: Smart Objects in a Virtual World," International Journal of Computer Information Systems and Industrial Management, Volume 3, 2011. pp. 905-911.[pdf]
![Page 5: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/5.jpg)
Autonomous Avatar Navigation
http://www.youtube.com/watch?v=kO8FQt7yXcs
Hung Nguyen, Akihiro Eguchi, Daniel Hooten, "In Search of a Cost Effective Way to Develop Autonomous Floor Mapping Robots,"9th IEEE International Symposium on Robotic and Sensors Environments (ROSE 2011), 2011, Montreal, Canada.
![Page 6: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/6.jpg)
Other Related WorksRPI Demo of Eddie, The Four-Year-Old Av
atarChatting with an AI in Second Life Automated Avatars in Second LifeAI patient in second life using scripted pri
m and challenge responseJoshua Eno, Craig Thompson, "Virtual (and
Real) World Ontology Services," IEEE Internet Computing, 16 May. 2011. IEEE computer Society Digital Library. IEEE Computer Society.
and etc..
![Page 7: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/7.jpg)
How to program in SLTutorial of Linden Scripting Language
![Page 8: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/8.jpg)
Create an account
1. Visit https://join.secondlife.com to create your account
2. Send me the account so that I can register you to U of A. island
3. Download and Install the Viewer4. Search U of A. island and
teleport
![Page 9: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/9.jpg)
Learn how to controlWalk
Run
Fly
Control View + drag mouse
![Page 10: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/10.jpg)
Creating ObjectsRight click any place in the island
to EditChoose Create button
Pick one shape and click any location where you want to place the prim at.
![Page 11: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/11.jpg)
Editing ObjectIf you click the object,
you can change the xyz coordinate
Rotate the object with keep pressing Ctrl
Change the size of the object with keep pressing Ctrl + Shift
![Page 12: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/12.jpg)
Link Objects togetherShift + click objects you
want to link togetherThen, Ctrl + L to linkIf you want to edit only a
part of linked object, click Edit linked.
![Page 13: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/13.jpg)
STATES
A "State" in LSL is a section that is running, and waiting for events.
Only one state can be active at a time per script.Every script must have a default state.Except for the default state, each state is defined by the word STATE followed by the name of the state.
![Page 14: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/14.jpg)
EVENTS
Events are inside of states. When that state is active, those events wait to be triggered and run the code inside them.
"state_entry": triggered by the state being entered
"touch_start": triggered when anyone touches an object.
![Page 15: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/15.jpg)
FUNCTIONSFunctions lay inside of events.Built in functions:
◦all start with two lowercase L's. E.g., llSay(0, "Hello")
◦llSay takes arguments of a number and a string.
User define functions:◦You can define own function before
default◦E.g.:
sayOutloud(string message) {
llSay(0, message);}
![Page 16: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/16.jpg)
Scripting! Right Click Object -> edit -> Content ->
New Script -> Open New Script
This script will basically say "Hello, Avatar!" on the public channel which is 0, and will then say "Touched." on the public channel when a user touches or clicks it.
![Page 17: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/17.jpg)
Output in a chat box10m range:
◦ llWhisper(Channel, "WHISPER STUFF");20m range
◦ llSay(Channel, "SAY STUFF ");100m range
◦ llShout(Channel, "SHOUT STUFF"); Anywhere on the region
◦ llRegionSay(Channel, "REGION SAY STUFF"); Use Channel 0 to talk, others (-
2147483648 ~ 2147483647) for obj-to-obj communication
![Page 18: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/18.jpg)
LSL variables examplesinteger count = 2; //A whole number
float measure = 1.2; //A number with decimal places
string chars = "Lee"; //Any text within " "
list words = ["This", "Is", "A", "List"];
list entries = ["A list may contain many types of values such as", 2, 1.2, <0.4, 0.8, 1.6>];
vector vec_2 = <1,6,2>; //Generally used for position as xyz, but can be used to store 3 numbers to be parsed out later
rotation _rot = <1,2,3,4>; //Can also be used to store 4 numbers to be parsed out later
![Page 19: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/19.jpg)
On/Off Example Using States
default
{
state_entry()
{
llSay(0, "turning on!");
llSetColor(<1.0, 1.0, 1.0>, ALL_SIDES); }
touch_start(integer total_number)
{
state off; // sets the script to a new "state" and starts running "state off"
}
}
state off
{
state_entry()
{
llSay(0, "turning off!");
llSetColor(<0.0, 0.0, 0.0>, ALL_SIDES);
}
touch_start(integer total_number)
{
state default;
}
}
If you click, it changes the state and changes the color
![Page 20: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/20.jpg)
Use If /else.default{
state_entry(){
llSay(0, "Hello, Avatar!");
}
touch_start(integer total_number){
if (llDetectedKey(0) == llGetOwner()){
llSay(0, "Owner Touched.");
}
else{
llSay(0, "Someone Else Touched.");
}
}
}
If the Owner touch, it says “Owner Touched.”Else it says “Someone Else Touched”
![Page 21: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/21.jpg)
Obj-to-Obj communication Sender
default
{
state_entry()
{
}
touch_start(integer total_number)
{
llWhisper(5, "SayOne");
}
}
Receiver
default
{
state_entry()
{
llListen(5,"","","");
}
listen(integer channel,string name, key id, string message)
{
if(message == "SayOne")
{
llSay(0, "One");
}
}
• Object 1 sends a command “SayOne” through the channel 5.
• Object 2 listens to the channel 5, and whenever it receives the message “SayOne”, It says “One”.
![Page 22: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/22.jpg)
Use PHPkey requestid;
default
{
state_entry(){}
touch_start(integer total_number){
requestid = llHTTPRequest("http://.../a.php?ids=a", [HTTP_METHOD,"GET"],"");
}
http_response(key request_id, integer status, list metadata, string body){
if (request_id == requestid{
llOwnerSay(body);
}
}
}Send http request to a certain php file and receives the response
![Page 23: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/23.jpg)
If you wanna program in C#OpenMetaverse foundation
provides a C# library to directly connect to the SL
http://openmetaverse.org/
![Page 24: A.I. in Second Life Akihiro Eguchi. Why Second Life? Real world like environment where we can visually show the demo of our work E.g. ◦ Workflow ◦ Ontology](https://reader035.vdocument.in/reader035/viewer/2022062322/56649de55503460f94addfb6/html5/thumbnails/24.jpg)
Useful LinksList of the built-in functions:
◦http://lslwiki.net/lslwiki/wakka.php?wakka=functions
LSL tutorials◦http://wiki.secondlife.com/wiki/LSL_T
utorial