Repeatedly execute during blocking functions

Started by Trapezoid, Mon 18/08/2003 19:28:31

Previous topic - Next topic

Trapezoid

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?

Ishmael

Yes... Good point.... :) NOW SOMEONE MAKE IT WORK ;D
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Gilbert

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.

Ishmael

"Command not allowed in repeatedly_execute_ex" Error to prevent using commands that would mess things up bad time?
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Gilbert

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.

Ishmael

I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Trapezoid

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...

Ishmael

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...
I used to make games but then I took an IRC in the knee.

<Calin> Ishmael looks awesome all the time
\( Ö)/ ¬(Ö ) | Ja minähän en keskellä kirkasta päivää lähden minnekään juoksentelemaan ilman housuja.

Pumaman



Trapezoid

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. :)

Pumaman

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.

SMF spam blocked by CleanTalk