Randomize a little more
This commit is contained in:
14
Yapper.lua
14
Yapper.lua
@@ -1,9 +1,12 @@
|
||||
local addonname, data = ...
|
||||
---@cast addonname string
|
||||
local channelNameLength = 8
|
||||
local messageLength = 32
|
||||
local messageLengthLowerBound = 12
|
||||
local messageLengthUpperBound = 47
|
||||
local lowerBound = 53
|
||||
local upperBound = 77
|
||||
local asciiStart = 97
|
||||
local asciiEnd = 122
|
||||
|
||||
local function GetChannelId(channelName)
|
||||
local channels = { GetChannelList() }
|
||||
@@ -17,16 +20,17 @@ local function GetChannelId(channelName)
|
||||
end
|
||||
|
||||
local function GenerateString(length)
|
||||
print(string.format("Generating string of length %d", length))
|
||||
local string = ""
|
||||
for i = 1, length do
|
||||
string = string .. string.char(math.random(97, 122))
|
||||
string = string .. string.char(math.random(asciiStart, asciiEnd))
|
||||
end
|
||||
return string
|
||||
end
|
||||
local channelName = GenerateString(channelNameLength)
|
||||
|
||||
local function Yap()
|
||||
local message = GenerateString(messageLength)
|
||||
local message = GenerateString(math.random(messageLengthLowerBound, messageLengthUpperBound))
|
||||
print(string.format("YAPPING %s", tostring(message)))
|
||||
|
||||
local channelId = GetChannelId(channelName)
|
||||
@@ -44,9 +48,7 @@ end
|
||||
local function init()
|
||||
JoinTemporaryChannel(channelName)
|
||||
print(string.format("Yapper joined %s", tostring(channelName)))
|
||||
local delay = math.random(lowerBound, upperBound)
|
||||
print(string.format("Yapper yapping in %d seconds", delay))
|
||||
C_Timer.After(delay, Yap)
|
||||
Yap()
|
||||
end
|
||||
|
||||
local loadedFrame = CreateFrame("Frame")
|
||||
|
Reference in New Issue
Block a user