2
;Sayings
friendly := ["hello there!", "Howdy!", "Greetings friend!", "hi there"]
helpful := ["x next to y and z", "this is helpful", "The sky is blue"]
other := ["where is my toaster", "do it", "just"]
;Categories
welcome := [[friendly][helpful][other]]
Numpad0::
intotext(randomfromarray("friendly"),50,35,15)
return
Numpad1::
intotext(randomfromarray("helpful"),50,35,15)
return
;Numpad2::
;Select a random saying from the welcome category.
intotext(whatisit,thekeydelay,introwait,outrowait)
{
SetKeyDelay, thekeydelay
Send, t
Sleep, %introwait%
Send, %whatisit%
Sleep, %outrowait%
Send, {enter}
}
randomfromarray(uniquepickof){
return %uniquepickof%[random(1, %uniquepickof%.maxindex())]
}
random(x, y){
Random, var, %x%, %y%
return var
}
- 有人可以帮我找出(用于NUMPAD2::)如何从Welcome类随机熟语阵列,然后选择(说)阵列的随机指标?
我试着抛出一些想法,但它们都是只有“t”,因为我没有正确返回(pick random array)[index]值。如何选择一个随机数组,然后在THAT数组中选择一个随机索引?
谢谢!我修改了一些东西,并将一个(类别)arg添加到randomfromarray中,并将if语句返回给randarray [randsaying]。 \t如果猫{ \t \t随机,RAND 1,1,%独特%.maxIndex() \t \t randArray:=%独特%[RAND 1] \t \t随机,randSaying,1,randArray.MaxIndex()\t \t \t return randArray [randSaying] \t} – SimpleDudeX
太棒了!我有一个关于你的代码的问题:你有什么'intotext'函数?当我正在处理脚本时,我做了一些非常奇怪的事情,所以我不得不对它进行评论,直到我完成 –
intotext是一种将所选语句键入游戏文本框的功能,打开聊天框的热键是发送“t”,等待时间延迟。 – SimpleDudeX