lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


You may want to adopt an event-driven style, and use a timer to trigger
the process of every steps in a event so that you can maintain all
activities of different events in a single thread.

In your Lua script, the GotoLocation("Location 2") actually only
triggers the initiation of a 'Goto' event. If you want subsequent
actions to be taken after GotoLocation("Location 2"), you may pass
them as function callbacks.

Regards,
.paul.

On Sun, Dec 03, 2000 at 12:09:33AM +1000, Daniel Krenn wrote:
> Hi,
> 
> We're new to scripting and are strongly considering using LUA with one
> of our upcoming projects. Since our knowledge of scripting in general
> is rather limited, we were wondering if someone might be able to offer
> us some assistance with the following problem.
> 
> If we are wanting to implement simple script functionality such as...
> 
> ----------------------------
> Spawn("Location 1")
> 
> do
>   GotoLocation("Location 2")
>   Wait(2)
>   GotoLocation("Location 1")
>   Wait(2)
> end
> ----------------------------
> 
> ...whereby multiple actors can be using a script similar to (but much
> more complex than) this example. The actors need to process each line
> of the script sequentially, and not continue to the next line of script
> until the current line (command) has been successfully completed (obviously
> =p)
> 
> What would be the best way to have the script operate in this fashion
> (while at the same time trying to avoid multi-threading, and
> coroutines) ???
> 
> I know this kind of problem has probably been addressed at some point
> in the past, but we would be extremely appreciative if someone working
> with games could throw us a hint or two, or throw us some examples
> relating to this issue.
> 
> Best Regards,
> Daniel.
> 
> dkrenn@bigpond.com
> 
>