mIRC Home    About    Download    Register    News    Help

Print Thread
#213563 30/06/09 11:07 PM
Joined: Jun 2009
Posts: 2
K
keptix Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
K
Joined: Jun 2009
Posts: 2
Hey everyone,
I was wondering if anyone could help me with a problem im having? I am trying to create a script that will send what i type coloring each letter differently. I was wanting to display my output in red/white/blue lettering changing every other letter. I've been attempting this for awhile now and can't figure it how. In doing this in on *:INPUT:* however im stumped as to what to do next. Any help would be greatly appreciated. Thanks

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Untested, but should work per your request.
Please remember, that your actual outgoing message is going to be 3x the length of the message you actually enter, so you will hit the server's message limit 3x sooner than without this code.

Most servers allow at least 256 characters for a message, thus, with this code, you longest message should be kept to 85 characters or less.

Also remember that this code is going to take some time to process the information, thus the longer the message, the longer it will take, and, the longer it will be before people actually see your message.
Code:
on *:input:*:{
  if (/* !iswm $1) {
    var %a = 1, %b = $len($1-), %sent
    while %a <= %b {
      var %colour = $replace($calc(%a % 3),0,4,1,0)
      %sent = $+(%sent,$chr(3),%colour,$mid($1-,%a,1)
      inc %a
    }
    .msg $active %sent
  }
}


Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
You've missed the blue color in the $replace part smile
Code:
$replace($calc(%a % 3),0,4,1,0,2,12)



#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Well, depends on which blue the OP wanted. 2 is also a shade of blue, so it made no sense to replace 2 with 2, and since the OP stated Red, White and Blue, it made me think of the US flag, in which, imo, the shade of blue used is closer to that of the shade given in 2 than in 12.

Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
He, didn't think about that, but 2 is just an index, if the index 2 isn't the defaut color for the OP, you (he) still have to change the 2 to the index of a blue color.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Point taken, however, that same point stands for any of the colours.
The OP did not indicate that they were working with anything other than the standard colour scheme, so that is what my code was based upon.

It would be impossible to generate a code like was requested without doing a little bit of presuming, such as, the fact that the OP is using the standard colour scheme.

And even your amendment still falls under this potential problem.

Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
My suggestion... not for the regsubex' sake! but
- with .msg others will see the colors - you don't
- without a halt, you'll send the text twice (although you see only the one mIRC processes - the custom message was .silenced)
- with single-digit color numbers you can't type digits properly
- the $window().type thingie prevents e.g. messages to custom windows

Code:
on *:input:*:{
  if (/* !iswm $1) && (!$ctrlenter) && ($istok(channel.query.chat,$window($active).type,46)) { 
    msg $active $$regsubex($strip($$1-),/(\S)/g,$+($chr(3),$replacex($calc(\n % 3),0,12,1,04,2,00),\t))
    halt
  }
}


Joined: Jul 2006
Posts: 4,145
W
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 4,145
Looks much better, but if you want to be really perfect, you have to check for $readini($mircini,text,commandchar) and change halt with haltdef.
Also, in on input event, $1 can't be $null, so I think your $regsubex can't too, the only thing that could be $null is the $strip, that the only thing i can't think off that need the $$ here.


#mircscripting @ irc.swiftirc.net == the best mIRC help channel
Joined: Nov 2006
Posts: 1,559
H
Hoopy frood
Offline
Hoopy frood
H
Joined: Nov 2006
Posts: 1,559
Was only a suggestion smile The real *fun* would start in conjunction with the desire to "theme" outgoing messages as well, acromanagers, the desire to color /me's or /am*'s too, or a check for chanmodes S/c... shocked

Joined: Aug 2004
Posts: 7,252
R
Hoopy frood
Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
If you want that "fun", Horstl, be my guest!!!

Joined: Jun 2009
Posts: 2
K
keptix Offline OP
Bowl of petunias
OP Offline
Bowl of petunias
K
Joined: Jun 2009
Posts: 2
wow thanks for all the replies everyone. I'll give it a shot and let you all know how it comes out. Thanks


Link Copied to Clipboard