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