User Control Panel
Advertisements

HELP US, HELP YOU!

Custom Emoticons

 
Post new topic   Reply to topic    Bot Depot Forum Index -> MSN.pm Development
View unanswered posts
Author Message
Siebe
God Like
God Like


Joined: 06 Jan 2004
Posts: 562
Location: Netherlands
Reputation: 39.8Reputation: 39.8Reputation: 39.8Reputation: 39.8

PostPosted: Sat Apr 03, 2004 7:16 pm    Post subject: Reply with quote

Ok, so first let me explain how CE's are being send..

First you need to make the MSNObjects for the images (just like with DP's), but only with the type set to 2. Then, when you want to display the emoticons in a message you need to send it's shortcut (the code you use which must be repalced with the emoticon) and the MSNObject so MSN know's what to request from you.

Now, I was wondering, what do you think is the easiest way to implent this? I was thinking something like this:

The user calls a sub like $self->custom_emotes("path/to/emotes"); in which the path is a <*lazy*>directory. The script then reads all files from the directory (if they are PNG's of course), and stores them in a hash.

Then, when someone wants to sends a message with custom emoticons he can feed it with null characters. So for example:

Code:
This -> \0:D\0 is a CE


The script will split the message on the null character and check if the strings are shortcuts. If so, it will load the msn object and send it in a special message. Of course it will also take out the null characters, so it would end up as

Quote:
This -> Very Happy is a CE


The MSNobjects have to be send in a specially crafted message send <*lazy*>before the normal message. It can contain only 5 different emoticons at max.
IMHO, this is by far the easiest way.. If you know something better please let me know..
Back to top
eric256
The Keymaker
The Keymaker


Joined: 03 May 2006
Posts: 2292
Location: Colorado
Reputation: 47Reputation: 47Reputation: 47Reputation: 47Reputation: 47

PostPosted: Sun Apr 04, 2004 3:55 pm    Post subject: Reply with quote

A bit slow but here is my input. Instead of registering the whole directory let the person do more like.

Code:
$msn->addEmoticon(":-)", "smile.png");


Then if they want \0 \0 around it they just do it there

Code:
$msn->addEmoticon("\0:-)\0", "smile.png");


Then the sendmsg just goes threw the hash that has "Smile" => "smile.png" and does the required replacement and sends the required emoticon on first. It could count how many it has done and automaticaly stop at 5. BTW is it five occurences? or can you have the same emoticon a bunch of times but only have five different ones in a message?

_________________
Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
Siebe
God Like
God Like


Joined: 06 Jan 2004
Posts: 562
Location: Netherlands
Reputation: 39.8Reputation: 39.8Reputation: 39.8Reputation: 39.8

PostPosted: Sun Apr 04, 2004 4:07 pm    Post subject: Reply with quote

You can have more than 5 occurences (try it in MSN, you'll see that you can send 5 different ones at max, but you CAN send those 5 multiple times).

Hmm, ok, I hadn't thought of if that way Smile
Anyways, so if the user sends something, MSN.pm will do this: (don't mind the syntax Wink)

for all hash elements {
if(message contains element) {
load emoticon
}
}
Back to top
eric256
The Keymaker
The Keymaker


Joined: 03 May 2006
Posts: 2292
Location: Colorado
Reputation: 47Reputation: 47Reputation: 47Reputation: 47Reputation: 47

PostPosted: Sun Apr 04, 2004 4:11 pm    Post subject: Reply with quote

Yep exactly what i was thinking.
_________________
Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
Siebe
God Like
God Like


Joined: 06 Jan 2004
Posts: 562
Location: Netherlands
Reputation: 39.8Reputation: 39.8Reputation: 39.8Reputation: 39.8

PostPosted: Sun Apr 04, 2004 4:12 pm    Post subject: Reply with quote

Okay, I'll mess with it a bit after dinner (-:
Back to top
Siebe
God Like
God Like


Joined: 06 Jan 2004
Posts: 562
Location: Netherlands
Reputation: 39.8Reputation: 39.8Reputation: 39.8Reputation: 39.8

PostPosted: Tue Apr 06, 2004 1:26 pm    Post subject: Reply with quote

Okay, here goes (-:
I've added custom emoticon support, and it works Razz

People can add custom emoticons like Eric said, but then with add_emoticon(, , );. A little screen shot:



And below is the new attached MSN.pm.
Let me know if there are problems so I can fix them Smile
Back to top
eric256
The Keymaker
The Keymaker


Joined: 03 May 2006
Posts: 2292
Location: Colorado
Reputation: 47Reputation: 47Reputation: 47Reputation: 47Reputation: 47

PostPosted: Tue Apr 06, 2004 2:29 pm    Post subject: Reply with quote

Whats the socket add for?
_________________
Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
Siebe
God Like
God Like


Joined: 06 Jan 2004
Posts: 562
Location: Netherlands
Reputation: 39.8Reputation: 39.8Reputation: 39.8Reputation: 39.8

PostPosted: Tue Apr 06, 2004 2:39 pm    Post subject: Reply with quote

$self->add_emoticon invokes this.

The user can call it as add_emoticon(, , ) or $self->(, ); Smile
Back to top
eric256
The Keymaker
The Keymaker


Joined: 03 May 2006
Posts: 2292
Location: Colorado
Reputation: 47Reputation: 47Reputation: 47Reputation: 47Reputation: 47

PostPosted: Tue Apr 06, 2004 2:43 pm    Post subject: Reply with quote

I don't understand why you are adding emoticons to an individual socket.
_________________
Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
Siebe
God Like
God Like


Joined: 06 Jan 2004
Posts: 562
Location: Netherlands
Reputation: 39.8Reputation: 39.8Reputation: 39.8Reputation: 39.8

PostPosted: Tue Apr 06, 2004 2:46 pm    Post subject: Reply with quote

You aren't, the $self will later on refer to the Master, not to individual sockets.
Back to top
eric256
The Keymaker
The Keymaker


Joined: 03 May 2006
Posts: 2292
Location: Colorado
Reputation: 47Reputation: 47Reputation: 47Reputation: 47Reputation: 47

PostPosted: Tue Apr 06, 2004 2:48 pm    Post subject: Reply with quote

Ahh okay.
_________________
Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
Siebe
God Like
God Like


Joined: 06 Jan 2004
Posts: 562
Location: Netherlands
Reputation: 39.8Reputation: 39.8Reputation: 39.8Reputation: 39.8

PostPosted: Tue Apr 06, 2004 2:51 pm    Post subject: Reply with quote

Yeah sorry for the confusion, but I'm not "used" to using $self-> constructs, I'd rather call a function by placing the variables in the () Wink .. Like the socket thing Razz
Back to top
eric256
The Keymaker
The Keymaker


Joined: 03 May 2006
Posts: 2292
Location: Colorado
Reputation: 47Reputation: 47Reputation: 47Reputation: 47Reputation: 47

PostPosted: Tue Apr 06, 2004 3:15 pm    Post subject: Reply with quote

There are advantages to the $self->add_emoticon("name","file") way though. For instance the MSN module doens't have to export any of its functions because the $self part is a ref to MSN so it knows to pretend that $self->add_emoticon is realy MSN::add_emoticon($self,"name","file");. Besides we are working with objects and thats the standard notation for objects.
_________________
Eric256
Proud previous owner and current admin of Bot-depot.com
Back to top
hacklen
Newbie
Newbie


Joined: 26 Feb 2006
Posts: 1

Reputation: 2.4Reputation: 2.4

PostPosted: Mon Feb 27, 2006 10:32 am    Post subject: HELP ME ERIC! Reply with quote

Smile
Back to top
Display posts from previous:   
Post new topic   Reply to topic    Bot Depot Forum Index -> MSN.pm Development All times are GMT
Page 1 of 1

 



Protected by phpBB Security phpBB-TweakS
phpBB Security Has Blocked 9 Exploit Attempts.
Antispam Captcha Mod by phpbb-security.com
Powered by phpBB © 2001, 2005 phpBB Group