HiroMacro - 如何设置随机时间(睡眠)
HiroMacro - how to setup random times (sleep)
我正在 this language 中使用此应用。
在上面的 link 中,我指的是第 4.2.8 和 4.2.13 点。我想将这 2 位代码合并在一起。
如何随机安排睡眠?
例如:
我想点击按钮 1,然后点击按钮 2。
button1 和 button2 之间的时间需要在 1 到 10 秒之间随机选择。
这是我能找到的所有内容:
rand sleep 1000 10000
或
Sleep math.random(1000,10000)
这行得通吗?
到目前为止我有
:start
touchdown 0 12 123
touchMove 0 12 123 //this part is clicking Button 1
var #sleepTime 0
rand #sleepTime 1000 10000
sleep #sleepTime
// The code you provided to randomly wait between 1 and 10
seconds
touchdown 0 12 145
touchMove 0 12 145
//this part is clicking Button 2
:end
你需要写:
var #sleepTime 0
rand #sleepTime 1000 10000
sleep #sleepTime
使用您的代码和文档中的示例
(在使用 ':start 之前声明变量)
var #sleepTime 0
:start
rand #sleepTime 1000 10000
touchPress 0 100 200
sleep #sleepTime
touchPress 1 200 200
:end
我认为您可能需要使用 touchPress
来模拟按下按钮。
我正在 this language 中使用此应用。
在上面的 link 中,我指的是第 4.2.8 和 4.2.13 点。我想将这 2 位代码合并在一起。
如何随机安排睡眠?
例如:
我想点击按钮 1,然后点击按钮 2。
button1 和 button2 之间的时间需要在 1 到 10 秒之间随机选择。
这是我能找到的所有内容:
rand sleep 1000 10000
或
Sleep math.random(1000,10000)
这行得通吗?
到目前为止我有
:start
touchdown 0 12 123
touchMove 0 12 123 //this part is clicking Button 1
var #sleepTime 0
rand #sleepTime 1000 10000
sleep #sleepTime
// The code you provided to randomly wait between 1 and 10
seconds
touchdown 0 12 145
touchMove 0 12 145
//this part is clicking Button 2
:end
你需要写:
var #sleepTime 0
rand #sleepTime 1000 10000
sleep #sleepTime
使用您的代码和文档中的示例 (在使用 ':start 之前声明变量)
var #sleepTime 0
:start
rand #sleepTime 1000 10000
touchPress 0 100 200
sleep #sleepTime
touchPress 1 200 200
:end
我认为您可能需要使用 touchPress
来模拟按下按钮。