[Fixed]如何随机选择列表选项?
set_window ("my work", 1);iRand = rand();
iRand *= 3;
iRand = int(iRand);
iRand += 1;
tbl_activate_cell ("mywork.dw_1", "#3", "ShowName");
# tbl_activate_cell ("mywork.dw_1", "#iRand", "ShowName");
如何随机选择??
还有一问题:
iRand = rand();
iRand *= 3;
iRand = int(iRand);
iRand += 1;
为什么组合在一起就出错了呢?
iRand = 1 +int ( rand() * 3); //error 什么原因??
谢谢..
[ 本帖最后由 vonsy 于 2006-6-6 15:55 编辑 ] iRand = 1 +int ( rand() * 3);
这个在我这边能通过,结果正确 static level[ ] = {5, 2, 4, 3, 2};
# end = level + begin - 1;
**************************************
end = level;
end += begin;
end -= 1;
这个呢?对吗?
obj_mouse_click ("dw_1.Level", 84, 14);
tbl_set_cell_data ("dw_1", "#1", "Level", "#X");
//如何才能使#x 变成一定范围内随机的 (如: 1-5)??
#3 ok
#&iRand no
# & no
???????????????????不会用,哪位帮帮忙. 今天很热. iRand = 1 + int(rand() * 15);
win_activate ("my work");
set_window ("my work", 0);
tbl_activate_cell ("mywork.dw_1", "#"&iRand, "ShowName");
使用“#”&iRand表达式,其中iRand是变量,而&是链接符号。 ( by manok) 对,放在引号外才能参数化
看看这个应该就理解了
x=int(rand()*5)+5;y=int(rand()*9)+1;
#pause(x);
#pause(y);
wait(x);
set_window ("·ï»Ëɽ", 2);
button_press("vir_button"&y); set_window ("my work", 1);
srand(get_time());
iRand = rand();
iRand *= 3;
iRand = int(iRand);
iRand += 1;
# tbl_activate_cell ("mywork.dw_1", "#3", "ShowName");
tbl_activate_cell ("mywork.dw_1", "#"iRand, "ShowName"); 这么写就行“#”iRand 错了这么写就行“#”&iRand “#”iRand
这个也对.测试成功
页:
[1]