event...Doesn't interrupt the current thread?

Post » Tue Jun 19, 2012 12:37 am

OK, I'm using OnTranslationCompleted like this:

float DeltaX = 0.0float DeltaY = 0.0 ; Offsets for movementfloat DeltaZ = 0.0Bool AlreadyLooping=falseFunction Move(); Do stuff to determine where to move to.   Self.TranslateTo(DeltaX+Self.X,DeltaY+Self.Y,DeltaZ+Self.Z,Speed)   if !AlreadyLooping	  AlreadyLooping = True      while Self ; While I exist ; Object is deleted from another script on certain conditions         Wait(5.0) ; Need to keep variables active between calls.	  endwhile   endifendfunctionevent OnTranslationCompleted()   Debug.Notification("Starting a New Move")   Move()endEventevent OnTranslationFailed() ; Called if something goes wrong    Debug.Notification("Error: Bad move Data.")endEvent

The idea is, once Move is called from somewhere else (OnInit for example), the object will keep moving based on it's own criterion using the OnTranslationFinished() event to start a new move whenever one ends.

But the code in OnTranslationCompleted() doesn't get the same variables as the ones initialized when Move was first called.

Apparently, events spawn a completly new thread, and thus cannot use stored local values?
User avatar
Marta Wolko
 
Posts: 3383
Joined: Mon Aug 28, 2006 6:51 am

Return to V - Skyrim