Skip to content
MSN Tutorials

Tutorial for coding with nHTMLn_2.95.dll

A TG007 community discussion started by Warrior124.

Closed discussion 1 post
Page 1 of 1
Closed
Topic #2758 · 1 published post · 2,832 views

Topics covered...

1. Creating a web-chat interface.

2. Creating the ability to use emoticons.

3. Adding text to the webchat interface.

 

1. Creating a web-chat interface...

 

To create a webchat interface you must attach the channels winodw handle to the dll.

 

Example;

on *:JOIN:#:{
 if ($nick ==  $me) { 
  ;This command will select the channel as the active channel the dll will use
   dll $findfile($mircdir,nHTMLn_2.95.dll,1) select $window($chan).hwnd
  ;This command attaches the channels handle to the dll
   dll $findfile($mircdir,nHTMLn_2.95.dll,1) attach $window($chan).hwnd 
  ;This command navigates the created webchat to the url, about:blank
   dll $findfile($mircdir,nHTMLn_2.95.dll,1) navigate about:blank
}

 

Now, you have a webchat interface.

 

2. Creating the ability to use emoticons...

Now, you need the ability to change certain text into emoticons. First, you will need the icons to do this with. You can usually find emoticons on different web-sites, or you can create your own.

 

Here is an example of replacing text with emoticons.

 

Example;

alias switch {
 var %switch = $1-
 %switch = $replace(%switch,; $+ $chr(41),<img SRC=" $+ $shortfn($scriptdirimages\wink.gif) $+ ">)
 return %switch
}

 

This will replace the text ; + ) with the image wink.gif

This is also a good way to replace any words you don't want to see with a blank character, such as $chr(32)

 

Example;

 %switch = $replace(%switch,badword,$chr(32))

 

3. Adding text to the webchat interface...

It is best to make an echo alias so that whenever you, or someone else says something it will appear in the webchat window.

 

Example;

alias echo { 
 if ($chan) { 
   dll $findfile($mircdir,nHTMLn_2.95.dll,1) select $window($comchan($nick,1)).hwnd
  ;The code above will select the window the text will appear in.
   if ($nick isowner $chan) set %160 $null
   elseif ($nick isop $chan) set %160 $null
   elseif (%icon. [ $+ [ $nick ] ] == checkmark) set %160 $null
   else { set %160 $chr(160) $chr(160) $+ $chr(160) $+ $chr(160) }
   if (: == $3) { dll $findfile($mircdir,nHTMLn_2.95.dll,1) execScript document.body.innerHTML=document.body.innerHTML+' <basefont color=" $+ $iif($nick != $me,black,$iif($nick == $me,blue,$iif( $+ %action == $true,purple))) $+ " size=2 face=Verdana Border="1"><small><b> $+ %160 $iif(!%time,,<br> $+ $chr(160) $chr(160) ( $fulldate ) $+ <br> $+ $chr(160) $chr(160)) $replace($switch($statz),\,\\,$crlf,<br>,$chr(39),')) $switch($replace($nick,>,Guest_)) </small><basefont color="black" size=2 face=Verdana Border="1"><small><b>:</small></b><basefont color=" $+ %smilecolor $+ " face= $+ %smilefont size= %smilesize Border="1"><small> %bold $+ %italic $+ %underline $+ $replace($switch($4-),\,\\,$crlf,<br>,$chr(39),')) $+ $replace(%bold,<b>,</b>) $+ $replace(%italic,<i>,</i>) $+ $replace(%underline,<u>,</u>) $+ </small><br> $+ ' | dll $findfile($mircdir,nHTMLn_2.95.dll,1) execScript scroll(0,9999999999) }
   else { 
     if ($nick == $me) && (/ == $left($1,1)) { 
       .timer -m 1 320 dll $findfile($mircdir,nHTMLn_2.95.dll,1) execScript document.body.innerHTML=document.body.innerHTML+'<b><basefont color=" $+ $iif(%echocolor,%echocolor,black) $+ " size=2 face=Verdana Border="1"><small> $+ $replace($1-,\,\\,$crlf,<br>,$chr(39),',>,Guest_) $+ </small></b><br>'
       .dll $findfile($mircdir,nHTMLn_2.95.dll,1) execScript scroll(0,9999999999)
       .unset %echocolor 
     }
     else { 
       .timer -m 1 320 dll $findfile($mircdir,nHTMLn_2.95.dll,1) execScript document.body.innerHTML=document.body.innerHTML+'<b><basefont color=" $+ $iif(%echocolor,%echocolor,black) $+ " size=2 face=Verdana Border="1"><small><font face="Marlett">8</font> $+ $replace($iif($chan == $1,$2-,$1-),\,\\,$crlf,<br>,$chr(39),',>,Guest_) $+ </small></b><br>'
       .dll $findfile($mircdir,nHTMLn_2.95.dll,1) execScript scroll(0,9999999999) 
     }
   }
 }
 elseif (!$chan) { echo $1- | .dll $findfile($mircdir,nHTMLn_2.95.dll,1) execScript scroll(0,9999999999) }
}

Now, to explain what some things are.

For nHTMLn_2.95.dll you have to make sure you replace / with //, and $crlf,<br>,$chr(39) with '. The reason is that there are some characters the dll will not respond to for some reason.

 

To move to the next line you will need to use

dll $findfile($mircdir,nHTMLn_2.95.dll,1) execScript scroll(0,9999999999).

 

Now, you will need to set your on text, and on input commands, and such. Here are some examples.

 

Examples;

on *:TEXT:*:#:{
 dll $findfile($mircdir,nHTMLn_2.95.dll,1) select $window($comchan($nick,1)).hwnd
 set %nikstatz $nick
 set %nick1 $nick
 echo $chan $iif($len(%nick1) > 10,$left($replace(%nick1,>,Guest_),10) $+ ...,$replace(%nick1,>,Guest_)) : $iif($chan isin $1,$replace($strip($switch($1-)),$chan,),$strip($switch($1-)))
}
on *:INPUT:*: {
 set %nick1 $me
 if (/ != $left($1-,1)) {
   echo $chan $iif($len(%nick1) > 10,$left(%nick1,10) $+ ...,%nick1) : $switch($1-)
 }
}
on *:KICK:#:{ set %echocolor red | set %echo Host $nick Kicked $knick From Chat $1- | echo %echo | unset %echocolor | .timer -m 1 320 getnicks $chan }

;End of turotial.

 

If you have any questions please let me know.

Edited Feb 3, 2005 5:45 PM by Warrior124