|
如skyzhu所说,要达到每次引用都随机取值的目的,是需要重复调用;
----------------------------------
void getXY()
{
int i,x,y;
i=atoi(lr_eval_string("{GroupCount}"));//Update Value on "each occurrence"
lr_output_message("选取了第%d组范围中的数据",i);
switch(i)
{
case 1:
x=atoi(lr_eval_string("{xGroup1}"));//Update Value on "each occurrence"
y=atoi(lr_eval_string("{yGroup1}"));//Update Value on "each occurrence"
break;
case 2:
x=atoi(lr_eval_string("{xGroup2}"));//Update Value on "each occurrence"
y=atoi(lr_eval_string("{yGroup2}"));//Update Value on "each occurrence"
break;
case 3://全负数
x=atoi(lr_eval_string("{xGroup3}"));//Update Value on "each occurrence"
y=atoi(lr_eval_string("{yGroup3}"));//Update Value on "each occurrence"
break;
case 4://正负数x取-300~400,y取-500~200
x=(rand()%7000)/9-300;
y=(rand()%7000)/9-500;
}
lr_save_int(x,"x");
lr_save_int(y,"y");
}
Action()
{
getXY();
lr_output_message("第一次调用:x is %s;y is %s",lr_eval_string("{x}"),lr_eval_string("{y}"));
getXY();
lr_output_message("第二次调用:x is %s;y is %s",lr_eval_string("{x}"),lr_eval_string("{y}"));
getXY();
lr_output_message("第三次调用:x is %s;y is %s",lr_eval_string("{x}"),lr_eval_string("{y}"));
getXY();
lr_output_message("第四次调用:x is %s;y is %s",lr_eval_string("{x}"),lr_eval_string("{y}"));
return 0;
} |
|