Mythruna
May 28, 2020, 09:14:00 AM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
News: Welcome to the new forums. See "Announcements" for a note for new users.
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Track Movement?  (Read 3949 times)
Michael Musgrove
Donators
Hero Member
***
Posts: 2164



View Profile WWW
« on: July 09, 2014, 11:00:43 AM »

I'm curious if there is a possibility to track movement for a player, object, or any entity in general. I want to make this awesome script that will be so awesome that it's awesome. The only way that I've thought to do it is to use a Timer and compare the connection's position to the previous one, and see the difference (if there is one) but I would find that inefficient.

I haven't learned packet handling. :c
Logged

pspeed
Administrator
Hero Member
*****
Posts: 5577



View Profile
« Reply #1 on: July 09, 2014, 12:09:56 PM »

The sort of events necessary to do this easily haven't been implemented yet.  It's required by the AI stuff, though, and a few other things.

Trying to implement a heart beat event yourself will be problematic, I think.  The only thread safe way to do it (in the public release) would be to queue up a simulation SimCommand that requeues itself over and over... I think.  I don't know if the GameSimulation object is exposed to scripts or not.  Looks like from the player context getSystems().getSimulation() might do it.

I'm a little fuzzy on the old scripting.

But a Timer won't really be good because you'll potentially be doing things that aren't thread safe.
Logged
Michael Musgrove
Donators
Hero Member
***
Posts: 2164



View Profile WWW
« Reply #2 on: July 09, 2014, 01:16:12 PM »

The sort of events necessary to do this easily haven't been implemented yet.  It's required by the AI stuff, though, and a few other things.

Trying to implement a heart beat event yourself will be problematic, I think.  The only thread safe way to do it (in the public release) would be to queue up a simulation SimCommand that requeues itself over and over... I think.  I don't know if the GameSimulation object is exposed to scripts or not.  Looks like from the player context getSystems().getSimulation() might do it.

I'm a little fuzzy on the old scripting.

But a Timer won't really be good because you'll potentially be doing things that aren't thread safe.
Okay, thanks for the tips. I was looking around for a class that would queue itself, and be ran each loop
Logged

pspeed
Administrator
Hero Member
*****
Posts: 5577



View Profile
« Reply #3 on: July 09, 2014, 03:08:15 PM »

If you create your own SimCommand you could give it the simulation... then when it runs it can requeue itself.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.20 | SMF © 2013, Simple Machines Valid XHTML 1.0! Valid CSS!