mIRC Home    About    Download    Register    News    Help

Print Thread
#31694 23/06/03 05:48 PM
Joined: Jun 2003
Posts: 114
T
Thray Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Jun 2003
Posts: 114
First off, the subject of the topic comes from boredom and too much caffeine.

Now then, I am trying to make a MUD with mIRCscript. Actually, its more of a MUSH because it will allow you to do specific events using mIRCscript remotely by adding events to an object.

Anyway, before I get into all that.. my problem is adding color codes to the MUD. Since it will not be a DCC MUD (at least, you will have to use special DCC ports if you want to use a DCC window for it), I can't just use mIRC's color codes (CTRL+K, color number). Rather, I have to use ANSI.

mIRC has a handy identifier, $ansi2mirc which will convert ANSI color codes to mIRC color codes (more or less). But does it have something that does the exact opposite, converting mIRC color codes to ANSI? If not, how would such a thing be made so as to allow bold, underline, foreground, and background colors?


-------------
I am the self-appointed God of needlessly complex mIRCscript.
#31695 23/06/03 07:08 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Try here.

#31696 23/06/03 07:38 PM
Joined: Jun 2003
Posts: 114
T
Thray Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Jun 2003
Posts: 114
erkC is the only thing that looks remotely what I need, but I need something that will convert input like...

$m2a(^4Blahh) to (bright red ansi color code)Blahh


-------------
I am the self-appointed God of needlessly complex mIRCscript.
#31697 23/06/03 09:43 PM
Joined: Feb 2003
Posts: 2,812
Hoopy frood
Offline
Hoopy frood
Joined: Feb 2003
Posts: 2,812
Read this first post, Suggestion #7 $mirc2ansi and then read my reply to #7.

- Raccoon


Well. At least I won lunch.
Good philosophy, see good in bad, I like!
#31698 23/06/03 09:45 PM
Joined: Dec 2002
Posts: 1,922
O
Hoopy frood
Offline
Hoopy frood
O
Joined: Dec 2002
Posts: 1,922
Here's a quick $m2a() alias, including a short version of $erkc()
Code:
alias m2a {
  var %i = 1, %c = $1-
  !.echo -q $regex(%c,/(\x03\d?\d?)/g)
  while $regml(%i) {
    var %i = %i + 1, %c = $replace(%c,$ifmatch,$_m2a($mid($ifmatch,2)))
  }
  return %c
}
alias -l _m2a {
  ; from $erkc() by SyntheroS
  if ($1 == 0) { return $chr(27) $+ [1;37m }
  elseif ($1 == 1) { return $chr(27) $+ [30m }
  elseif ($1 == 2) { return $chr(27) $+ [34m }
  elseif ($1 == 3) { return $chr(27) $+ [32m }
  elseif ($1 == 4) { return $chr(27) $+ [1;31m }
  elseif ($1 == 5) { return $chr(27) $+ [31m }
  elseif ($1 == 6) { return $chr(27) $+ [35m }
  elseif ($1 == 7) { return $chr(27) $+ [33m }
  elseif ($1 == 8) { return $chr(27) $+ [1;33m }
  elseif ($1 == 9) { return $chr(27) $+ [1;32m }
  elseif ($1 == 10) { return $chr(27) $+ [36m }
  elseif ($1 == 11) { return $chr(27) $+ [1;36m }
  elseif ($1 == 12) { return $chr(27) $+ [1;34m }
  elseif ($1 == 13) { return $chr(27) $+ [1;35m }
  elseif ($1 == 14) { return $chr(27) $+ [1;30m }
  elseif ($1 == 15) { return $chr(27) $+ [37m }
  else { return $chr(27) $+ [0m }
}

Paste it into the remote and use: //echo -a $m2a(^K14test)

#31699 23/06/03 10:20 PM
Joined: Jun 2003
Posts: 114
T
Thray Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Jun 2003
Posts: 114
Thanks


-------------
I am the self-appointed God of needlessly complex mIRCscript.
#31700 23/06/03 10:24 PM
Joined: Jun 2003
Posts: 114
T
Thray Offline OP
Vogon poet
OP Offline
Vogon poet
T
Joined: Jun 2003
Posts: 114
That topic looks pretty closed, so in response to Raccoon's response in the post he linked to above...
Most terminals (by 'most' I mean many mud clients and some programs used to replace telnet, etc) use only 16 colors... not necessarily the ones that mIRC uses, though. But in an alias like $mirc2ansi, I'd suggest just finding the nearest match and using that, based on mIRC's ANSI processing.
You can't really base it off of anything else because not every program uses the same colors to represent ANSI, even. Some programs have lighter or darker colors, etc.


-------------
I am the self-appointed God of needlessly complex mIRCscript.

Link Copied to Clipboard