PtokaX forum

Development Section => Your Developing Problems => Topic started by: Typhoon on 30 March, 2004, 19:21:16

Title: Kenny.script
Post by: Typhoon on 30 March, 2004, 19:21:16
i am making a kenny script , but i seem to have an error or something . no error in ptokax , but scriot wont work !


-- Kenny script by Typhoon? / Ratcom_Typhoon?
-- 29/03-04
-- Idea from kepp, Which got the idea from Solian script Which got idea from ..... Y-Hub?
 

------------ things that can be changed

sBot = "[KENNY]"
ClockInterval = 5   -- clears table on specific minutes

----------- End

tKenny = {}
mins = 1000 * 60 * ClockInterval

function Main()
SetTimer(mins)
StartTimer()
end

function OnTimer()
clear()
end

function clear()
tKenny = nil
tKenny = {}
end

function DataArrival(user, data)
   if (strsub(data,1,1) == "<") then
  data=strsub(data,1,strlen(data)-1)
    s,e,cmd = strfind(data,"%b<>%s+(%S+)")
   
       if tKenny[user.sName] == 1 then
local RanKenny = random(23)
for i,v in tKenny do
if (RanKenny == 1) then
SendToAll(i,"*mflf* *lmmf* *uullu* *umfmm* *mumuff* *lmuul* *lluu* *mlmlff* *lfumfl* *umfl* *uuffum* *luuuuu* *ffll* *fmmuff* *mulfuf*") return 1
elseif (RanKenny == 2) then
SendToAll(i,"*umfl* *uuffum*") return 1
elseif (RanKenny == 3) then
SendToAll(i,"*lluu* *mlmlff* *umfl* *lfumfl* *umfl*") return 1
elseif (RanKenny == 4) then
SendToAll(i,"*lmmf* *uullu* *mmmm*") return 1
elseif (RanKenny == 5) then
SendToAll(i,"*ommlu* *uullu* *lmmf* *ommlu* *mflf*") return 1
elseif (RanKenny == 6) then
SendToAll(i,"*olomum* *lmmf* *mhhhmmlm*") return 1
elseif (RanKenny == 7) then
SendToAll(i,"*Mhhl* *mujm* *umfl*") return 1
elseif (RanKenny == 8) then
SendToAll(i,"*uullu* *wmuulmom* *grrrrr* *lmmf* *muhumom*") return 1
elseif (RanKenny == 9) then
SendToAll(i,"*lmmf* *uullu* *umfl*") return 1
elseif (RanKenny == 10) then
SendToAll(i,"*mummmmmmmmmm* *lmmf* *uullu* *mmmmmmmhmhm*") return 1
elseif (RanKenny == 11) then
SendToAll(i,"*mmjmmjhm* *oouummulool*") return 1
elseif (RanKenny == 12) then
SendToAll(i,"*mnnnmhm* *mmmuuhumom*") return 1
elseif (RanKenny == 13) then
SendToAll(i,"*mlmlolom* *oollooouuu* *mhmmhmhmh*") return 1
elseif (RanKenny == 14) then
SendToAll(i,"*hmehmehhme* *uullu* *mmmummmhum*") return 1
elseif (RanKenny == 15) then
SendToAll(i,"*mmmlllumlum* *ffll* *lmmf* *uullu*") return 1
elseif (RanKenny == 16) then
SendToAll(i,"*fhhmfm* *mhlllmlu*") return 1
elseif (RanKenny == 17) then
SendToAll(i,"*uullu* *mmmmumumumumooom* *lmmf*") return 1
elseif (RanKenny == 18) then
SendToAll(i,"*mumuff* *lmuul* *uullu* *Mhhl*") return 1
elseif (RanKenny == 19) then
SendToAll(i,"*lmmf* *uullu* *Mhhl*") return 1
elseif (RanKenny == 20) then
SendToAll(i,"*mhhmmmmmf* *uullu*") return 1
elseif (RanKenny == 21) then
SendToAll(i,"*hmmllf* *hmmmmmmhlhum*") return 1
elseif (RanKenny == 22) then
SendToAll(i,"*wmmmwhhhm* *looomulu*") return 1
elseif (RanKenny == 23) then
SendToAll(i,"*ghmmmm* *mmmhoum*") return 1
end
end
end
end
end

if cmd == "+kenny" and user.bOperator then
  DoKenny(user, data) return 1


       
elseif cmd == "+showkenny" and user.bOperator then
function Kenny()
local disp = ""
for index, value in tKenny do
local line = index
disp = disp.."\t ? "..line.."\r\n"
end
return disp
end
user:SendPM(sBot,"\r\n\r\n\t\t\t\t\t(? ?.??.->   These are the Kennylized   <-.??.???)\r\n\r\n"..Kenny().."|")
return 1

      elseif cmd == "+unkenny" and user.bOperator then
  DoUnKenny(user, data) return 1
      end




function UserDisconnected(user)
-- if tKenny[user.sName]==1 then
-- tKenny[user.sName]=nil;
-- end
end

function DoKenny(user, data)
local s,e,name = strfind(data,"%b<>%s+%S+%s+(%S+)")
vic = GetItemByName(name)
if vic ~= nil then
if tKenny[vic.sName]==nil then
tKenny[vic.sName]=1;
SendToAll(sBot,"How are you today "..vic.sName.." ? :D")
end
else
user:SendData(sBot,"There's no such user")
end
end

function DoUnKenny(user, data)
local s,e,name = strfind(data,"%b<>%s+%S+%s+(%S+)")
if tKenny[name]==1 then
tKenny[name]=nil;
SendToAll(sBot,name.." Is now back as a none kenny person.")
else
user:SendData(sBot,"There's no such user")
end
end





hope some can help :)
Title:
Post by: ??????Hawk?????? on 31 March, 2004, 01:53:06
try this one m8...

*edit* clears all kennys 5 mins after last kennylized user


 
 
 
 
-- Kenny Script by ??????Hawk??????
--  31-03-04
Bot = "Kenny"
kennytext = {
"*umfl* *uuffum*",
"*lluu* *mlmlff* *umfl* *lfumfl* *umfl*",
"*lmmf* *uullu* *mmmm*",
"*ommlu* *uullu* *lmmf* *ommlu* *mflf*",
"*olomum* *lmmf* *mhhhmmlm*",
"*Mhhl* *mujm* *umfl*",
}
Kennylizednicks = {}
mins = 1000 * 60 * 5


function OnTimer()
Kennylizednicks = {}
SendToAll(Bot, " all kennys have gone ! ! !")
StopTimer()
end


function DataArrival(user, data)
    if (strsub(data,1,1) == "<") then
    data=strsub(data,1,strlen(data)-1)
    s,e,cmd = strfind(data,"%b<>%s+(%S+)")
if user.bOperator then
      if (cmd=="+kenny") then
StopTimer()
SetTimer(mins)
StartTimer()
          kenylize(user, data)
return 1
      elseif (cmd=="+unkenny") then
          Unkenylize(user, data)
return 1
      elseif (cmd=="+showkenny") then
ShowKennys(user)
return 1
      elseif (cmd=="+unkennyall") then
Kennylizednicks = {}
          SendToAll(Bot, " all kennys have gone ! ! !")
return 1
      end
end
      if strsub(data,1,1) == "<" then
          if Kennylizednicks[user.sName] == 1 then
text=kennytext[random(1, getn(kennytext))]
SendToAll(user.sName, text)
return 1
          end
      end
    end
end

function kenylize(user, data)
local s,e,cmd,usr = strfind(data,"%b<>%s+(%S+)%s+(%S+)")
local kennyd = GetItemByName(usr)
    if kennyd == nil then
      user:SendData(Bot,"The User is not in the hub ! ! !")
      else
if Kennylizednicks[kennyd.sName] == nil then
          Kennylizednicks[kennyd.sName] = 1
          SendToAll(Bot,kennyd.sName.." Has been turned in to a Kenny Clone  ! ! !")
      end
    end
end

function Unkenylize(user, data)
local s,e,cmd,usr = strfind(data,"%b<>%s+(%S+)%s+(%S+)")
local kennyd = GetItemByName(usr)
    if kennyd == nil then
      user:SendData(Bot,"The User is not in the hub ! ! !")
    else
      if Kennylizednicks[kennyd.sName] == 1 then
          Kennylizednicks[kennyd.sName] = nil;
          SendToAll(Bot, kennyd.sName.." Has Returned ..")
      end
    end
end


function ShowKennys(user)
local names = ""
for index, value in Kennylizednicks do
local line = index
names = names.." "..line.."\r\n"
end
user:SendPM(Bot,"\r\n\r\nKennylised users..\r\n\r\n"..names)

end
Title:
Post by: NotRabidWombat on 31 March, 2004, 02:52:41
I thought I posted this script on this board.
sBotName = "KennyBot";

tNormalToKenny = {
"Mmm", "Mmp", "Mmf", "Mpm", "Mpp", "Mpf", "Mfm", "Mfp", "Mff", "Pmm",
"Pmp", "Pmf", "Ppm", "Ppp", "Ppf", "Pfm", "Pfp", "Pff", "Fmm", "Fmp",
"Fmf", "Fpm", "Fpp", "Fpf", "Ffm", "Ffp" };

tKennys = {};

base = strbyte("A") - 1;
-- After a month of leave, I forgot Lua tables are 1 based
-- This caused so MANY problems

function DataArrival(curUser, sData)
local s, e, sMessage, cmd, arg = strfind(sData, "^%b<> ((%S+)%s?(%S*)[^%|]*)%|$");

if(cmd == nil) then return; end

cmd = strlower(cmd);

if(cmd == "!kenny" and curUser.bOperator and tKennys[arg] == nil) then
-- TODO: add an operator check
tKennys[arg] = 1;
SendToAll(sBotName, curUser.sName.." has Kennylized "..arg);
return 1;
end

if(cmd == "!unkenny" and curUser.bOperator and tKennys[arg]) then
tKennys[arg] = nil;
SendToAll(sBotName, curUser.sName.." has unKennylized "..arg);
return 1;
end


if(tKennys[curUser.sName]) then
local sOutput = gsub(sMessage, "(%a)", ConvertLetter);

SendToAll(curUser.sName, sOutput);
return 1;
end
end

function ConvertLetter(letter)
if(letter == nil) then return; end

local mumble = tNormalToKenny[strbyte(strupper(letter)) - base];

if(strupper(letter) ~= letter) then
mumble = strlower(mumble);
end

return mumble;
end
It's based off of "official" kenny speak code. Found a site for it some time ago.

-NotRabidWombat
Title:
Post by: Typhoon on 31 March, 2004, 05:21:28
thx, to both Hawk and NotRabidwombat...

but i would still like to no were my bug is, since not knowing i wont learn by it til next time....
then maybe same bug and still not knowing, and had the table part planned, but no need when not functioning...
Title:
Post by: imby on 12 September, 2004, 00:57:48
the script NotRabidWombat pasted needs a correction. it only kennylizes letters typed. so one could put a space in front of what they type and it sends the whole thing out as normal.
Title:
Post by: bastya_elvtars on 12 September, 2004, 01:07:31
If you tel me what this script should do, maby i will make an update.
Title:
Post by: imby on 12 September, 2004, 01:41:33
It's the ptokax equivalent of the kenny command in y-hub. if you !kenny a user , it sould replace the text that they write these words:

wiith "Mmm", "Mmp", "Mmf", "Mpm", "Mpp", "Mpf", "Mfm", "Mfp", "Mff", "Pmm",
   "Pmp", "Pmf", "Ppm", "Ppp", "Ppf", "Pfm", "Pfp", "Pff", "Fmm", "Fmp",
   "Fmf", "Fpm", "Fpp", "Fpf", "Ffm", "Ffp" };


the bug is this: if they put a space before what they type, it sends their writing as they typed it. also non a-z charceters don't work either.
Title:
Post by: bastya_elvtars on 12 September, 2004, 01:47:06
sBotName = "KennyBot";


tNormalToKenny = {
"Mmm", "Mmp", "Mmf", "Mpm", "Mpp", "Mpf", "Mfm", "Mfp", "Mff", "Pmm",
"Pmp", "Pmf", "Ppm", "Ppp", "Ppf", "Pfm", "Pfp", "Pff", "Fmm", "Fmp",
"Fmf", "Fpm", "Fpp", "Fpf", "Ffm", "Ffp" };


tKennys = {};


base = strbyte("A") - 1;
-- After a month of leave, I forgot Lua tables are 1 based
-- This caused so MANY problems


function DataArrival(curUser, sData)
local s, e, sMessage, cmd, arg = strfind(sData, "^%b<>%s+((%S+)%s?(%S*)[^%|]*)%|$");


if(cmd == nil) then return; end


cmd = strlower(cmd);


if(cmd == "!kenny" and curUser.bOperator and tKennys[arg] == nil) then
-- TODO: add an operator check
tKennys[arg] = 1;
SendToAll(sBotName, curUser.sName.." has Kennylized "..arg);
return 1;
end


if(cmd == "!unkenny" and curUser.bOperator and tKennys[arg]) then
tKennys[arg] = nil;
SendToAll(sBotName, curUser.sName.." has unKennylized "..arg);
return 1;
end




if(tKennys[curUser.sName]) then
local sOutput = gsub(sMessage, "(%a)", ConvertLetter);


SendToAll(curUser.sName, sOutput);
return 1;
end
end


function ConvertLetter(letter)
if(letter == nil) then return; end


local mumble = tNormalToKenny[strbyte(strupper(letter)) - base];


if(strupper(letter) ~= letter) then
mumble = strlower(mumble);
end


return mumble;
end

Hope this helps...