ZDaemon Forum Index ZDaemon
Client/Server DOOM
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

[ACS] CPA_Execute/CPA_ExecuteAlways and the loop states

 
Post new topic   Reply to topic    ZDaemon Forum Index -> Pending Requests
View previous topic :: View next topic  
Author Message
Maikl_Russia
has entered the game!


Joined: 18 Jul 2005
Location: RU

PostPosted: Sat Dec 12, 2015 11:41 pm    Post subject: [ACS] CPA_Execute/CPA_ExecuteAlways and the loop states Reply with quote

We have such amazing and useful codepointers like CPA_Execute and CPA_ExecuteAlways.

They works fine in case non loop states of actors: Death, Pain, Raise, etc.
But when Actor enters in Spawn/Idle or See (etc) states with loop we get:
CPA_ExecuteAlways - mess from many copies of the same script for every actor by every cycle in state.
CPA_Execute - only one copy of script for single actor (even if we have many of the same actors).

It would be great to be able to run a one copy of script for every actor in such states. May be via using Args6 (1/0) - for enable CPA_Execute for every actor or restrict count of starts CPA_ExecuteAlways.
Back to top
View user's profile Send private message
Body-Guard
Unstoppable!


Joined: 08 Jan 2006
Location: Hungary

PostPosted: Sun Dec 13, 2015 2:19 pm    Post subject: Reply with quote

If I get it right, the problem is when you use these codepointers in looped states like idle/chase:

CPA_ExecuteAlways executes in each loop iteration for each actor.
CPA_Execute runs the specified script only once at a time, no matter how many actors try to call it.

As far as I know this is the intended behavior and it should not be changed. This is because of their definition:

ExecuteAlways allows for running multiple instances of the same script.
Execute can run only one instance of the same script at a time.

This is exactly what happens in this scenario as well. I'm not sure what you mean by "mess" due to many copies of the script running? If you use ExecuteAlways in actor states, it should just execute a simple script doing something with the actor it is being called from.
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
Sr69Mm-jC
Unstoppable!


Joined: 21 Jul 2011

PostPosted: Sun Dec 13, 2015 6:30 pm    Post subject: Reply with quote

Indeed, the behavior is correct. I wonder what Maikl is trying to achieve exactly.

1) If you need one instance of a script that runs in the background for each actor of a particular type, you could simply make it run via CPA_ExecuteAlways on the thing's initial frame, then make it go to A_Look states loop.

2) If you need to repeatedly execute a script in a looped animation (e.g. do something to the thing every few steps it takes), then naturally you'd want the script to be finished before it can be called by that thing again - or, in many cases, even instantly.

I can see the problem you're describing - the inconvenience to run a single copy of a script for each actor - but can you name us an example where either of the options I described would not work at all?
Back to top
View user's profile Send private message
Maikl_Russia
has entered the game!


Joined: 18 Jul 2005
Location: RU

PostPosted: Tue Dec 15, 2015 9:47 pm    Post subject: Reply with quote

Body-Guard, of course those CP work right, like they should. This is why I wrote my message here - in "Pending Requests", not in "Unconfirmed Bugs".

Sr69Mm-jC understood my request correctly. May be because we both russians and he may understand my english. Laughing

Sr69Mm-jC wrote:
1) If you need one instance of a script that runs in the background for each actor of a particular type, you could simply make it run via CPA_ExecuteAlways on the thing's initial frame, then make it loop to A_Look states.

Hmmm, nice idea... This is temporarily solve my current problem. But anyway, new instance of script will be started after the actor enters in such state again. An obvious disadvantage of this way: necessity to search an unused frame and change a first Spawn/Walk/(etc. loop states) frame of actor at found free frame (in which, next frame will point to original first frame of loop state).
Of course, it's not too time-consuming, but nevertheless forced to do additional work to get what you want. This is like CPA_JumpIfScriptResult vs JumpIfArgs.

Sr69Mm-jC wrote:
2) If you need to repeatedly execute a script in a looped animation (e.g. do something to the thing every few steps it takes), then naturally you'd want the script to be finished before it can be called by that thing again - or, in many cases, even instantly.

This action impossible with the current behavior of CPA_ExecuteAlways in case if script running time will be more than time of a looped animation. You describe here behavior of CPA_Execute (which will work only for single actor).

Sr69Mm-jC wrote:
I can see the problem you're describing - the inconvenience to run a single copy of a script for each actor...

YES, IT IS!
It is not just an inconvenience, it is impossible to do now without resorting to any kind of tricks.
Based on my limited experience on the modification of the game, I have not met with the need to run the script in a looped animation many times. But the need for a single instance of script for each actor - all the time.
Back to top
View user's profile Send private message
Sr69Mm-jC
Unstoppable!


Joined: 21 Jul 2011

PostPosted: Wed Dec 16, 2015 1:13 am    Post subject: Reply with quote

Maikl_Russia wrote:
Hmmm, nice idea... This is temporarily solve my current problem.

I'm glad it's a viable solution for you.

Maikl_Russia wrote:
An obvious disadvantage of this way: necessity to search an unused frame and change a first Spawn/Walk/(etc. loop states) frame of actor at found free frame (in which, next frame will point to original first frame of loop state).
Of course, it's not too time-consuming, but nevertheless forced to do additional work to get what you want.

Well, you already get to search for unused frames all the time when you dive into dehacked and attempt to achieve nearly anything.

Maikl_Russia wrote:
Sr69Mm-jC wrote:
2) If you need to repeatedly execute a script in a looped animation (e.g. do something to the thing every few steps it takes), then naturally you'd want the script to be finished before it can be called by that thing again - or, in many cases, even instantly.

This action impossible with the current behavior of CPA_ExecuteAlways in case if script running time will be more than time of a looped animation.

Exactly my point. Why would you want such a script that runs on every loop iteration but lasts longer than the loop animation itself? Like I said, in any reasonable case that I can think of, such scripts should be over before the next loop iteration can start. Or, in many cases, they would even be over immediately (i.e. they'd stop on the same tic with no delays at all).

Maikl_Russia wrote:
It is not just an inconvenience, it is impossible to do now without resorting to any kind of tricks.

I'm sure you're well aware that modding in pretty much any unusual idea on this engine means resorting to various tricks. And ACS-driven animations could be considered unusual ideas. Besides, using one extra frame is not that much of a "trick".

Maikl_Russia wrote:
Based on my limited experience on the modification of the game, I have not met with the need to run the script in a looped animation many times. But the need for a single instance of script for each actor - all the time.

For which you confirmed the solution that I provided would work. Look, I'm not against a small extra feature myself but it'd still take a certain someone's time to implement. And personally I'm simply not convinced that we need it yet since you and me are yet to discover a scenario where no options discussed in this topic could provide a viable workaround.
Back to top
View user's profile Send private message
Aeyesx
Dominating!


Joined: 13 Oct 2012

PostPosted: Mon Sep 05, 2016 9:43 am    Post subject: Reply with quote

I am afraid what Maikl_rus really tried to achieve was MESS in deh leading to death of our work in converting zdoom wars.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    ZDaemon Forum Index -> Pending Requests All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group