mIRC Home    About    Download    Register    News    Help

Print Thread
#235503 22/12/11 08:21 AM
Joined: Jan 2010
Posts: 51
L
Lenooox Offline OP
Babel fish
OP Offline
Babel fish
L
Joined: Jan 2010
Posts: 51
HEllo anyone can help me whats wrong in this? :$

Code:
on *:text:!ascii*:#:{
  if (!$2) { msg # Nothing doesn't have an ASCII value, $nick $+ . }
  elseif ($len( $2 ) > 1) { msg # I can only find the ASCII of one symbol at a time, not $len( $2 ) symbols. }
  else {
    :asciistart
    inc %ascii#
    set %symbol $chr( %ascii# )
    if (%symbol == $2) { msg # The ASCII of the symbol " $+ $2 $+ " is %ascii# | unset %ascii# , unset %symbol | halt }
        if (%symbol != $2) { goto asciistart }
  }
}
on *:text:!char*:#:{
  if (!$2) { msg # I can't give you the ASCII result of nothing }
  elseif ($2 !isnum) { msg # Give me a number. }
  else { msg # $chr( $2 )
 }


Last edited by Lenooox; 22/12/11 08:40 AM.

(\__/)
(='.'=)
(")_(")
Bunny Hopp

QuakeNet@ #Lenoox <> visit http://www.insaneboard.comeze.com
Lenooox #235504 22/12/11 09:09 AM
Joined: Oct 2003
Posts: 3,918
A
Hoopy frood
Offline
Hoopy frood
A
Joined: Oct 2003
Posts: 3,918
Your !ascii event is a little messy. There's some /inc and if conditionals that just don't need to be there. All you need to do is msg your channel the result of $asc($2). You have it right in !char, but you're missing an ending } in that event, so you might want to fix it. A simpler way to do this (or more complicated, depending who you ask) would be:

Code:
on $*:TEXT:/^!ascii\s*\S$/iS:#:msg # ASCII of $2 is $asc($2)
on $*:TEXT:/^!char\s*\d+$/iS:#:msg # CHR of $2 is $chr($2)


You can ignore the regular expression in the matchtext if it's too confusing for you, that's just to avoid the unnecessary error checking. If you really want the error checking to /msg the user if they provide invalid input, you should handle it the way you are already doing it.


- argv[0] on EFnet #mIRC
- "Life is a pointer to an integer without a cast"
argv0 #235505 22/12/11 09:47 AM
Joined: Jan 2010
Posts: 51
L
Lenooox Offline OP
Babel fish
OP Offline
Babel fish
L
Joined: Jan 2010
Posts: 51
o.O
hmm maybe mine are not works good , I get a different result

btw thank you smile


(\__/)
(='.'=)
(")_(")
Bunny Hopp

QuakeNet@ #Lenoox <> visit http://www.insaneboard.comeze.com

Link Copied to Clipboard