1. 程式人生 > >這是我在學習 second life 遊戲時的學習與感受 希望對初學者有所幫助。

這是我在學習 second life 遊戲時的學習與感受 希望對初學者有所幫助。

1

Today, in the Multimedia design class, I knew Second Life is a Game where you can design anything which you like. For example, if you liked flight, you could design it in the game and make it fly.

In this week, I registered a user name and look around some place, like a coffee room. And find where I can change some styles for my avatar.

2

Last week, I have learned how to fly in the second life, and how to create a simple object. For example, create a box or a sphere, fly to anywhere. At first, I only use the fly button, but later, I knew using “F” button is easy to control flying.

This week, I will try to create steps in our group land.

3

Yesterday, I create some steps. This is a small subject, but when I tried, I found it is little difficulty. There are two challenges in the creating. First, after creating object, how can I see other sides of the object, and how can I change the camera. Second, steps are looked the same, how can I create one step and copy others.

Today, I saw some tutorials in “Youtube” web-site. That is a very useful web-site for learning. So I found using “alt” button and mouse can help us change the camera view, using “shift” button and dragging the object is easy to copy the object.

Pictures:

4

Last week, I have done some simple steps. This week, I want do some complex object. I wanted create a gift-box. So I try my best to create some box object and change the size and colour of them. At the end, I need some flowers on it, and I do not know how to create. Because of this, I went to the “Youtube” web-site and learned how to create flowers. That is not difficult; you just need make the object with twist.

Pictures:

5

Yesterday, I went around in the second life. I found other players make complex object which is using many simple objects stuck together. For example, there is a car which is linked by some spheres, boards and little things. So I tried to find how I can link the objects together. At last, I found if you want link some things together. First you need choose the object using”shift +the object”. Second you can choose Edit>Edit Linked Parts. Then you will find the chosen objects linked together. You can also using” ctrl + l” make objects together, and using” shift + ctrl +l” make object unlink.

6

Last week, I knew how to link objects together. So this week, I want make a gloriette which is including a top part, a pillar and some chair.

7

Today, I have learned how to create a simple script for objects. In this simple script, I found it like java except some personal language in it.

First, the structure is different. In second life script, you need at least one state called default state in the script. Furthermore, a script can also contain two or more different states, and react differently to events or inputs depending on what state it is in.

Second, lsl has many special functions which could help player create standard script. For example, llSay(integer channel, string message) function in touch_start() method can make object saying when avatar touch it.

8

In the second life, I saw there are many starts in the sky when the moon rising. That is interesting, and I want to know how it is working. So I went to “google” web-site and found some functions and codes. For example, llGetSunDirection() is used to catch where is the sun, llSetPrimitiveParams() is used to set some++++++, and llSetTimerEvent() is used for ++++++++

Here is a script which is I made and try to use these three functions.

float height;// this is the height of sun.

default

{

state_entry()

{

llSetTimerEvent(300.0); // this is the rate of flashing of start.

}

timer()

{

height=llGetSunDirection().z;// getting the height of sun.

if(height<0.0)

{

llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,TRUE]); // make the object lighting.

}

else

{

llSetPrimitiveParams([PRIM_FULLBRIGHT,ALL_SIDES,FALSE]);

}

}

}

9

In the second life, I found there is a shadow around some buildings that gives us a real feeling. So, I search how I can make a shadow of the object.

Finally, I found tinting is a great way to add depth without the performance penalties of using textures. For example,

This is a simple way to make shadow of objects, but that is not a real shadow. So found another way to make objects to cast a shadow on the ground and on surrounding objects.

10

Today, I learned timer function which is used to control the speed of loop. If we use timer function, first done thing is create llSetTimerEvent() which can set how long is the loop. So at the end, I try to write the following code.

vector start;

float end=10.0;

float speed= 0.5;

default

{

state_entry()

{

start=llGetPos();

}

touch_start(integer total_number)

{

llSetTimerEvent(1.0)

}

timer()

{

vector newpos;

newpos=llGetPos()+<0.0,0.0,speed>;

llSetPos(newpos);

}

}

11

This week, I want to learn how to make a tutorial. From the example tutorial, I know there are two steps for tutorial. First, I need record videos. Second, I need make useful videos together.

So, I chose “Camtasia Studio” programme which is used to record videos, and “Ulead VideoStudio” programme which is used to videos together.

This is “Camtasia Studio”.

This is the record model.

This is “Ulead VideoStudio”.

Here we can edit our videos.

12

Today, I have learned an example for list:

default

{

state_entry()

{

list items=["orange","apple"];

string fruit;

fruit=llList2String(items,0);

llOwnerSay(fruit);

fruit=llList2String(items,1);

llOwnerSay(fruit);

}

}

The result:

orange

apple

So I try to use this list to change the colour of the object. When I touch it, the colour should be changed.

list color=[<0.0,0.0,0.0>,<1.0,0.0,0.0 >,<0.0,1.0,1.0>,<1.0,1.0,1.0> ];

integer i=0;

default

{

state_entry()

{

llSay(0,"Hello, Avatar!");

}

touch_start(integer total_number)

{

if(i<=3)

{

vector c;

c=llList2Vector(color,i);

llSetColor(c,ALL_SIDES);

i=i+1;

}

else

{

llResetScript();

}

}

}

13

Yesterday, I found a place where I can input words the object will move. That is very interesting. So I went to “wiki” web, and wanted to find how that is done. But as you know, I do not know which code controls the object to hear avatar’s voice. I tried to find llsay() page. Then in the end of this page, I found there is a llListen function, read the page and confirm that is what I need.

Here is a code which I use llListen function to make it.

list color=["white","blue","red","black"];

integer i=0;

default

{

state_entry()

{

llSay(0,"Hello, Avatar!");

llListen(0,"",llGetOwner(),"");

}

listen(integerchannel,stringname,keyid,stringmessage)

{

if(message==llList2String(color,0))

{

vector c;

c=llList2Vector(color,0);

llSetColor(c,ALL_SIDES);

}

if(message==llList2String(color,1))

{

vector c;

c=llList2Vector(color,1);

llSetColor(c,ALL_SIDES);

}

if(message==llList2String(color,2))

{

vector c;

c=llList2Vector(color,2);

llSetColor(c,ALL_SIDES);

}

if(message==llList2String(color,3)){

vector c;

c=llList2Vector(color,3);

llSetColor(c,ALL_SIDES);

}

llResetScript();

}

}

14

This week, I have done objects for my group work. After the team discussion, I got my work to create a dance pub. In my opinion, there should be some lights which could change their colours, a black wood floor.

Dancing floor

In this part, I need create some plane object, link them together, and then change their colour to black.

Light for dance

In this part, I need create a cover for light, create light, and then make the light change their colours or make the objects rotate.

Problems

For the design of group work, creating a light and making the objects rotate are little difficult. In the beginning, I think there should be a script can let the object emit light. So I went around second life and saw many different lights, but I also do not know how I can make a light for my part. At last, I found their lights like an object; therefore I made an object and changed it to be transparent.

For the rotation, I found llTargetOmega() from Dahkil(a member of my group). So I create the script as below.