MAXScript Extensions > MAXScript Extensions for Particle Flow > Particle Flow Script Examples > Script Tests >

# Integrator ProceedSynch Example

| Particle Flow - Quick Navigation

Description:

The following examples show the difference in particle position in two PF_Sources using the Integrator Interface’s proceedSynch methods.

Can Be Used With:

These two sample scripts should be used inside of Script_Test actions.

- Create a PF_Source in the viewport.

- Open Particle View.

- Add a Script_Test action to the end of Event01.

- Clone the particle system but leave it at the exactly same position.

- Change the color of the second particle system

- Load the first sample in the Script_Test of the first particle system.

- Load the second sample in the Script_Test of the second particle system.

Effect:

Allows the user to compare the effects of two ProceedSynch calls.

The resulting positions of all particles will be printed to the Listener.

EXAMPLE 1
    --The ChannelsUsed handler defines the channels
    --to be made available to the script.
    --For the list of all channels, see
    --Interface: MaxscriptParticleContainer
    --The parameter pCont passed to the handler
    --contains the Particle Container the script is applied to
    on ChannelsUsed pCont do
    (
    pCont.useTime = true --enable the Time channel
    pCont.usePosition = true --enable the Position channel
    )

    --The Init handler is called on initialization.
    --It is not used in this case.
    on Init pCont do
    (
    )

    --In the Proceed handler, we will call the ProceedSync method
    --of the integrator.
    on Proceed pCont do
    (
    end = pCont.GetTimeEnd() as float
    _int = pCont.GetIntegrator()
    count = pCont.NumParticles()
    pCont_curr = pCont.GetParticleContainer()

    for i in 1 to count do
    (
    pCont.particleIndex = i
    if _int != undefined then
    _int.proceedSync pCont_curr (end/160) 0.0 false #{}
    format "p1.particle%=%\n" i (pCont.GetParticlePosition i)
    )
    )

    --The Release handler is used to do cleanup work.
    --Not used in this case.
    on Release pCont do
    (
    )

EXAMPLE 2
    --The ChannelsUsed handler defines the channels
    --to be made available to the script.
    --For the list of all channels, see
    --Interface: MaxscriptParticleContainer
    --The parameter pCont passed to the handler
    --contains the Particle Container the script is applied to
    on ChannelsUsed pCont do
    (
    pCont.useTime = true --enable the Time
    channelpCont.usePosition = true --enable the Position channel
    )
    --The Init handler is called on initialization.
    --It is not used in this case.
    on Init pCont do
    (
    )

    on Proceed pCont do
    (
    end = pCont.GetTimeEnd()asfloat_int = pCont.GetIntegrator()
    count = pCont.NumParticles()pCont_curr = pCont.GetParticleContainer()

    for i in 1 to count do
    (
    pCont.particleIndex = i
    if _int != undefined then
    _int.proceedSync pCont_curr (end/160) 0.5 false #{}
    -- Array version to try out:
    --_int.proceedASync pCont_curr #((end/160), (2*end/160), (3*end/160)) #(0.1, 0.2, 0.5) true #{1..3}

    format "p2.particle%=%\n"i (pCont.GetParticlePosition i)
    )
    )

    --The Release handler is used to do cleanup work.
    --Not used in this case.
    on Release pCont do
    (
    )

#### See Also

- Using MAXScript in Script Actions

- Particle Flow Sample Scripts