Advertisement
Guest User

.vbs AI Script

a guest
Jun 23rd, 2019
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Randomize()
  2. blnStartOneWord = True
  3. blnForceWordNumLetters = True
  4.  
  5. Function NumWords(filename)
  6.     Dim objFile, strLine
  7.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  8.     Set objFile= objFSO.OpenTextFile(filename, 1)
  9.     Do While Not objFile.AtEndOfStream
  10.         strLine = objFile.readline
  11.         'WScript.Echo strLine
  12.         intNumLines = intNumLines + 1
  13.     Loop
  14.     objFile.Close
  15.     NumWords = intNumLines
  16. End Function
  17.  
  18. Function GetWord(filename,word_id)
  19.     Dim objFile, strLine
  20.     Dim objFSO: Set objFSO = CreateObject("Scripting.FileSystemObject")
  21.     Set objFile= objFSO.OpenTextFile(filename, 1)
  22.     Do While Not objFile.AtEndOfStream
  23.         intNumLines = intNumLines + 1
  24.         strLine = objFile.readline
  25.        
  26.         If intNumLines = word_id Then
  27.             GetWord = strLine
  28.             Exit Function
  29.         End If
  30.        
  31.     Loop
  32.     objFile.Close
  33. End Function
  34.  
  35. Function MakeWord(intNumLetters)
  36.  
  37.     If blnStartOneWord = True Then
  38.  
  39.         If blnForceWordNumLetters = True Then
  40.  
  41.             For x = 1 To intNumLetters
  42.                 intCharNum = Int((Rnd * 26) + 1)
  43.                 strLetter = chr(123 - intCharNum)
  44.                 intWordID = Int((Rnd * NumWords("words\" & strLetter & ".txt")) - 1)
  45.                 strWords = strWords & GetWord("words\" & strLetter & ".txt",intWordID) & " "
  46.             Next
  47.            
  48.         End If
  49.  
  50.     End If
  51.  
  52.     intChoiceSayInfo = Int((Rnd * 3) - 1)
  53.  
  54.     If intChoiceSayInfo = -1 Then
  55.         'MsgBox "no"
  56.         'Exit Function     
  57.         MakeWord(intNumLetters + 1)
  58.     ElseIf intChoiceSayInfo = 0 Then
  59.         'MsgBox "maybe"
  60.         'Exit Function
  61.         MakeWord(intNumLetters + 1)
  62.     ElseIf intChoiceSayInfo = 1 Then
  63.         'MsgBox "yes " & strWord
  64.         MsgBox strWords
  65.     End If
  66.  
  67. End Function
  68.  
  69. MakeWord(1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement