Перейти к содержимому


Фотография

Таблица ASCII символов


  • Авторизуйтесь для ответа в теме
В этой теме нет ответов

#1 tvrsh

tvrsh

    Активный участник

  • Администратор
  • 389 сообщений
  • Пол:Мужчина
  • Город:Russian Federation, Podolsk
  • Ник в сети:tvrsh
  • Каналы:#egghelp, #3hauka, #bash.org

Отправлено 11 мая 2008 - 11:35

В mIRC нажимаете Alt+R и в открывшееся окно вставляете этот код:
; Ascii Table
; By Carnage-
; - The snippet is for quickly inserting an ascii charecter into what you are writing
; when you press f5(or whatever you change it too), an ascii window will popup and
; you can just simply click on what char you want.
; - Also, if you hold down control while clicking, the window will not close, so you
; can click one more than one charecter. If you open the window and dont want to click
; anything, you can press control to close it.
;
; You can change the font the script draws in by using /ascii.font [fontname] with or without
; parameters, if there are no parameters an input box will popup, else, it uses the parameters given.
;
; History:
; Version 2.3 Final
; - more error checking
; Version 2.2
; - made the window open up correctly on all occasions
; - added some more error checking
; Version 2.1
; - removed the about window, its kinda unnessary in a small snippet like this.
; - added a function to check if a font exists using a modified $isfont() function by ToKeN
; Version 2
; - added the ability to change the colors the window is drawn in. Just in case some people want it
; to match their themes or something. The alias is /ascii.color <color name> <rgb>, and you can
; scroll down to the alias to find out how to use it.
; - added a nifty about window.
; - added load/unload events

; press f5, or whatever you change it to, to open the ascii window
alias f5 { if ($window(@ascii)) { return } | set %ascii.lastwin $active | ascii.open }
alias ascii.open {
 ; prelim checks.
  if (!%ascii.font) { %ascii.font = TAHOMA }
  if (!%ascii.linecolor) { %ascii.linecolor = 0 }
  if (!%ascii.fontcolor) { %ascii.fontcolor = 0 }
  if (!%ascii.bgcolor) { %ascii.bgcolor = $rgb(192,192,192) }
  if (!%ascii.hilcolor) { %ascii.hilcolor = 16742767 }
 ; open window
  window -hpBCzd +dL @ascii 100 100 449 113
 ; fill in the bg
  drawrect -nrf @ascii %ascii.bgcolor 1 0 0 449 113
 ; draw lines
  var %r = 1
  while (%r < 33) { drawline -nr @ascii %ascii.linecolor 1 $calc(%r *14) 0 $calc(%r *14) 112 | inc %r }
  var %r = 1
  while (%r < 8) { drawline -nr @ascii %ascii.linecolor 1 0 $calc(%r *16) 450 $calc(%r *16) | inc %r }
 ; extra lines
  drawline -nr @ascii %ascii.linecolor 1 0 0 458 0
  drawline -nr @ascii %ascii.linecolor 1 0 0 0 113
  var %x = 17,%y = 2
  var %i = 33,%n = 63
 ; Condensed code to draw the charecters
  while (%n < 270) {
	while (%i <= %n) { drawtext -nr @ascii %ascii.fontcolor %ascii.font -8 %x %y $chr(%i) | var %x = $calc(%x + 14) | inc %i }
	var %i = $calc(%n +1),%n = $calc(%i +31),%y = $calc(%y + 16),%x = 3
  }
 ; update everything!
  drawdot @ascii
  window -a @ascii
}
menu @ascii {
  sclick:{
   ; store where the user clicked
	var %x = $mouse.x
	var %y = $mouse.y
   ; find the value of the ascii chr based on where they clicked
	var %chr $chr($calc( $gettok($calc(%x /14),1,46) + ($gettok($calc(%y /16),1,46) *32) +32))
   ; if the user already clicked something, unhilight the charecters box
	if (%ascii.lastclick) { drawrect -r @ascii %ascii.bgcolor 1 %ascii.lastclick 13 15 }
   ; hilight what the user clicked
	drawrect -r @ascii %ascii.hilcolor 1 $calc(%x - (%x % 14) +1) $calc(%y - (%y % 16) +1) 13 15
   ; set a variable to unhilight it if the user clicks something else
	set %ascii.lastclick $calc(%x - (%x % 14) +1) $calc(%y - (%y % 16) +1)
   ; if the user is holding control we dont want the window to close
	if ($mouse.key & 2) { asc %chr 0 }
   ; if the user isnt holding control, close the window
	else { asc %chr 1 }
  }
}
; once the user lets go of control, the window automatically closes
on *:keyup:@ascii:17:{ window -c @ascii }
alias -l asc {
 ; add the chr to whatever is already in the editbox
  if (%ascii.lastwin == Status Window) { editbox -s $editbox(%ascii.lastwin) $+ $1 }
  else { editbox %ascii.lastwin $editbox(%ascii.lastwin) $+ $1 }
 ; if the user isnt holding control, close window
  if ($2 == 1) { window -c @ascii | unset %ascii.lastclick }
}
; /ascii.font [fontname]
; Change the font that the table is draw in
alias ascii.font {
  if ($1) { var %font = $1 }
  else { var %font = $$input(Font:,133) }
  if (%font) {
	if ($isfont(%font)) { %ascii.font = %font }
	else { echo -s Error: Font $+(",%font,") does not exist on your system. }
  }
}
; /ascii.color <color name> <rgb>
; the rgb is not in r,g,b format, use the $rgb() function when doing it
; ex: /ascii.color text $rgb(255,0,255)
; available color names: fontcolor, hilcolor, linecolor, bgcolor
alias ascii.color {
  if ($2) {
	if ($istok(fontcolor hilcolor linecolor bgcolor,$1,32)) { set %ascii. $+ $1 [ [ $2 ] ] }
	else { echo Error: Color name $+(",$1,") isnt a valid color type, please choose from these types: fontcolor, hilcolor, linecolor, bgcolor }
  }
}
; Event blah blah.
on *:load:{
  linesep -s
  echo -si6 *** - Ascii Table Addon
  echo -si6 *** - Press F5 to load the ascii table. Click on whatever charecter you want and the window will close.
  echo -si6 *** - If you would like the window to stay open, then hold control while clicking the charecters you would like.
  echo -si6 *** - Aliases:
  echo -si6 *** - /ascii.font <fontname> - changes the font that the window is drawn in
  echo -si6 *** - /ascii.color <color name> <rgb> - changes the colors the table is drawn in
  echo -si6 *** - ---available color names: fontcolor, hilcolor, linecolor, bgcolor
  echo -si6 *** - ---the rgb in the /ascii.color alias should NOT be in the r,g,b format, when you are entering it, use the $!rgb()   function to convert it.
  echo -si6 *** - End.
  linesep -s
}
on *:unload:{
  unset %ascii.*
}
; Modified $isfont() function origionally made by ToKeN
alias isfont {
  var %string = Does this font exist?
  if ($width(%string,$1-,12) == $width(%string,Not a real font,12)) && ($height(%string,$1-,12) == $height(%string,Not a real font,12)) { return 0 }
  else { return 1 }
}

Чтобы выбрать любой символ из таблицы нажимаете F5.
Кнопку вызова таблицы можно изменить в строке
alias f5 { if ($window(@ascii)) { return } | set %ascii.lastwin $active | ascii.open }

http://ircnet.su/
#egghelp @ IrcNet.Ru




Количество пользователей, читающих эту тему: 0

0 пользователей, 0 гостей, 0 анонимных