Friday 27 May 2016

Scripts in Simonastick / Opensim

  Deutsch:

Scripte in Simonastick / Opensim

(see English below)

Wir werden Scripte in einer praktischen Übung besprechen.

Falls du es noch nicht getan hast,
lade zunächst den Würfel von dem vorherigen Blog-Eintrag über "Mesh"-Objekte herunter:
Würfel herunterladen

Es handelt sich hierbei um eine "zip"-Datei.
Diese musst du zuerst öffnen.
Du erhältst dann einen Ordner mit den folgenden Dateien:

- "Mesh"-Datei ("dice" = "Würfel"), 
- Sound Datei, 
- Script, 
- "Scratch4Opensim" Datei
(Das ist das Programm, mit dem das Script erstellt wurde (siehe unten))

- und eine "iar"-Datei.)




 A) Importiere zunächst den Würfel in deinen "Singularity Viewer",wie in diesem Blog-Eintrag beschrieben.


B) Die Sound-Datei

Die Sound-Datei verursacht bei Berührung des Würfels ein leises Geräusch.
Importiere zunächst die Sound-Datei "syn_tom06v2:
Singularity Viewer, oben links "file", "Import Sound".
Die Sound-Datei befindet sich dann in deinem Inventory.


Ziehe dann die Sound-Datei aus deinem Inventory auf den Würfel.
 

Sie befindet sich dann im "content"-Menü des Würfels,
gemeinsam mit dem Script, das wir nun hinzufügen werden.




C) Das Script: Die Roll-Bewegung des Würfels

Um dem Würfel eine Roll-Bewegung zu geben, muss man ihm ein Script hinzufügen.
Unser Script heißt "dice_roll_script".


Es muss im "edit"-Menü der Würfel (rechts-klick auf den Würfel),
bei "content" eingefügt werden.


1. Kopiere dafür den Text aus dem "dice_roll_script".

2. Rechts-klicke auf den Würfel, klicke auf "edit".

3. Links-klicke auf "content".

4. Klicke auf "New Script".
Es erscheint ein "New Script".

5. Doppelklicke auf das "New Script".
Ein Editier-Fenster öffnet sich.

Lösche den gesamten Text in dem Editier-Fenster.
Füge den kopierten Text des
"dice_roll_script" ein.


6. Klicke auf "save" und schließe das Fenster.   

Wenn du den Würfel jetzt anklickst,
sollte er eine Roll-Bewegung vollführen und ein leises Geräusch machen.




D) "Scratch4opensim"

"Scratch4opensim" ist ein Programm,
mit dem man in einfacher Weise im Baukasten-Prinzip Programmier-Scripte für Opensim / Simonastick erstellen kann.
 

Lade "Scratch4opensim" herunter:
http://www.greenbushlabs.com/LabsBlog/?p=797

Entpacke die zip-Datei.
Dopple-klicke die Datei "Scratch.bat".
Es öffnet sich das Programmier-Fenster.



Den Programmier-Code für einen Chat-bot schreiben (8 Schritte):

Wir werden nun ein Programmier-Script für einen Chat-Roboter schreiben,
d.h. für eine virtuelle Person,
mit der man sich unterhalten kann.


Gehe die folgenden Schritte durch:


1. Links oben, klicke auf "controls".
2. Klicke auf "when I receive" und ziehe es in das Arbeitsfeld in der Mitte.
3. Klicke auf das kleine weiße Dreieck.
Schreibe den Satz hinein, auf den der Roboter antworten soll, z.B. "Hi!".
4. Klicke oben links auf "Looks".    
5. Klicke auf "Set text" und ziehe es in das Arbeitsfeld.
6. Schreibe den Text, den der Roboter auf den ersten Satz antworten soll, in die Zeile (der vorgegebene Beispieltext ist "Look at me!").
7. Setze die beiden Teile zusammen, wie zwei Puzzle-Teile.

Der Chat-Bot wird nun auf den ersten Satz, den du eingegeben hast, mit dem zweiten Satz antworten.

8. Oben rechts über dem Arbeitsfeld klicke auf "Copy Linden Script".
Du hast jetzt den Programmier-Code für den Chat-Bot kopiert.    

Gehe nun hier weiter. 
  ---------------------------------------------------------------------------------------

 

English:

Scripts in Simonastick / Opensim:

We are going to explain how scripts work in a practical exercise.
In this exercise, we are going to use the dice from the blog entry about "Mesh"-objects.

If you have not downloaded the dice yet,
download the dice from here.

 
The dice comes in a zip-file.
The zip-file
contains: 


- the "Mesh"-file (the dice)
- a sound file
- a script
- the "Scratch4Opensim" file
(this is the program by which the script was created; see below
)
- and an "iar"-archive file


 

After downloading, you have to unzip the zip-file first.

A) Import the dice into your Singularity Viewer as described in this blog entry.


B) sound file in the dice
 
The dice rolls and makes a little sound when rolling.

In order to attach the sound file to your dice,
do the following:


1. Import the sound-file "syn_tom06v" into Opensim / Simonastick:
In your "Singularity Viewer" on the top left,
click on "file" and then "upload sound".


2. A folder window opens.
Navigate to the folder in which you saved your sound file.
Click on it, and then click on "open".
In the window from "Singularity Viewer" click "okay".


3. You can then find the sound-file in the so-called "Inventory",
which is a folder at the very bottom right, in which all files are stored.

4. In order to attach the sound-file to the dice,
drag the dice from your Inventory into your world.

Then, simply drag and drop the file onto the dice.

You can then find the sound-file in the "content" tab of the dices
(right-click, click on "edit", then click on "content").




C) The script: Make the dice roll


The dice needs a script in order to make it roll.
You can find the script in the zip-folder.
The script was made using the program "Scratch4Opensim" (see below).

It is a simple text file and is called "dice_roll_script" .


In order to apply the script to your dice, do the following:

1. In the zip folder you just downloaded,
double-click on the "dice_roll_script" file.
A text editor window opens.
Select all text and copy it.


2.Right-click on the dice.
Click on "edit". 

3. In the "edit" menu of your dice,
click on "content", on the right.

 
4. In the "content" tab, click on "New Script".
A "New Script" appears in the window.

5. Double-click on that script.
The script text is opened in a window.
This text does not contain any real information yet. 

6. Delete all text in the "New Script".
Then, right-click into the window
and "paste" the "dice_roll_script" text you copied. 

 
7. Click "save" and close the "edit" window.)


Now, when you click on the dice,
it should roll and make a slight noise.



D) "Scratch4opensim""Scratch4opensim" is a program that allows you to write programming-scripts for Opensim / Simonastick on a graphical program interface.
Go through the following steps:



Download "Scratch4opensim":
http://www.greenbushlabs.com/LabsBlog/?p=797
Unpack the zip-file.
Double-click the file "Scratch.bat".
The user-interface opens.


Write the programming code for a chat-bot (8 steps):




A chat-robot (chat-bot) is a virtual person with whom you can talk.
This is done through a programming script.


In order to write such a programming script,
use the program "Scratch4Opensim"
and go through the following 8 steps:


1. In "Scratch4Opensim", on the top left,
there are several options.

Start with "controls".
2. Choose "when I receive" and drag it into the empty field.
3. Click on the little triangle / arrow.
Enter the phrase / question you want to say to the Chat-bot, for example: "Hi!"
4. Click on "Looks" in the top menu.
5. Choose "Set text" and drag it into the field.
6. Write your text into the white space (by default "Look at me!").
7. Connect it with the first piece as a unit, like a jig-saw puzzle.
This is the chat-bot's reply to your phrase / question.

This means, when you say "Hi!" (mind correct spelling) to the chat-bot,
the chat-bot will reply with whatever you typed into that field.


8. On the top right, click on "Copy Linden Script".
Now you have copied the programming code of your script.

Now, click here to continue.

No comments:

Post a Comment