Cause I'm an asshole

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

Post Reply
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Cause I'm an asshole

Post 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:
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
MadPumpkin
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 484
Joined: Fri Feb 13, 2009 4:48 pm
Current Project: Octopia
Favorite Gaming Platforms: PS1-3, Genesis, Dreamcast, SNES, PC
Programming Language of Choice: C/++,Java,Py,LUA,XML
Location: C:\\United States of America\Utah\West Valley City\Neighborhood\House\Computer Desk

Re: Cause I'm an asshole

Post by MadPumpkin »

haha thats awesome dude i should totally use it
While Jesus equipped with angels, the Devil's equipped with cops
For God so loved the world that he blessed the thugs with rock
Image
Image
Image
User avatar
eatcomics
ES Beta Backer
ES Beta Backer
Posts: 2528
Joined: Sat Mar 08, 2008 7:52 pm
Location: Illinois

Re: Cause I'm an asshole

Post by eatcomics »

That's nice :lol: You must have been reeeeeaaaaally bored...
Image
User avatar
RyanPridgeon
Chaos Rift Maniac
Chaos Rift Maniac
Posts: 447
Joined: Sun Sep 21, 2008 1:34 pm
Current Project: "Triangle"
Favorite Gaming Platforms: PC
Programming Language of Choice: C/C++
Location: UK
Contact:

Re: Cause I'm an asshole

Post by RyanPridgeon »

Somebody please delete this thread to save us alot of pain and grief
Ryan Pridgeon
C, C++, C#, Java, ActionScript 3, HaXe, PHP, VB.Net, Pascal
Music | Blog
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: Cause I'm an asshole

Post 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
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
Pickzell
Chaos Rift Junior
Chaos Rift Junior
Posts: 233
Joined: Sat May 16, 2009 10:21 am

Re: Cause I'm an asshole

Post 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?
I'm an altogether bad-natured Cupid.
User avatar
Falco Girgis
Elysian Shadows Team
Elysian Shadows Team
Posts: 10294
Joined: Thu May 20, 2004 2:04 pm
Current Project: Elysian Shadows
Favorite Gaming Platforms: Dreamcast, SNES, NES
Programming Language of Choice: C/++
Location: Studio Vorbis, AL
Contact:

Re: Cause I'm an asshole

Post 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.
User avatar
M_D_K
Chaos Rift Demigod
Chaos Rift Demigod
Posts: 1087
Joined: Tue Oct 28, 2008 10:33 am
Favorite Gaming Platforms: PC
Programming Language of Choice: C/++
Location: UK

Re: Cause I'm an asshole

Post 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).
Gyro Sheen wrote:you pour their inventory onto my life
IRC wrote: <sparda> The routine had a stack overflow, sorry.
<sparda> Apparently the stack was full of shit.
User avatar
Pickzell
Chaos Rift Junior
Chaos Rift Junior
Posts: 233
Joined: Sat May 16, 2009 10:21 am

Re: Cause I'm an asshole

Post by Pickzell »

Ok, thanks. :)
I'm an altogether bad-natured Cupid.
Post Reply