script1.txt 723 B

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