You are not logged in.

1

Monday, July 8th 2013, 3:48pm

action overflow warning

What is the cause of action overflow warning? I create about 30 hotspots and get this message when I try to export them to a file.

Umalo

Professional

Posts: 1,048

Location: Osijek, Croatia, EU

  • Send private message

2

Monday, July 8th 2013, 5:01pm

Most probably error in code. I usually got it when one of the loops is not closed correctly. Show the code if you want us to be more concrete.

3

Monday, July 8th 2013, 7:30pm

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>

4

Tuesday, July 9th 2013, 1:49pm

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

5

Wednesday, July 10th 2013, 4:14pm

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);

6

Thursday, July 11th 2013, 5:18pm

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.