quote:
Original post by __ODIN__
I''m sorry if I didn''t get the point across. In most cases, the game needs to run multiple concurrent scripts, with the ability to "step out of" the script while executing long-running C functions (Essentially allowing the rest of the program, such as the renderer and the tick loops to run).
I can think of one possible solution. Let''s say you have a GameLoop function that updates ticks, renders, etc. You could write an extension to your scripting language that calls the GameLoop function. Here, I''ll call it DoEvents, since it''s similar to DoEvents in VB:
Character.Goto("Home")Do Until (Character.Location == "Home") { DoEvents}// etc.
Thus, the GameLoop would still be executed while the script waits for the character to get home.
One obvious danger of this method: what if a second script gets triggered for the same character while the first one is still running? If so, you need to determine whether the first script should die or the second should get cancelled. Adding a counter to the Do loop might be a good idea, too, so if the guy doesn''t get home after a few minutes, he quits trying.
Anyway, I just thought I''d throw that idea out there. I suspect it would be a bear to implement, but any solution to this problem is likely to be non-trivial.