43
  Action commands
  Name
 
We already learned about the name command as a part of Bach Zhaa's animations workshop ( see article 26 .http://www.venice3d.net/2015create26.html ). The name command is often used, and here we will see now more examples and applications with the name command.This is what we have seen before :
 
The name command
For the name command , there are 2 or more objects needed. First of all you have the name control object, which contains the name action command. And then you have the object or objects upont which the name action command is applied to.
pole1m.rwx
activate move 0 0 10 ltm time=2 reset name=aa global
The pole object is the name control object, containing the name action command.
p1cube0200.rwx
create name aa
The cube object is the object upon which the action has applied, containing the name command. You can use any name, but use lower case characters and simple short words, like here : "aa" . The name of the control object must be the same.
pole1m.rwx
activate move 0 0 10 ltm time=2 reset name=cube loop global
With the global command, the animation can also be seen by the other visitors
 

 

In Happy Valley (AlphaWorld 1578S 3242E) you will find these poles under the terrain, and they contain the name action commands for different kind of textures.
Remote control
The name command can be considered as a kind of "remote control". You can make a remote control for a 3d television : turn the tv on/off and choose tv channels.
Another application is opening a door by clicking upon a sign object. This is the normal action command for a door , just click upon the door object and it will open...
fw-dorext1.rwx
activate rotate 0 5 0 time=3 wait=9 global
With activate rotate 0 -5 0 , the door will open into the other direction, but now we will use a button-sign object to open the door.
button_2.rwx
create sign "open" q=64 ; activate rotate 0 5 0 time=3 wait=9 global name=door1
fw-dorext1
create name door1
The button-object contains the name action, the door itself only the name command.
 
Simultaneous actions
You can put 2 or more name commands upon 1 object , so that you can execute 2 or more actions at the same time:
In this example, you can click upon 1 of the doors and then the other door will open as well, but with the rotation into the other direction.
fw-dorext1.rwx
create name door1 ; activate rotate 0 5 0 time=3 wait=9 global name=door1, rotate 0 -5 0 time=3 wait=9 global name=door2
fw-dorext1.rwx
create name door2 ; activate rotate 0 5 0 time=3 wait=9 global name=door1, rotate 0 -5 0 time=3 wait=9 global name=door2
In this example both doors have 1 name command for opening the other door and 1 name command to open the door itself. In this example , the name command and the name action command are on the same object.
When you know how this works ,then it's also easy to make 2 sliding doors : in this case it's using the move command instead of the rotate command.
pp16.rwx
create name left , scale 0.8 ; activate move 0 0 1 time=4 wait=7 name=left ,move 0 0 -1 time=4 wait=7 name=right global
pp16.rwx
create name right , scale 0.8 ; activate move 0 0 1 time=4 wait=7 name=left ,move 0 0 -1 time=4 wait=7 name=right global
 
Same application for the max-stage-curtains ( see article 40 http://www.venice3d.net/2016create40.html )
Or you can make a door that opens automatically. In fact for this you put an object in front of the door entrance, which contains the name action command. You add the bump trigger , which means that the action will be executed when an avatar hits the object, and finally, you make the object invisible , this is what you will have :
ga-arch1
create solid off, visible off , scale0.4 ; bump rotate 0 5 0 time=3 wait=9 global name=door3, rotate 0 -5 0 time=3 wait=9 global name=door4
fw-dorext1
create name door3
fw-dorext1
create name door4
Finally you also put a ga-arch1-object at the other side of the doors.
Reducing text in the action commands
This is in fact the same as "simultaneous actions", but when having 100 objects with the same long action command, then you can use instead only 1 object with the long action name command, and apply this to 100 objects using a short name command. Large amounts of text in the action command will reduce the cell limit and also the framerate.
For this example, we go to Happy Valley (AlphaWorld 1575S 3239E), where we see this nice arch with a kind of "creamy" texture. When we go to the action command, then we don't see which texture is it, we only see the name command :
w2crv_0500f.rwx
create name a, scale 2

This way of building is less complicated : instead of having to read all the texture information in the action command, here you have a focus on how much you need to scale the object. The disadvantage is that those who want to learn from you, don't know the "real" action command. Fortunately, in Happy Valley, we know here that the object with the name action command, is hidden somewhere in the neighbourhood , but underground , under the terrain (AlphaWorld 1578S 3242E). (See the first picture of this webpage). And we find out that this is a kind of marble texture.

pole1m.rwx
create timer tex 5000 loop=-1;at tm tex 100, picture http://anadept.com/sid/aw/textures/marble/angkor01.jpg name=a