Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "luacom"
- local skype = assert(luacom.CreateObject("Skype4COM.Skype"), "Failed to create skype object")
- local chats = {}
- for i,v in luacom.pairs(skype.ActiveChats) do
- table.insert(chats, skype:Chat(v.Name))
- end
- table.insert(chats, {FriendlyName="Testing", SendMessage=function(self, msg) print(msg) end})
- print("Chats:")
- for i,v in pairs(chats) do
- print(i..": "..v.FriendlyName)
- end
- io.write("chat #> ")
- local chat = chats[tonumber(io.read())]
- print("Chose "..chat.FriendlyName)
- local syntax = {
- ["start"] = {
- "have you ever !v",
- "have you ever been arrested for !ving"
- },
- ["v"] = {
- "decided to !vpres",
- "met !name",
- "went though !con",
- "found !n !con",
- "lost !n !con",
- "buffaloed !n !con",
- "ate !n !con",
- },
- ["vpres"] = {
- "open !n !con",
- "explode !con",
- "buffalo !n !con",
- "eat !n !con",
- },
- ["ving"] = {
- "running !con",
- "flying !con",
- "stealing !n !con",
- "buffaloing !n !con"
- },
- ["n"] = {
- "a key to !n",
- "a different universe",
- "a door",
- "some monster",
- "balloons",
- "buffalos",
- "buffalo buffalos",
- "elephants",
- "flamingos",
- "crackers",
- "computers",
- },
- ["con"] = {
- "while !n !v",
- "then !n !v",
- "but then !n !v",
- "and then !n !v",
- "until !n !v",
- "so !n !v",
- },
- ["name"] = {
- "a guy named bob",
- "jesus",
- "jegus",
- }
- }
- function randphrase()
- local function rbuild(str)
- if math.random(1, 10) == 1 and str:find("!con$") then
- return str:gsub("!([^%s]+)", "")
- else
- return str:gsub("!([^%s]+)",
- function(m)
- return rbuild(syntax[m][math.random(#syntax[m])]) .. " "
- end
- )
- end
- end
- return rbuild("!start"):gsub("%s+", " ")
- end
- math.randomseed(os.time())
- while true do
- io.read()
- local phrase = randphrase()
- print(phrase)
- chat:SendMessage(phrase)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement