Page 1 of 1

Cause I'm an asshole

Posted: Tue Jun 02, 2009 1:18 pm
by M_D_K
So I got bored and made a lua xchat script that converts what you type into l33t before sending to the server.

Code: Select all

local script_name = "l33tzorz.lua";
local script_desc = "just to fuck with people";
local script_ver = "0.1";

rep_list = { "ate", "you", "a", "o", "i", "for", "w", "e", "u", "t"}
rep_rep =  { "8", "j00", "4", "0", "1", "4or", "W","E","U", "T"}
rep_alt = { "8", "u", "A", "O", "I", "f0r", "\\/\\/", "3", "u", "+"}

function replace(String)
	str = String;
	rep_count = 0;
	if string.find(str, "!!") ~= 1 then
		for i = 1, #rep_list do
			str,count = string.gsub(str, rep_list[i],
						math.random(2) == 2 and rep_rep[i] or rep_alt[i], string.len(String));
			rep_count = rep_count + count;
		end
	end
	return str,rep_count;
end

function me(word, word_eol)
	word_eol[2],count = replace(word_eol[2]);
	if count > 0 then
		xchat.commandf("me %s", word_eol[2]);
		return xchat.EAT_ALL;
	end
	return xchat.EAT_NONE;
end

function leetme(word, word_eol)
	word_eol[1],count = replace(word_eol[1]);
	if count > 0 then
		xchat.commandf("say %s", word_eol[1]);
		return xchat.EAT_ALL;
	end
	return xchat.EAT_NONE;
end

function xchat_register()
	return script_name, script_desc, script_ver;
end

function xchat_init()
	xchat.hook_command("", "leetme", xchat.PRI_NORM);
	xchat.hook_command("me", "me", xchat.PRI_NORM);
end
Needless to say I was really bored and that avansc hated it :lol:

Re: Cause I'm an asshole

Posted: Tue Jun 02, 2009 9:24 pm
by MadPumpkin
haha thats awesome dude i should totally use it

Re: Cause I'm an asshole

Posted: Tue Jun 02, 2009 9:58 pm
by eatcomics
That's nice :lol: You must have been reeeeeaaaaally bored...

Re: Cause I'm an asshole

Posted: Thu Jun 04, 2009 9:31 am
by RyanPridgeon
Somebody please delete this thread to save us alot of pain and grief

Re: Cause I'm an asshole

Posted: Sun Sep 20, 2009 3:42 pm
by M_D_K
boredom strikes again, I just modified my l33tzorz script to convert to morse code minimal changes had to be made.

Code: Select all

local script_name = "morse.lua";
local script_desc = "converts text to morse code";
local script_ver = "0.1";

rep_morse = { ".- ", "-... ", "-.-. ", "-.. ", ". ", "..-. ", "--. ", ".... ", 
	     ".. ", ".--- ", "-.- ", ".-.. ", "-- ", "-. ", "--- ", ".--. ", "--.- ", 
	     ".-. ", "... ", "- ", "..- ", "...- ", ".-- ", "-..- ", "-.-- ", "--.. ", 
	     ".---- ", "..--- ", "...-- ", "....- ", "..... ", "-.... ", "--... ", "---.. ",
	     "----. ", "----- "}
rep_str = {"a", "b", "c", "d", "e", "f", "g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v",
	   "w", "x","y","z","1","2","3","4","5","6","7","8","9","0"}

function replace(String)
	str = String;
	rep_count = 0;
	if string.find(str, "!!") ~= 1 then
		str = string.lower(str);
		str = string.gsub(str, " ", "*|*"); --this stops xchat going into an event infinite loop
		for i = 1, #rep_morse do
			str,count = string.gsub(str, rep_str[i], rep_morse[i],string.len(String));
			rep_count = rep_count + count;
		end
	end
	return str,rep_count;
end

function me(word, word_eol)
	word_eol[2],count = replace(word_eol[2]);
	if count > 0 then
		xchat.commandf("me %s", word_eol[2]);
		return xchat.EAT_ALL;
	end
	return xchat.EAT_NONE;
end

function morse_me(word, word_eol)
	word_eol[1],count = replace(word_eol[1]);
	if count > 0 then
		word_eol[1] = string.gsub(word_eol[1], "*|*", "  ");
		xchat.commandf("say %s", word_eol[1]);
		return xchat.EAT_ALL;
	end
	return xchat.EAT_NONE;
end

function xchat_register()
	return script_name, script_desc, script_ver;
end

function xchat_init()
	xchat.hook_command("", "morse_me", xchat.PRI_NORM);
	xchat.hook_command("me", "me", xchat.PRI_NORM);
end

Re: Cause I'm an asshole

Posted: Sun Sep 20, 2009 3:46 pm
by Pickzell
Now that is awesome. :worship:

Also I have a question: lua looks like pascal, since I've never used lua before should I learn pascal first?

Re: Cause I'm an asshole

Posted: Sun Sep 20, 2009 3:58 pm
by Falco Girgis
Pickzell wrote:Now that is awesome. :worship:

Also I have a question: lua looks like pascal, since I've never used lua before should I learn pascal first?
Oh my god, no.

Re: Cause I'm an asshole

Posted: Sun Sep 20, 2009 4:03 pm
by M_D_K
GyroVorbis wrote:
Pickzell wrote:Now that is awesome. :worship:

Also I have a question: lua looks like pascal, since I've never used lua before should I learn pascal first?
Oh my god, no.
I agree just learn lua you don't need a background in pascal(it's probably not even recommended).

Re: Cause I'm an asshole

Posted: Sun Sep 20, 2009 4:23 pm
by Pickzell
Ok, thanks. :)