Threading or similar in LiveCode

Ken Corey ken at kencorey.com
Fri Jul 20 06:05:34 EDT 2012


Send can mimic this behaviour.

You wouldn't want each car in its own 'thread', to be sure, as send has 
a certain amount of overhead...but it's a simple matter to set up 
recurring events:

on animate
   --do some animation stuff here
   -- if your drawing loop can take a variable amount of time
   -- then you'll want to get a little more clever about how long
   -- to wait before sending the next animate method
   send animate to me in 150 milliseconds
end animate

on preOpenCard
   -- do any setup necessary when opening the card:
   -- resizing graphics, etc
end preOpenCard

on openCard
   -- handle open card tasks

   -- start the animation
   send animate to me in 0 milliseconds
end openCard

-Ken

On 20/07/2012 09:24, Rod McCall wrote:
> As I said in a previous email I am returning to LiveCode after a few
> years (well seven to be exact) so am a little rusty. Anyway right now
> we are implementing a car simulator environment of which we will use
> LiveCode as the control console for the simulation - at least that is
> the current plan. Am I right in thinking there is no equivalent to the
> Threading class that you find in Python? If so how do people implement
> something which is similar to this? I may have missed the info in the
> docs but a quick Google or scan of the RR website for anything
> resembling threading seems to yield very little.
>
> If no such equivalent exists are there ways round this? For example
> using sub-stacks etc each one behaving like a "fake thread"?
>
> Sorry if this seems a silly question but it has been a few years since
> I used LiveCode.
>
> Kind regards,
>
> rod
>




More information about the use-livecode mailing list