mIRC Home    About    Download    Register    News    Help

Print Thread
Nick in bold #232566 09/06/11 05:04 PM
Joined: Jun 2011
Posts: 6
D
drb Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Jun 2011
Posts: 6
i want to make my script so that when i'm replying to "any" nick,, their nick will show in bold. i had this option on a very old script, but it is not compatible with win7.

i know very little about scripting, though i've made a few changes such as adding a pop-up, etc. & can follow simple instructions. so if someone can give me the exact script that i can copy/paste & then tell me where to put it,, i can do that. smile

Re: Nick in bold [Re: drb] #232588 10/06/11 02:00 PM
Joined: Jan 2007
Posts: 1,156
D
DJ_Sol Offline
Hoopy frood
Offline
Hoopy frood
D
Joined: Jan 2007
Posts: 1,156
When you say reply do you mean a query or whisper?

Re: Nick in bold [Re: drb] #232589 10/06/11 02:16 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
I would guess that you're talking about a nick completer? Where if you type a nick with a colon after it at the beginning of a line, that nick will be formatted in some way (color, bold, underline, fancy characters around it, etc). If so, there are a variety on the scripting sites (search for nick completer) or someone here may write one for you.

If you mean that it checks every word in a line of text and if the word is a nick currently in the channel, then it formats it in some way (see above for types of formatting), then that's a slightly more involved script, though still not too difficult to write.

If you mean something else entirely, please clarify how your initial input would appear and how you want it to display afterwards.


Invision Support
#Invision on irc.irchighway.net
Re: Nick in bold [Re: Riamus2] #232591 10/06/11 05:09 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Originally Posted By: Riamus2
I would guess that you're talking about a nick completer? Where if you type a nick with a colon after it at the beginning of a line, that nick will be formatted in some way (color, bold, underline, fancy characters around it, etc).
Here is the code:
Code:
on ^*:tabcomp:*:{
  editbox -ap $+($chr(2),$1,:,$chr(2)) 
  haltdef
}

Re: Nick in bold [Re: drb] #232606 12/06/11 11:46 AM
Joined: Jun 2011
Posts: 6
D
drb Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Jun 2011
Posts: 6
@Riamus2

Yes, this is exactly what I mean:

<quote>If you mean that it checks every word in a line of text and if the word is a nick currently in the channel, then it formats it in some way (see above for types of formatting), then that's a slightly more involved script, though still not too difficult to write. </quote>

It doesn't require typing a colon or anything (like mentioned above). You just type the nick & it formats it in bold, or even bold with color.

Re: Nick in bold [Re: drb] #232615 12/06/11 07:01 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
I think this will do what you want:
Code:
alias -l cc {
  var %c = 1
  while ($comchan($me,%c)) {
    return $v1
    inc %c
  }
}
on *:input:*:{
  if ($left($1,1) !isin / $readini($mircini,text,commandchar)) && (!$ctrlenter) && (!$inpaste) {
    var %c = $regsubex($str($chr(32),$nick($cc,0)),//g,$nick($cc,\n)), %x = $numtok(%c,32), %t = $1-
    while (%x) {
      var %r = $gettok(%c,%x,32), %t = $replace(%t,%r,$+($chr(2),%r,$chr(2)))
      dec %x
    }
    say %t
    haltdef
  }
}
There's a chance that the script may run into an issue if you have a big channel with 100+ people. But for a small channel, this should work a treat. I'm not certain how many tokens are allowed in a local variable before it triggers an error or gets cut off.

Last edited by Tomao; 13/06/11 12:20 AM.
Re: Nick in bold [Re: drb] #232624 13/06/11 01:01 PM
Joined: Jun 2011
Posts: 6
D
drb Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Jun 2011
Posts: 6
could you tell me exactly where to paste the code? does it go in the alias or remote section? or somewhere else?

*my first thought would be the alias section,, but i'm a real newbie to this.

many thanks! smile

Re: Nick in bold [Re: Tomao] #232625 13/06/11 02:25 PM
Joined: Sep 2005
Posts: 2,876
H
hixxy Offline
Hoopy frood
Offline
Hoopy frood
H
Joined: Sep 2005
Posts: 2,876
That $cc will always return the first common channel.

Re: Nick in bold [Re: drb] #232626 13/06/11 02:55 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Scripts posted here will always go in Remote unless specifically stated otherwise. You *can* put any aliases in the Aliases tab, but you will need to remove "alias" from the beginning and if it's a local alias (-l is used), then you either need to remove the -l (making it global) or else leave it in the Remote file so it can remain local. In general, most people like to keep all parts of a script together, so they leave the aliases on the Remote tab with the rest of the script.

Regarding local aliases -- The main reason to make an alias local instead of global is to avoid conflicts with other scripts that may use the same alias name. If you always use unique alias names that are not likely to be in any other script, then global is fine.

And, as hixxy pointed out, the $cc alias isn't correct and will need to be fixed.


Invision Support
#Invision on irc.irchighway.net
Re: Nick in bold [Re: drb] #232627 13/06/11 04:51 PM
Joined: Jun 2011
Posts: 6
D
drb Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Jun 2011
Posts: 6
RE:
And, as hixxy pointed out, the $cc alias isn't correct and will need to be fixed.

i hate to be such a bother, but i haven't a clue what you're talking about here, therefore i don't know how to change it in the above code. if you can tell me exactly what to change in the above code, then i can change it & then do a copy/paste to add it to my script.

thanks again!

Re: Nick in bold [Re: drb] #232628 13/06/11 05:01 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
I am at work and cannot connect to test something like this, which is why I just added the reminder that it would need fixed so you weren't thinking that it would work as-is. Tomao or hixxy or someone else here should be able to provide a fix to it for you. If not, I'll see if I can look it over tonight.

Personally, I'd just make it easy and drop $comchan altogether. In general, you want the nick to be bold in a channel if the nick is in that channel (not if the nick is in another channel that you're in). In that case, there's no need for $comchan at all as you can just check the active channel (or query). Again, I can't test anything right now and would rather not use regex without being able to test it, so I'll have to leave that for someone else to set up.


Invision Support
#Invision on irc.irchighway.net
Re: Nick in bold [Re: drb] #232632 13/06/11 05:32 PM
Joined: Jul 2006
Posts: 3,584
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,584
Just put that code in your remote:
Code:
on *:input:#:{
if (!$istok(/ $readini($mircini,text,commandchar),$left($1,1),32)) && (!$ctrlenter) && (!$inpaste) {
msg $chan $regsubex($1-,/(\S+)/g,$iif(\1 ison $chan,$+($chr(2),\1,$chr(2)),\1))
halt
 }
}



Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Nick in bold [Re: drb] #232633 13/06/11 06:18 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
My bad. I wasn't aware that the $cc will only return the first common channel. I was trying to address the scenario when you reply to a nickname in your PM. There is no $chan in the PM. I thought by using a loop through the common channels would get that matter resolved.

Well, apparently Wims has provided you with a code using the regsubex method. But be advised that you must use mIRC version 6.17 or above for Wims' code to work.

Last edited by Tomao; 13/06/11 06:21 PM.
Re: Nick in bold [Re: drb] #232635 13/06/11 06:49 PM
Joined: Jun 2011
Posts: 6
D
drb Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Jun 2011
Posts: 6
thanks guys but that code makes my lines post twice. in the 1st line the nick *does* come out bold, but not in the 2nd line.

Last edited by drb; 13/06/11 06:55 PM.
Re: Nick in bold [Re: drb] #232636 13/06/11 07:15 PM
Joined: Jul 2006
Posts: 3,584
W
Wims Offline
Hoopy frood
Offline
Hoopy frood
W
Joined: Jul 2006
Posts: 3,584
I tried the code myself, it works fine.
If it sends two messages, it means you have another on input doing basically the same thing.
Did you remove any old on input event taken from here before putting the new one ?


Looking for a good help channel about mIRC? Check #mircscripting @ irc.swiftirc.net
Re: Nick in bold [Re: drb] #232638 13/06/11 07:26 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
You could try changing
Quote:
halt
to
Code:
haltdef
and see if that makes any difference. Having two identical input events, the one that works is the one on top of another, so you can only have one input event, not two.

Last edited by Tomao; 13/06/11 07:31 PM.
Re: Nick in bold [Re: Tomao] #232641 13/06/11 07:34 PM
Joined: Oct 2004
Posts: 8,327
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,327
Originally Posted By: Tomao
My bad. I wasn't aware that the $cc will only return the first common channel. I was trying to address the scenario when you reply to a nickname in your PM. There is no $chan in the PM. I thought by using a loop through the common channels would get that matter resolved.


@Tomao: The loop would be fine except that you use RETURN, which breaks you out of the loop and returns you to the calling script. There isn't a small change to resolve that issue, but you could store the channels in a variable and return the entire list and then work from that in the script. The problem there is variable length and it probably won't be that efficient.

In the case of handling queries, I typically do this: msg $iif($chan,$chan,$nick) some text. That will work as long as your input event is limited to channel and query. In this script, you can put the $iif() into a variable and then use the variable everywhere that you'd need to save space in the script. $active and/or $target may also be valid, but I'd need to double check to make sure as I don't use them too often.

The code Wims posted could easily be adjusted to work with queries by changing the event from # to #,? and replacing \1 ison $chan with \1 ison $chan || $nick and then using the $iif() as mentioned above in the /msg.

As far as input events, he can have 2 if the other is in a separate file. That's probably what happened. Afaik, HALT should be used with input events even though you'd normally use HALTDEF for other events.

@drb: Make sure you don't have the original script still. Check under the View menu in each file to make sure it's not listed there.

Also, if you use any other scripts, they may also be echoing the text. If that's the case, you'd need to either combine this script with what you already have or else remove your other script(s).

Last edited by Riamus2; 13/06/11 07:42 PM.

Invision Support
#Invision on irc.irchighway.net
Re: Nick in bold [Re: Riamus2] #232644 13/06/11 08:10 PM
Joined: Jul 2007
Posts: 1,129
T
Tomao Offline
Hoopy frood
Offline
Hoopy frood
T
Joined: Jul 2007
Posts: 1,129
Thanks Riamus2 for your timely explanation. I do know the comparison for $iif(#,#,$nick) very well. I failed to notice the return used in conjunction with the loop. I believe everybody has one of those days where we get carried away and forget what we should have know better in a subject. This is when a mentor comes in and reminds us of our oversights. After all, this is what mIRC forum is all about, helping each other. smile

Re: Nick in bold [Re: drb] #232675 15/06/11 11:03 AM
Joined: Jun 2011
Posts: 6
D
drb Offline OP
Nutrimatic drinks dispenser
OP Offline
Nutrimatic drinks dispenser
D
Joined: Jun 2011
Posts: 6
thanks everyone! smile