Adventure Game Studio

AGS Support => Advanced Technical Forum => Topic started by: Trapezoid on Mon 18/08/2003 19:28:31

Title: Repeatedly execute during blocking functions
Post by: Trapezoid on Mon 18/08/2003 19:28:31
I think this has been discussed before, but I'm not sure if it got anywhere and I couldn't dig it up with the search.

Anyway, let's say I put something like this in my global script's repeatedly_execute:

if (GetMIDIPosition()==32) SeekMIDIPosition(24);

or something like that. That would manually loop a portion of the MIDI file playing, for one effect or another.
However, if the MIDI position happens to pass 32 while a blocking event is occuring (like a character talking) then it doesn't have a chance to loop back!

Now, if I understand the way AGS works correctly, during every game loop, it runs through all the scripts, updates the graphics, etc. When a blocking function is called, then it stops reading the scripts and focuses on doing only certain things, such as animating a character and displaying text, or whatnot.

For special cases where you need something to continue happening even when a blocking function is called.

repeatedly_execute_ex ()

or something. It works just like the normal repeatedly_execute, only it doesn't get skipped over during blocking functions. Would that work? I think that as long as you don't use any blocking functions within it, it would work ok.
Any thoughts?
Title: Re:Repeatedly execute during blocking functions
Post by: Ishmael on Tue 19/08/2003 09:09:26
Yes... Good point.... :) NOW SOMEONE MAKE IT WORK ;D
Title: Re:Repeatedly execute during blocking functions
Post by: Gilbert on Tue 19/08/2003 09:13:24
Alright, that seem to be useful, but I don't know if it is easy for Pumaman to implement (One possible problem would be if you modify something that the blocking function relies on in that rep_exe_ex function unexpected things may occur).

Anyway, I'll add this to the tracker.
Title: Re:Repeatedly execute during blocking functions
Post by: Ishmael on Tue 19/08/2003 09:57:48
"Command not allowed in repeatedly_execute_ex" Error to prevent using commands that would mess things up bad time?
Title: Re:Repeatedly execute during blocking functions
Post by: Gilbert on Tue 19/08/2003 10:14:56
Heh Actually I don't care about it, it should be left to the scriptor to check his problem himself in my opinion, as it's in general not really easy to determine whether you do something forbidden (different blocking functions may use different parameters, so would be affected by different things), just preventing you to use something that you know yourself would not affect anything is not a good idea.

For example, if you start a character walking by:

MoveCharacterBlocking(EGO, blah...);

and in rep_exe_ex() you have something like:
MoveCharacter(EGO,...);
may certainly mess things up, but if the line in rep_exe_ex() is instead:
MoveCharacter(JOHN,...);
there should not be violations. So it's hard to determine such clashes, and such checkings should be left as responsibility to the scriptor himself.
Title: Re:Repeatedly execute during blocking functions
Post by: Ishmael on Tue 19/08/2003 11:43:06
Oh, yes, you're right...
Title: Re:Repeatedly execute during blocking functions
Post by: Trapezoid on Tue 19/08/2003 15:22:44
Yes, it would probably be best left as an advanced option, use at your own risk, blah blah. Most designers could (DO) get along fine with out it, but having the option would open up a lot to people who are tired of workarounds.

Hmm... I have an idea for another method of implementing it. There could be a prefix (sort of like "//"). Any line using this prefix is NOT skipped over during blocking functions... it'd make it more flexible, but there'd be other issues, I think...
Title: Re:Repeatedly execute during blocking functions
Post by: Ishmael on Tue 19/08/2003 19:00:49
Yes, another issue... as I think the whole rep_ex is skipped during blocking functions. (?) But the rep_ex_ex sounds good to me, and it should maybe be like the dialog_request, not initally in the global script, so beginners wouldn't get confused by it...
Title: Re:Repeatedly execute during blocking functions
Post by: Pumaman on Wed 20/08/2003 20:48:29
Interesting idea, I'll look into it.
Title: Re:Repeatedly execute during blocking functions
Post by: Trapezoid on Thu 21/08/2003 00:50:11
Thanks Chris!
Title: Re:Repeatedly execute during blocking functions
Post by: Trapezoid on Mon 25/08/2003 17:05:25
I don't want this thread to slip off the bottom of the page... I'd like to continue discussing it, because I think this feature would actually open up a new level of flexibility for AGS. And it doesn't even seem like it would be much work for Chris to implement. :)
Title: Re:Repeatedly execute during blocking functions
Post by: Pumaman on Mon 25/08/2003 21:53:47
Well, that depends on the scripting system. I'm not sure if it will allow multiple scripts to run at once, because it's been a while since I wrote it. Hopefully it shouldn't be too hard to do though.