注意,下列代码中num仅在code行计算了一次随机值以后,就被循环复制了,所有行的结果都是同一个数字。
而跟code行没有联系的 !math.random(0,9)! 在每次循环生成的新行中,都重新计算了随机值。
Comment: 0,0:00:00.00,0:00:00.00,CN,,0,0,0,code once,num = math.random(0,9)
Comment: 0,0:00:00.00,0:00:01.00,CN,,0,0,0,template noblank notext,!maxloop(10)!!num! !math.random(0,9)!
Comment: 0,0:00:02.00,0:00:03.00,CN,,0,0,0,karaoke,{\k25}字
Dialogue: 0,0:00:02.00,0:00:03.00,CN,,0,0,0,fx,3 7
Dialogue: 0,0:00:02.00,0:00:03.00,CN,,0,0,0,fx,3 4
Dialogue: 0,0:00:02.00,0:00:03.00,CN,,0,0,0,fx,3 5
Dialogue: 0,0:00:02.00,0:00:03.00,CN,,0,0,0,fx,3 1
Dialogue: 0,0:00:02.00,0:00:03.00,CN,,0,0,0,fx,3 0
Dialogue: 0,0:00:02.00,0:00:03.00,CN,,0,0,0,fx,3 9
Dialogue: 0,0:00:02.00,0:00:03.00,CN,,0,0,0,fx,3 7
Dialogue: 0,0:00:02.00,0:00:03.00,CN,,0,0,0,fx,3 1
Dialogue: 0,0:00:02.00,0:00:03.00,CN,,0,0,0,fx,3 9
Dialogue: 0,0:00:02.00,0:00:03.00,CN,,0,0,0,fx,3 2
如果要让num也做到每行重新计算的话,应该要跟循环计数器j关联起来,写个for循环。