Page Index Toggle Pages: [1] 2 3 4 Send TopicPrint
Very Hot Topic (More than 25 Replies) How To Add More Smilies (Read 13021 times)
Dave Baughman
God Member
*****
Offline


I want my MTV

Posts: 2039
Location: Murfreesboro
Joined: May 18th, 2001
Gender: Male
How To Add More Smilies
Jun 8th, 2001 at 11:15pm
Print Post  
Step 1)

Open up the ubbc.js file. This is the file that inserts the proper smiley code when you click a smiley face button. The smiley section starts at this section of code:

[code]function smiley() {
     AddTxt=" :)";
     AddText(AddTxt);
}[/code]

For the purpose of this tutorial, we'll be adding a  smiley face named "crazy.gif".

First, somewhere in ubbc.js, add this (it would make sense to add it close to the other smilies, most likely at the end):

[code]function crazy() {
     AddTxt=" $)";
     AddText(AddTxt);
}[/code]

We're gonna be calling on this javascript function later, so make sure its name is two things: unique and relevant to what you are using it for (ie, function crazy for adding  the crazy.gif smiley). For this smiley face, we'll be using the characters $) to call it in the message, in case you hadn't already figured that out. =)

Okay, close up ubbc.js and save it, you're all done with that file.

Step 2)

Open up Subs.pl and find the section called "sub MakeSmileys"

This is the section that searches for strings you define and replaces them with the appropriate smiley face. You will need to know a little bit about regular expressions in perl for this part. Just for an example, this line is the section of code that replaces the text :) in your message with a normal smiley face picture:

[code]      $message =~ s/\Q:)\E/\<img src=$imagesdir\/smiley\.gif\>/g; [/code]

In this tutorial, we're adding the smiley crazy.gif using $) for the text characters, so we'll add this line to the sub MakeSmileys:

[code]      $message =~ s/\Q$)\E/\<img src=$imagesdir\/crazy\.gif\>/g; [/code]

Certain characters made need to be "escaped" with a backslash. Also, if you want to use > or < or the | symbols, you'll need to use &gt; or &lt; or &#124; respectively. Just take a look at all  the other lines of code in the sub MakeSmileys and use the trial and error method. You'll  come up with a working combination sooner or later. =)

Okay, all done with Subs.pl. Save that sucker and close her up.

Step 3)

You're going to do this in three files: Post.pl, ModifyMessage.pl, and InstantMessage.pl

You'll find a big section of html code in each of these files that will look like this:

[code]      document.write("<a href=javascript:smiley()><img src='$imagesdir/smiley.gif' align=bottom alt='$txt{'287'}' border='0'></a> ");
     document.write("<a href=javascript:wink()><img src='$imagesdir/wink.gif' align=bottom alt='$txt{'292'}' border='0'></a> ");
     document.write("<a href=javascript:cheesy()><img src='$imagesdir/cheesy.gif' align=bottom alt='$txt{'289'}' border='0'></a> ");
     document.write("<a href=javascript:grin()><img src='$imagesdir/grin.gif' align=bottom alt='$txt{'293'}' border='0'></a> ");
     document.write("<a href=javascript:angry()><img src='$imagesdir/angry.gif' align=bottom alt='$txt{'288'}' border='0'></a> ");
     document.write("<a href=javascript:sad()><img src='$imagesdir/sad.gif' align=bottom alt='$txt{'291'}' border='0'></a> ");
     document.write("<a href=javascript:shocked()><img src='$imagesdir/shocked.gif' align=bottom alt='$txt{'294'}' border='0'></a> ");
     document.write("<a href=javascript:cool()><img src='$imagesdir/cool.gif' align=bottom alt='$txt{'295'}' border='0'></a> ");
     document.write("<a href=javascript:huh()><img src='$imagesdir/huh.gif' align=bottom alt='$txt{'296'}' border='0'></a> ");
     document.write("<a href=javascript:rolleyes()><img src='$imagesdir/rolleyes.gif' align=bottom alt='$txt{'450'}' border='0'></a> ");
     document.write("<a href=javascript:tongue()><img src='$imagesdir/tongue.gif' align=bottom alt='$txt{'451'}' border='0'></a> ");
     document.write("<a href=javascript:embarassed()><img src='$imagesdir/embarassed.gif' align=bottom alt='$txt{'526'}' border='0'></a> ");
     document.write("<a href=javascript:lipsrsealed()><img src='$imagesdir/lipsrsealed.gif' align=bottom alt='$txt{'527'}' border='0'></a> ");
     document.write("<a href=javascript:undecided()><img src='$imagesdir/undecided.gif' align=bottom alt='$txt{'528'}' border='0'></a> ");
     document.write("<a href=javascript:kiss()><img src='$imagesdir/kiss.gif' align=bottom alt='$txt{'529'}' border='0'></a> ");
     document.write("<a href=javascript:cry()><img src='$imagesdir/cry.gif' align=bottom alt='$txt{'530'}' border='0'></a> "); [/code]
     
Big, huh? Now, at right below the last line there, you're going to add this line:

[code]      document.write("<a href=javascript:crazy()><img src='$imagesdir/crazy.gif' align=bottom alt='Crazy' border='0'></a> "); [/code]
     
Notice that we call on the javascript function crazy() we made earlier in the ubbc.js file. Told you we'd find a use for it. =)

Do that in all three files. This sticks in the actual smiley face above the message area where  you type/modify your message as a button that inserts the text " $)" into your message when you click it. The " $)" gets replaced by the picture crazy.gif in the actual message thanks to the  line of code we put into the sub MakeSmileys in Subs.pl

Step 4)

Upload crazy.gif into your YaBBImages directory in binary mode. Upload Post.pl, ModifyMessage.pl, InstantMessage.pl, and ubbc.js in ASCII to their appropriate places on your server. You've now added a smiley face. Repeat as many times as necessary. Do not run with scissors. Price before tax, title, and license. DaveB does not claim responsibility for lost or misdirected entries, nor does DaveB claim  responsibility for the creation of the universe, high gas prices, the media controversy surrounding  John Rocker, or rising federal interest rates.

- DaveB
 http://www.davesworldzone.com
  

I'm not sure if it's ignorance or apathy, but I don't know and I don't care.
Back to top
WWW  
IP Logged
 
Administrator
Forum Administrator
*****
Offline


Yummm

Posts: 7
Location: Modders Rile
Joined: Oct 7th, 2014
Gender: Male
Re: How To Add More Smilies
Reply #1 - Jun 8th, 2001 at 11:28pm
Print Post  
very good Dave. Small suggestion: Use code boxes, that gives more overview. Wink
  

The Administrator.
Back to top
WWW  
IP Logged
 
akzerox
New Member
*
Offline



Posts: 10
Joined: Jun 22nd, 2001
Re: How To Add More Smilies
Reply #2 - Jun 25th, 2001 at 4:06am
Print Post  
heh i added the  :s01: smiley and it told me not compatible with the browser what do i do now?
  

-=Maximus AKmus=-
Back to top
WWWAIM  
IP Logged
 
Administrator
Forum Administrator
*****
Offline


Yummm

Posts: 7
Location: Modders Rile
Joined: Oct 7th, 2014
Gender: Male
Re: How To Add More Smilies
Reply #3 - Jun 25th, 2001 at 12:41pm
Print Post  
install the add smilies mod :s06:
  

The Administrator.
Back to top
WWW  
IP Logged
 
akzerox
New Member
*
Offline



Posts: 10
Joined: Jun 22nd, 2001
Re: How To Add More Smilies
Reply #4 - Jun 26th, 2001 at 3:09am
Print Post  
oh yeah ... heh forgot about that
  

-=Maximus AKmus=-
Back to top
WWWAIM  
IP Logged
 
darkpinky
New Member
*
Offline



Posts: 2
Joined: Jun 26th, 2001
Gender: Male
Re: How To Add More Smilies
Reply #5 - Jun 26th, 2001 at 9:51pm
Print Post  
:s05: Okay. I found the Subs file in the Sources folder but I can't seem to find Sub Makesmilies.
Am I in the right place or is there something wrong?
« Last Edit: Jun 27th, 2001 at 12:05am by darkpinky »  

So far, I have earned $5000 in two years with my own hands.
God I hate Bill Gates...
Back to top
ICQAIM  
IP Logged
 
Administrator
Forum Administrator
*****
Offline


Yummm

Posts: 7
Location: Modders Rile
Joined: Oct 7th, 2014
Gender: Male
Re: How To Add More Smilies
Reply #6 - Jun 27th, 2001 at 12:08pm
Print Post  
it is there. Try to open it in notepad and press CTRL+F. then enter
Code
Select All
sub MakeSmileys { 

It should push you to the right position
  

The Administrator.
Back to top
WWW  
IP Logged
 
darkpinky
New Member
*
Offline



Posts: 2
Joined: Jun 26th, 2001
Gender: Male
Re: How To Add More Smilies
Reply #7 - Jun 28th, 2001 at 2:55am
Print Post  
Woah, Woah, Woah.
Something is wrong...
My .cgi version of Subs is missing half of its content, I just checked my .pl version...
Should I just copy and pasta from my .pl version to my .cgi version?
  

So far, I have earned $5000 in two years with my own hands.
God I hate Bill Gates...
Back to top
ICQAIM  
IP Logged
 
Administrator
Forum Administrator
*****
Offline


Yummm

Posts: 7
Location: Modders Rile
Joined: Oct 7th, 2014
Gender: Male
Re: How To Add More Smilies
Reply #8 - Jun 28th, 2001 at 3:13pm
Print Post  
it may work but I suggess to redownload the cgi version from http://yabb.xnull.com
  

The Administrator.
Back to top
WWW  
IP Logged
 
Bainsidhe
New Member
*
Offline


I love YaBB 1 Gold!

Posts: 1
Joined: Jul 17th, 2001
Re: How To Add More Smilies
Reply #9 - Jul 17th, 2001 at 12:35am
Print Post  
Okay...got it configured and installed, but how do you make it so when the user clicks on a smiley, the code is automatically inserted in the message?

I'm a Perl moron, if you haven't already figured that out, but I can copy and paste like anything. Grin

[EDIT: HA! I figured it out. Am very proud of myself. The ubbc.js file didn't upload properly, so the javascript was erroring out. I re-uploaded and it's all good. Thanks for the tutorial, it is excellent!]
  
Back to top
 
IP Logged
 
Administrator
Forum Administrator
*****
Offline


Yummm

Posts: 7
Location: Modders Rile
Joined: Oct 7th, 2014
Gender: Male
Re: How To Add More Smilies
Reply #10 - Jul 17th, 2001 at 12:43am
Print Post  
did you install the smilies mod or did you follow this tutorial instructions?

[EDIT: Nevermind Grin]
  

The Administrator.
Back to top
WWW  
IP Logged
 
Shoeb Omar
God Member
*****
Offline


Mod Writer

Posts: 5665
Location: San Diego
Joined: Jun 29th, 2001
Gender: Male
Re: How To Add More Smilies
Reply #11 - Jul 17th, 2001 at 12:44am
Print Post  
i was just about to ask the same thing!
  

YaBB SP2 BETA!
Now taking pay jobs in PHP or Perl.  Contact me for details.
Back to top
IP Logged
 
Chaos_Edge
New Member
*
Offline


I love YaBB 1 Gold!

Posts: 2
Joined: Aug 19th, 2001
Re: How To Add More Smilies
Reply #12 - Aug 19th, 2001 at 4:29pm
Print Post  
:s07:

Heheh...
  
Back to top
 
IP Logged
 
Administrator
Forum Administrator
*****
Offline


Yummm

Posts: 7
Location: Modders Rile
Joined: Oct 7th, 2014
Gender: Male
Re: How To Add More Smilies
Reply #13 - Aug 19th, 2001 at 4:33pm
Print Post  
wow someone looks for the answer before asking Wink
  

The Administrator.
Back to top
WWW  
IP Logged
 
Dragodden
New Member
*
Offline


I long for combat

Posts: 31
Joined: Aug 31st, 2001
Gender: Female
Re: How To Add More Smilies
Reply #14 - Aug 31st, 2001 at 11:49pm
Print Post  
I've added the mod with success, and only one problem.. How do you set the details appropriately like the the normal default ones so that when you put your curser over the image, it displays what it is, yet doesn't take up room while loading? I mean the alt comand.
  
Back to top
IP Logged
 
Page Index Toggle Pages: [1] 2 3 4
Send TopicPrint