mIRC Home    About    Download    Register    News    Help

Print Thread
How can I add tags into this code? #191697 14/12/07 01:27 AM
Joined: Aug 2007
Posts: 48
E
EnglishExpress Offline OP
Ameglian cow
OP Offline
Ameglian cow
E
Joined: Aug 2007
Posts: 48
Hi I would like to add something like:

Quote:
0 14:13×14: This when I talk... 14:13×14:


But I don't know how to do it, but I know if I use another input it will clash with this code:

Code:
on *:input:*: {
  if (($istok(channel query,$window($active).type,32)) && (/* !iswm $1) && (!$ctrlenter)) { 

    ; -------- START OF SETUP -------- 
    ; this is the string of badwords to replace. syntax: badword1 replaceword1,badword2 replaceword2, ...
    ; note: do not enter equal badwords and replace words, e.g. you must not enter "dick DiCk" 
    ; - otherwise your script will freeze in an infinite loop

    var %bad = fuck fúck,pussy pússy,motherfucker motherfúcker,fucking fúcking,O_O O_O,>_< >_<,^.^ ^.^,pussy pússy,cunt cúnt,cunts cúnts,slut slút,sluts slúts,dick díck,dicks dícks,incest íncest,incestual íncestual,nigger nígger,niggers níggers,shit shít,bitch bítch,bitches bítches,cum cúm,cumming cúmming,cock cóck,whore whóre,whores whóres,homo hómo,homos hómos,fag fág,faggot fággot,faggots fággots 

    ; 2) this is the place where you can define how the first word should look like
    ; if it is a nickname of that chan or the nick of that query
    ; note: use NICK as placeholder 

    var %nickstyle = 6..4 $+ NICK $+ 6..

    ; -------- END OF SETUP -------- 

    ; start processing all badwords
    var %text = $1-, %nr = 1
    while $gettok(%bad,%nr,44) {
      var %token = $v1
      ; replace each badword with the replace-word defined above, but keep the badword's initial case
      while ($findtok(%text,$gettok(%token,1,32),1,32)) {
        var %match = $v1
        var %new = $+($($+($chr(36),$iif(($left($gettok(%text,%match,32),1) isupper),upper,lower), $& 
          ($left($gettok(%token,2,32),1))),2),$mid($gettok(%token,2,32),2))
        var %text = $puttok(%text,%new,%match,32)
      }
      inc %nr
    }

    ; start checking all words for being a nick followed by a ":" char
    var %nr = 1
    while ($gettok(%text,%nr,32)) {
      var %token = $left($v1,-1)
      if (($regex($v1,/.+:/s)) && ((%token ison $active) || (%token == $query($active)))) {
        ; replace the nick with the nickstyle defined above
        var %text = $puttok(%text,$+($replacecs(%nickstyle,NICK,%token),$chr(15)),%nr,32)
      }
      inc %nr
    }

    ; output of the text
    msg $active %text
    halt 
  }
}
 


Excuse the language please, I never made it! lol but yeah anyways, I want the first tag I stated to work within this code, but I want it to have an optional on/off thing incase I don't want to use the tag, but I don't want the swear input/nick complete to be optional ...

I'm not sure if that made any sense to you.. but it's the best I could explain :S ty

Last edited by EnglishExpress; 14/12/07 01:28 AM.
Re: How can I add tags into this code? [Re: EnglishExpress] #191706 14/12/07 07:20 AM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
hopefully this is what you want, I added a variable for on and off and in order to USE your talker on or off you have to type TEXT ON for on or TEXT OFF for off.

In the area of %text this is where I adapted your string you wanted. personally I would re-write this but its 2:19AM in the morning..

Code:
on *:input:*: {
  if ($1 == TEXT) { %t.sw == $iif($2 == on,on,off) }
; *************ON/OFF switch ADDED****************
  elseif (($istok(channel query,$window($active).type,32)) && (/* !iswm $1) && (!$ctrlenter)) { 
    var %bad = fuck fúck,pussy pússy,motherfucker motherfúcker,fucking fúcking,O_O O_O,>_< >_<,^.^ ^.^,pussy pússy,cunt cúnt,cunts cúnts,slut slút,sluts slúts,dick díck,dicks dícks,incest íncest,incestual íncestual,nigger nígger,niggers níggers,shit shít,bitch bítch,bitches bítches,cum cúm,cumming cúmming,cock cóck,whore whóre,whores whóres,homo hómo,homos hómos,fag fág,faggot fággot,faggots fággots 
    var %nickstyle = 6..4 $+ NICK $+ 6..
    var %text = 0 14:13×14:  $+ $1- $+ 14:13×14: , %nr = 1
; ************ADAPTED STRING HERE*********************
    while $gettok(%bad,%nr,44) {
      var %token = $v1
      while ($findtok(%text,$gettok(%token,1,32),1,32)) {
        var %match = $v1
        var %new = $+($($+($chr(36),$iif(($left($gettok(%text,%match,32),1) isupper),upper,lower), $& 
          ($left($gettok(%token,2,32),1))),2),$mid($gettok(%token,2,32),2))
        var %text = $puttok(%text,%new,%match,32)
      }
      inc %nr
    }
    var %nr = 1
    while ($gettok(%text,%nr,32)) {
      var %token = $left($v1,-1)
      if (($regex($v1,/.+:/s)) && ((%token ison $active) || (%token == $query($active)))) {
        var %text = $puttok(%text,$+($replacecs(%nickstyle,NICK,%token),$chr(15)),%nr,32)
      }
      inc %nr
    }
    if (%t.sw == off) { msg $active $1- }
    else { msg $active %text }
; ***************ON/OFF CHECK switch here************
    halt 
  }
}


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: How can I add tags into this code? [Re: Lpfix5] #191717 14/12/07 11:23 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
I'd think a /text on, /text off command would be better than looking for "text" in an on INPUT event.


Invision Support
#Invision on irc.irchighway.net
Re: How can I add tags into this code? [Re: Riamus2] #191768 15/12/07 04:47 PM
Joined: Aug 2005
Posts: 1,052
L
Lpfix5 Offline
Hoopy frood
Offline
Hoopy frood
L
Joined: Aug 2005
Posts: 1,052
Actually with the if elseif elseif statements and between writting seperate alias's theres no difference atleast non to the naked eye


Code:
if $reality > $fiction { set %sanity Sane }
Else { echo -a *voices* }
Re: How can I add tags into this code? [Re: Lpfix5] #191819 16/12/07 11:24 AM
Joined: Oct 2004
Posts: 8,330
Riamus2 Offline
Hoopy frood
Offline
Hoopy frood
Joined: Oct 2004
Posts: 8,330
Other than that you're sending the "text on" and "text off" to the channel/query when you could just use a command to enable/disable it. Beyond that, using groups would probably be a better method, though that really isn't so important.

That and someone may manage to write a line that starts with "text". Your check will always turn off text if $2 isn't equal to "on" and even if you checked $2 for off, you could still have someone manage to write a line starting with "text on" or "text off" since you're not limiting the text to 2 words.


Invision Support
#Invision on irc.irchighway.net