action overflow warning

  • Below is the code as you have requested. The stange thing is that this code works for number of hotspots smaller than 25. Since these hotspots are not ordered correctly there is one more loop that outputs them in the correct order from the smallest to largests. Let me know if you find out anything.

    <action name="savesurvey_icon_clicked">

    plugin[filesave].cleartext();

    copy(numhotspot, hotspot.count);

    set(num_survey, 0);

    <!-- count the number of survey points-->
    for(set(ii,0), ii LT numhotspot, inc(ii),
    if(hotspot[get(ii)].urctype == "point",
    inc(num_survey);
    );
    );

    <!-- save survey points in order 0,1,2...n-->
    for(set(jj,0), jj LT num_survey, inc(jj),

    trace('processing point=' , jj);

    for(set(ii,0), ii LT numhotspot, inc(ii),

    if(hotspot[get(ii)].urctype == "point",

    <!--trace('hotspot=', get(ii), ', survey num=', get(hotspot[get(ii)].number), ', jj=', jj);
    -->

    if (hotspot[get(ii)].number == jj,

    plugin[filesave].addtext('survey');
    plugin[filesave].addtext(get(hotspot[get(ii)].number));
    plugin[filesave].addtext(' ');

    set(t1, get(hotspot[get(ii)].ath));
    set(t2, get(hotspot[get(ii)].atv));
    add(t1, 0.5);
    div(t2, image.vfov);
    mul(t2, -1.0);
    add(t2, 0.5);
    txtadd(t, get(t1), ' ', get(t2));
    plugin[filesave].addtext(get(t));
    plugin[filesave].eol();
    );
    );
    );
    );

    plugin[filesave].savefile('survey.txt');


    </action>

  • Hi,

    the number of actions that will be executed in one frame is limited to 10000.

    This limit is set to avoid unindented endless loops in the code and too avoid too much framerate-reduce because of too much action code.

    A way to stop the current actions and continue in the next frame, would be using a wait(0).
    Or use a delayedcall(0,...) or asyncfor/asyncloop to split code over several frames.

    E.g. if you have a big outer loop you can simply try adding a wait(0) every N intervals.

    Best regards,
    Klaus

  • Your explanation makes a lot of sense, but for some reasons it doesn't work for me. My plugin save command at the end of the loop is never executed. Here is the pseudo code:

    for (set(i,0), <-- big loop

    get data;

    plugin[myplugin].storedata;

    wait(0);

    )

    plugin[myplugin].savedataToFile <- never gets executed when I have wait(0); It works fine without wait(0);

  • SOLVED - wait(0) did not work. I had to rewrite the code to get rid of loops and store data in an array. Number of actions was reduced significantly and the code works great now. Thank you for your help and for other posting on Forum.

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!