--// Lua Rocks. --// StabBot for BCDC++ --// what can i say.. i was bored... --// Tested in BCDC++ 0.403a dcpp:setListener( "chat", "tryg", --//!!!!If running more than one of this script... change "tryg" to something unique for each instance. function( hub, user, text ) --//modified the startup.lua to send "ownChat" as "chat". this is so the perosn running the script can use it too. it will run without mod'ing the startup.lua but ignore the person running it. --//!!!see the very bottom for startup.lua mods..... --------------VARIABLES THAT NEED TO BE FILLED!!!!!!!----------------------- local HubName = "" --//Folder name data will be saved in. data goes to [DC Folder]\data\[HubName]\ local HubRawName = "" --//searches for this in the hub:gethubname().. if it's not found.. it won't work in that hub. local BotName = "" --//the name of the bot you will send the stabs via pm to be posted in main through. local BotPostName = "" --//the name that will say the stab in the main... local MyNick = "" --//this is needed for sending pm's to the bot and should be your nick in the hub the stab works in. local BotCommand = "" --// the command to say stuff in the main as another nick... ie: !say ---------------------------------------------------------------------------- --////RANDOM NAME FUNCTION\\\\-------------------- local randomName = function(tbl) local n = 0 table.foreach( tbl, function() n = n + 1 end ) --//get the number of usernames in the ._users table n = math.random( n ) --//generate a random number within range of ._users list table for k,v in tbl do if n == 1 then return k end n = n - 1 end end --////SAVE Data FUNCTION\\\\---------------------- local saveData = function(saveHub, saveNick, saveOtherNick ) local saveTable = {} local savestring = "" local saveFiles = {"data/"..saveHub.."/_StabTally_"..saveHub..".txt", "data/"..saveHub.."/"..saveNick..".txt", "data/"..saveHub.."/_StabGrandTotal_"..saveHub..".txt" } for key, value in saveFiles do local f,e = io.open( value, "a+" ) --//Error handle.. makes sure files and dir exist... if f then f:write( "" ) f:close() else --// and if they don't.. make them... and the path. os.execute("mkdir \"data\\"..saveHub.."\\\""); local f,e = io.open( value, "a+" ) f:write( "" ) f:close() end end ------------------------- for line in io.lines("data/"..saveHub.."/_StabTally_"..saveHub..".txt") do --//load the total stab tally and put the data in a table local s,e, nam, kou = string.find(line, "([%S+_%s+_.+_%w+]+) = (%d+)") if nam ~= nil then saveTable[nam] = kou end end if saveTable[saveNick] == nil then saveTable[saveNick] = 1 else saveTable[saveNick] = saveTable[saveNick] + 1 end for key,value in saveTable do --//table to string. (My own rendition) savestring = savestring..key.." = "..value.."\r\n" end local f,e = io.open( "data/"..saveHub.."/_StabTally_"..saveHub..".txt", "w+" ) f:write( savestring ) f:close() savestring = "" saveTable = {} ------------------------- for line in io.lines("data/"..saveHub.."/"..saveNick..".txt") do --//load the personal stab tally file and put the data in a table local s,e, nam, kou = string.find(line, "([%S+_%s+_.+_%w+]+) = (%d+)") if nam ~= nil then saveTable[nam] = kou end end if saveTable[saveOtherNick] == nil then --//look for the entry and update it. saveTable[saveOtherNick] = 1 else saveTable[saveOtherNick] = saveTable[saveOtherNick] + 1 end for key,value in saveTable do --//table to string. (My own rendition) savestring = savestring..key.." = "..value.."\r\n" end local f,e = io.open( "data/"..saveHub.."/"..saveNick..".txt", "w+" ) f:write( savestring ) f:close() savestring = "" saveTable = {} ------------------------- for line in io.lines("data/"..saveHub.."/_StabGrandTotal_"..saveHub..".txt") do --//load the total count file and put the data in a table local s,e, nam, kou = string.find(line, "([%S+_%s+_.+_%w+]+) = (%d+)") if nam ~= nil then saveTable[nam] = kou end end if saveTable["DeathCount"] == nil then saveTable["DeathCount"] = 1 else saveTable["DeathCount"] = saveTable["DeathCount"] + 1 end for key,value in saveTable do --//table to string. (My own rendition) savestring = savestring..key.." = "..value.."\r\n" end local f,e = io.open( "data/"..saveHub.."/_StabGrandTotal_"..saveHub..".txt", "w+" ) f:write( savestring ) f:close() savestring = "" saveTable = {} end ------------------------- local hubnameraw = string.lower( hub:getHubName() ) --// hub name if string.find ( hubnameraw, HubRawName ) then --//only works in the hub specified. --//Start Listening for Trigs\\\\----------------- if string.find( text, "%pstab$") and string.len(text) == 5 or string.find( text, "^%pstab .+") and string.find( text, "^%p?stabhappy") ~= 1 then --//basically any punctuation and 'stab' ~!@#$%^&*()_,.+-={}[]:;"'> "..BotCommand.." "..BotPostName.." "..final.."|" ) --//send pm to yhub bot via raw message to say the stab in the main.(note: a '+msay' command was set up using the text files in yhub.. the normal say command would work as well) saveData( HubName, stabber, stabbed ) --//Save all data end --//close the if for stabing... ------------------------- if string.find( text, "^%p+deaths") and string.len(text) == 7 then --//listen for totalstab count request local requestString = "" local requestTable = {} local filer = ("data/"..HubName.."/_StabGrandTotal_"..HubName..".txt") local f,e = io.open( filer, "a+" ) if f then f:write( "" ) f:close() else os.execute("mkdir \"data\\"..HubName.."\\\""); local f,e = io.open( filer, "a+" ) f:write( "" ) f:close() end for line in io.lines(filer) do local s,e, na, ko = string.find(line, "([%S+_%s+_.+_%w+]+) = (%d+)") if na ~= nil then DC():SendHubMessage( hub:getId(), "$To: "..BotName.." From: "..MyNick.." $<"..MyNick.."> "..BotCommand.." "..BotPostName.." *** The death count is: "..ko..". ***|" ) --//send pm to yhub bot via raw message dispay the stab count end end end --//close the if for stab count deaths request.. ------------------------- if string.find( text, "^%p+stabhappy") and string.len(text) == 10 then --//listen for hubstab count request local requestString = "" local requestTable = {} local filer = ("data/"..HubName.."/_StabTally_"..HubName..".txt") local f,e = io.open( filer, "a+" ) if f then f:write( "" ) f:close() else os.execute("mkdir \"data\\"..HubName.."\\\""); local f,e = io.open( filer, "a+" ) f:write( "" ) f:close() end for line in io.lines(filer) do local s,e, na, ko = string.find(line, "([%S+_%s+_.+_%w+]+) = (%d+)") if na ~= nil then requestTable[na] = ko end end counting = 0 for key,value in requestTable do counting = counting +1 if counting < 5 then requestString = requestString..key.." = "..value.." " else requestString = requestString..key.." = "..value.."\r\n" counting = 0 end end DC():SendHubMessage( hub:getId(), "$To: "..BotName.." From: "..MyNick.." $<"..MyNick.."> "..BotCommand.." "..BotPostName.." \r\n*** Stab Usage for the hub... (how many times each person used the command)***".. "\r\n_________________________________________________________________________\r\n"..requestString.. "\r\n_________________________________________________________________________|" ) --//send pm to yhub bot via raw message dispay the stab count end --//close the if for hub stabs stabhappy count request.. ------------------------- if string.find( text, "^%p+mystabs") and string.len(text) == 8 then --//listen for mystabs count request local requestString = "" local requester = user:getNick() local requestTable = {} local filer = ("data/"..HubName.."/"..requester..".txt") local f,e = io.open( filer, "a+" ) if f then f:write( "" ) f:close() else os.execute("mkdir \"data\\"..HubName.."\\\""); local f,e = io.open( filer, "a+" ) f:write( "" ) f:close() end for line in io.lines(filer) do local s,e, na, ko = string.find(line, "([%S+_%s+_.+_%w+]+) = (%d+)") if na ~= nil then requestTable[na] = ko end end counting = 0 for key,value in requestTable do counting = counting +1 if counting < 5 then requestString = requestString..key.." = "..value.." " else requestString = requestString..key.." = "..value.."\r\n" counting = 0 end end DC():SendHubMessage( hub:getId(), "$To: "..BotName.." From: "..MyNick.." $<"..MyNick.."> "..BotCommand.." "..BotPostName.." \r\n***Personal Stab Usage for "..requester.."... (how many times you stabbed that person)***".. "\r\n_________________________________________________________________________\r\n"..requestString.. "\r\n_________________________________________________________________________|" ) --//send pm to yhub bot via raw message dispay the stab count end --//close the if for personal mystabs count request.. ------------------------- end --//close the if for the specified hub end --//close the function ) --//close the listener DC():PrintDebug( "*** Stab Bot Loaded...... STAB AWAY! ***" ) --////THE ANSWERS\\\\----------------------------- answer1 = { "*** [stbr] gets behind the wheel of a Volvo and back up over [stbd]'s dog. ***" , "*** [stbr] beats the shit out of [stbd]!*** " , "*** [stbr] swings an axe, trying to hit [stbd], but misses horibly. ***" , " ***[stbr] smacks [stbd] with a chicken. Farmer Lain comes out and shoves his pitchfork into [stbr]'s backside for bothering his chickens. ***" , "*** [stbr] fillets [stbd]'s body with a pointy bucket. Two points! ***" , " ***[stbr] shoves a porcupine into [stbd]'s pants, then beats the quills in with a small hammer ***" , "*** [stbr] tosses [stbd] into a pungee pit. The feces smeared onto the bamboo spikes then infects [stbd]'s body and turns it into icky mush ***" , "*** [stbr] borrows [rnduser]'s Magnum and shoots [stbd] in the foot*" , "*** [stbr] find the famed silver toothpick on the ground, the uses it to poke holes into [stbd], who then bleeds to death. Silver kills. ***" , "*** [stbr] brandishes the 'Fork of DOOM' and shoves it into [stbd]'s leg, then tugs sharply upward to [stbd]'s chest and lets all the innards falls out *** *plop* " , "*** [stbr] slips a spatula into [stbd]'s pants, then laughs ***" , "*** [stbr] places marbles gently into [stbd]'s ears, then beats them in with a hammer until they are deep in [stbd]'s skull ***" , "*** [stbr] fills [stbd]'s mouth full of marshmellows until [stbd] suffocates ***" , "*** [stbr] crams a can of Coke into [stbd]'s nose. Yummy. ***" , "*** [stbr] places a rusty nail under [stbd]'s foot. [stbd] steps on the nail, and in a matter of minutes develops gangrene and dies ***" , "*** [stbr] sneakily takes out a box cutter, and gently slits [stbd]'s throat ***" , "*** [stbr] combs [stbd]'s scalp with a razor comb ***" , "*** [stbr] smacks [stbd] with a fluffy pillow, and [stbd] smacks back with a lead pan ***" , "*** [stbr] tosses [stbd] into a pungee pit. The feces smeared onto the bamboo spikes then infects [stbd]'s body and turns it into icky mush ***" , "*** [stbr] stabs [stbd] with the blunt edge of a 'Happy Noodle Boy' action figure. Instant death! ***" , "*** [stbr] flings itching powder into [stbd]'s eyes, and watches as [stbd] digs their own eyes out ***" , "*** [stbr] fillets [stbd]'s body with a pointy bucket. Two points! ***" , "*** [stbr] slays [stbd] with a bag of poo ***" , "*** [stbr] stabs [stbd] in the eye and [stbd] howls in pain, clutching a bloody occular gash ***" , "*** [stbr] tucks [stbd] into bed, kisses [stbd] on the forehead, then begins to mechanically stab away with a kitchen knife ***" , "*** [stbr] splits [stbd]'s kneecaps with a hammer and stake ***" , "*** [stbr] catches [stbd] taking a library book, and then gives [stbd] a fatal beating. You scoundrel! ***" , "*** [stbr] pours popcorn down [stbd]'s throat, then puts [stbd] on the stove. The popcorn heats up and explodes, ripping [stbd] apart, and sending out a lovely blood covered treat for all the happy people of the hub ***" , "*** [stbr] goes into a malevolent fury and skins [stbd] with a potato peeler ***" , "*** [stbr] decapitates [stbd], then throws the head in a blender and makes pretty smoothies for everyone. Yay! ***" , "*** [stbr] licks [stbd]'s skin off. With a power-sander. Grind-y... ***" , "*** [stbr] pinches [stbd], and then [stbd] licks [stbr]'s cheek. It's love! ***" , "*** [stbr] shoves a porcupine into [stbd]'s pants, then beats the quills in with a small hammer ***" , "*** [stbr] stabs [stbd] repeatedly with a toothpick ***" , "*** [stbr] pulls out a longsword and swings it at [stbd], causing all of [stbd]'s limbs to suddenly dissapear. ***" , "*** [stbr] sets loose a ferocious cat-girl on [stbd] who maims [stbd] completely to death ***" , "*** [stbr] sets loose a ferocious cat-girl on [stbd], but the cat-girl leaps back and licks [stbr] passionately ***" , "*** [stbr] pours boiling b33r into [stbd]'s pants, as neither coffee nor tea should be wasted ***" , "*** [stbr] cannot decide if [stbd] should be made into soup or into steaks, so [stbd] is simply carved up with a spork and eaten, somehow. The best of both worlds... ***" , "*** [stbr] spins the bottle, which lands on [stbd]. [stbr] takes a Magnum and pops a bullet into [stbd]'s head. Everybody wins! ***" , "*** [stbr] stabs [stbd] with a kookie crumb ***" , "*** [stbr] loads paintball gun with liquid nitrogen pellets... and shoots [stbd] repeatedly until they are frozen, and then creams them with a hammer, shattering them into a million messy slivers ***" , "*** [stbr] carves up [stbd]'s head with a flesching knife, then puts a large candle in it so that the eyes glow. Picking up the glowing skull, [stbr] throws it at [rnduser], shattering bone and tendons in a blaze of flying skulls ***" , "*** [stbr] digs out [stbd]'s throat with a fork, then eats it with some fava beans and a light chianti ***" , "*** [stbr] picks up Miiroku9 and uses his head as a battering ram to break down the gates of [stbd]'s house, and then uses Miiroku9's bloody remains as a gag so that [stbd] suffocates ***" , "*** [stbr] sneaks a thin slice of fugu meat into [stbd]'s lunch, and then waits 24 hours... ***" , "*** [stbr] jabs a long sharp pole into [stbd]'s back, to the left of the spine, just below the shoulderblades. [stbr] proceeds to jam the pole through [stbd]'s lungs, stomach, and various other internal organs, then starts to move it around... effectively tearing [stbd]'s innards to shreds ***" , "*** [stbr] throws a flesh eating banana-slug at [stbd]'s head. [stbd] runs around flailing and screaming '' Aaaah! Get it off me! Get it off me!'' Ironically, as soon as [stbd] manages to peel the slug off, they run off a cliff and fall to a much more painful death on the sharp jagged rocks below. ***" , "*** [stbr] runs and jumps 15 feet in the air screaming ''Pink pencil brain impaler!!!'' before jamming a neon pink art pencil into [stbd]'s eye and wiggling it around, thus making puree from their retarded synapses ***" , "*** [stbr] summons a band of Ninja Maccaroni to attack [stbd] then watches as [stbd] is turned to cheesy dust! ***" , "*** [stbr] kills [stbd] with an atomic weggie! ***" , "*** [stbr] tortures [stbd] to death with Duran Duran! ***" , "*** [stbr] feeds [stbd] a can of beans, 2 burritos, and a Texas Omelette, then straps a torch to [stbd]'s ass & watches the fireworks! ***" , "*** [stbr] straps [stbd] to a soon-to-be-launched space rocket & christens [stbd] with an empty champagne bottle. hey, who'd want to waste a full one? ***" , "*** [stbr] wanted to stab [stbd].... but instead we'll just say ****[rnduser] Sucks Balls!!****" , "*** [stbr] tries to zap [stbd] with an Alien Death Ray, but it backfires and blows [stbr] into oblivion! ***" , "*** In recent news, [stbr] has became the latest victim of the Micheal Jackson molestation. [stbd] laughs. ***" , "*** [stbr] disguises [stbd] as a 12-yr-old boy & sends him to Michael Jackson's home. [stbd] returns 3 hours later with their pride removed and a REALLY sore ass. ***" , "*** [stbr] beats [stbd] to death with the Sunday New York Times. You can be sure it was slow & painful. ***" , "*** [stbd] is killed by a diesel-powered dildo. ouch! ***" , "*** [stbr] shoves 100 Twinkies down [stbd]'s throat. [stbd] dies from heart failure in conjunction with chemical overload. ***" , "*** [stbr] uploads DC++k CDM to [stbd]. [stbd] becomes enraged by the client's constant crashing & fuckups that they go mad and jump off a cliff. DC++ kills. ***" , "*** [rnduser] tags [stbr] into the match... [stbr] climbs to the third rope and does a flying drop-kick to [stbd]'s head! ***" }--//this is the end of the answers... --//this is the end of the script... haha :D --//You have to edit 3 lines in the startup.lua if you want THIS script to recognize the person running the script. --//Currently there is nothing default else using the "ownChat" listener. So the mods shouldn't effect anything else. (BCDC.403) --//THE SCRIPT WILL RUN FINE WITHOUT CHANGING THE STARTUP.LUA! but the person running it can't use the commands. --//BACK-UP YOUR STARTUP.LUA BEFORE CHANGING ANYTHING. --//Change Startup.Lua Line 327 From: for k,f in dcpp:getListeners( "ownChat" ) To: for k,f in dcpp:getListeners( "chat" ) --//Change Startup.Lua Line 328 From: ret = f( this, text, ret ) or ret To: ret = f( this, user, text, ret ) or ret\ --//Change Startup.Lua Line 448 From: return h:onChatFromSelf( text ) To: return h:onChatFromSelf( h:getUser( nick ), text ) --// OR --//ANOTHER way to do it is to comment out lines 445,447,448, & 449. (put "--" at the begining of those lines) BCDC++ 0.403a