aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/bin/script1.txt
blob: 63780c29a02a9948fad011cb43853e673ccd6ce8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<Script><ScriptEngine:OpenSimJVM,Test1>public class Test1 {
    
    public static void OnFrame()
    {
      int own = 0;
      own = OpenSimAPI.GetEntityID();
      int avid = OpenSimAPI.GetRandomAvatarID();
      float x = OpenSimAPI.GetEntityPositionX(own);
      float avx =  OpenSimAPI.GetEntityPositionX(avid);
      float y = OpenSimAPI.GetEntityPositionY(own);
      float avy = OpenSimAPI.GetEntityPositionY(avid);
      
     if(x> avx)
     {
     	x = x -1f;
     }
     else
     {
     	x = x+ 1f;
     }
     
     if(y > avy)
     {
     	y= y -1f;
     }
     else
     {
     	y = y +1f;
     }
     
     OpenSimAPI.SetEntityPosition(own, x, y, 0);
    }
    
}</Script>