Aide - Recherche - Membres - Calendrier
Version complète : Flashvsi's Specific Notices
CCS Forums > International english forum > VSIXc Chat Add-ons
C•Dryk™
FlashVSI's specific notices

How to integrate it in your bot / script

Specific notices enables you to realize operations similar to TIME, PING and VERSION ctcps. Requests use simply "notices" messages instead of "ctcp" messages, and provides scripts based on this system to share local time requests, delay tests and versions checks. You can easily implement specific notices management in your scripts, even thought they are not based on FlashVSI, in order to create a compatibility, as in the following example:

CODE
;;; FlashVSI specific notices by CCS-TEAM
;;; Updated version 04/2008

#vsixnotices on
alias notice {
  $iif(!$show,.) $+ NOTICE $1-
  if ($upper($2) === VSIX.PING.REQUEST) {
    set -u15 % [ $+ vsix.ping. [ $+ [ $$1 ] ] ] $iif($chr(35) isin $active,$active,$comchan($$1,1)) $ticks
    echo $color(notice) -ae * Sending a ping request to $$1 ...
    haltdef
  }
  if ($upper($2) === VSIX.TIME.REQUEST) {
    echo $color(notice) -ae * Sending a local time request $$1 ...
    haltdef
  }
  if ($upper($2) === VSIX.VER.REQUEST) {
    echo $color(notice) -ae * Sending a version request to $$1 ...
    haltdef
  }
}

On ^*:NOTICE:*:?:{
  if ($server != VSIXc) halt
  if (($1 === VSIX.TIME.REQUEST) || ($1 == TIME)) {
   ;added compatibility with ChristianEthics and SoulFly
    if (%stopvrequest) halt | .set -u2 %stoptrequest $true
   ;patch for mIRC before 6.1 because $daylight was included by mistake in $ctime
    var %corrected_ctime $ctime | if ($version < 6.1) %corrected_ctime = $calc($ctime - $daylight)
   ;
    if ($1 === VSIX.TIME.REQUEST) .notice $nick VSIX.TIME.REPLY %corrected_ctime $timezone $daylight
    else .notice $nick Local Time: $fulldate
    if ($chr(35) isin $active) && ($nick ison $active) var %ccs.chan = $active
    else var %ccs.chan = $comchan($nick,1)
    echo $color(notice) -e %ccs.chan * $nick , is asking for your local time ...
    haltdef
  }
  if ($1 === VSIX.TIME.REPLY) {
    if (%stopvreply) || ($2 !isnum) halt | .set -u2 %stoptreply $true
    if ($chr(35) isin $active) && ($nick ison $active) var %ccs.chan = $active
    else var %ccs.chan = $comchan($nick,1)
   ;patch for mIRC before 6.1 because $daylight was included by mistake in $ctime
    var %corrected_ctime $2 | if ($version < 6.1) %corrected_ctime = $calc($2 + $daylight)
   ;
    var %finaltime = $calc(%corrected_ctime - $3) , %gmt = $gettok($calc($calc($3 / 3600) * -1),1,46) $+ $iif(*.5* iswm $calc($3 / 3600),:30) $+ $iif(*.75* iswm $calc($3 / 3600),:45)
    if ($4) %finaltime = $calc(%finaltime + $4)
   ;patch for mIRC before 6.1 because $daylight was not included in $gmt
    if ($version < 6.1) %finaltime = $calc(%finaltime - $daylight)
    echo $color(notice) -e %ccs.chan * $nick , local time: $gmt(%finaltime,H:nn tt) $chr(40) $+ GMT: $iif($3,$iif(- !isin %gmt,+ $+ %gmt,%gmt),unknown) $+ $chr(41)
    haltdef
  }
  if ($1 === VSIX.VER.REQUEST) {
    if (%stopvrequest) halt | .set -u2 %stopvrequest $true
   ;you can replace $fullname by your script's name and/or version
    .notice $nick VSIX.VER.REPLY $fullname
    if ($chr(35) isin $active) && ($nick ison $active) var %ccs.chan = $active
    else var %ccs.chan = $comchan($nick,1)
    echo $color(notice) -e %ccs.chan * $nick , is asking for your script version ...
    haltdef
  }
  if ($1 === VSIX.VER.REPLY) {
    if (%stopvreply) halt | .set -u2 %stopvreply $true
    if ($chr(35) isin $active) && ($nick ison $active) var %ccs.chan = $active
    else var %ccs.chan = $comchan($nick,1)
    echo $color(notice) -e %ccs.chan * $nick , VERSION: $strip($2-)
    haltdef
  }
  if ($1 === VSIX.PING.REQUEST) {
    if (%stoprequest) halt | .set -u2 %stoprequest $true
    .notice $nick VSIX.PING.REPLY $2
    if ($chr(35) isin $active) && ($nick ison $active) var %ccs.chan = $active
    else var %ccs.chan = $comchan($nick,1)
    echo $color(notice) -e %ccs.chan * $nick , is sending you a ping request ...
    haltdef
  }
  if ($1 === VSIX.PING.REPLY) {
    if (%stopreply) || (!%vsix.ping. [ $+ [ $nick ] ]) halt | .set -u2 %stopreply $true
    var %r = $gettok(%vsix.ping. [ $+ [ $nick ] ],1,32)
    var %t = $gettok(%vsix.ping. [ $+ [ $nick ] ],2,32)
    if ($comchan($nick,0) > 0) && (%r) && (%t) {
      echo $color(notice) -e %r * $nick , Ping-Pong: $calc(($ticks - %t) / 1000) sec(s)
    }
    haltdef
  }
}
#vsixnotices end

menu menubar,status,channel {
  -
  Specific notices
  .Notice &TIME: .NOTICE $$input(Enter user nickname here:,129,Notice TIME) VSIX.TIME.REQUEST
  .Notice &PING: .NOTICE $$input(Enter user nickname here:,129,Notice PING) VSIX.PING.REQUEST $ctime
  .Notice &Version: .NOTICE $$input(Enter user nickname here:,129,Notice Version) VSIX.VER.REQUEST
  .-
  .Function $upper($group(#vsixnotices))
  .. $+ $iif($group(#vsixnotices) == on,$style(1)) $+ ON: .enable #vsixnotices
  .. $+ $iif($group(#vsixnotices) != on,$style(1)) $+ OFF: .disable #vsixnotices
}

menu nicklist {
  -
  Specific notices
  .Notice &TIME: .NOTICE $$1 VSIX.TIME.REQUEST
  .Notice &PING: .NOTICE $$1 VSIX.PING.REQUEST $ctime
  .Notice &Version: .NOTICE $$1 VSIX.VER.REQUEST
  .-
  .Function $upper($group(#vsixnotices))
  .. $+ $iif($group(#vsixnotices) == on,$style(1)) $+ ON: .enable #vsixnotices
  .. $+ $iif($group(#vsixnotices) != on,$style(1)) $+ OFF: .disable #vsixnotices
}
;;; End of code for FlashVSI's specific notices


Note that this script is usable AS IS, and should provide your script/bot/connection with a way to be compatible with FlashVSI's specific notices, and with other clients which adopted this alternative to ctcps, which are forbidden on VSIXc Chat Network.
C•Dryk™
Specific notices were modified today to prevent an error for mirc above version 6.1 where $gmt and $ctime didn't use correctly the $daylight value.
Ceci une version "bas débit" de notre forum. Pour voir la version complète avec plus d'information, la mise en page et les images, veuillez cliquez ici.
Invision Power Board © 2001-2012 Invision Power Services, Inc.