Jump to content

Some Help With Nicklist


TaReK

Recommended Posts

well .. how to identify these modes ~ and & to work with nicklist so that i could add a specific icon with modes ~ &

 

Im fed up with this

 

Menu * {
  Custom Nicklist: NicklistEdit
}

menu nicklist {
  Friends:
  .Add: { 
    var %numnicks $numtok($1-,32)
    while (%numnicks >= 1) {
      if ($checknicks($gettok($1-,%numnicks,32)) == false) {
        if ($dialog(nicklistedit) != $null) { did -a nicklistedit 31 $gettok($1-,%numnicks,32) }
        set %nl.specialnicks $gettok($1-,%numnicks,32) $+ $chr(44) $+ %nl.specialnicks 
      }
      dec %numnicks
    }
  }
  .Remove: { 
    var %nickloc 1
    while (%nickloc <= $numtok($1-,32)) {
      if ($dialog(nicklistedit) != $null) { 
        var %x 1
        while (%x <= $did(nicklistedit,31,0).lines) {
          if ($did(nicklistedit,31,%x).text == $gettok($1-,%nickloc,32)) { did -d nicklistedit 31 %x }
          inc %x
        } 
      } 
      var %y 1 
      while (%y <= $numtok(%nl.specialnicks,44)) {
        if ($gettok(%nl.specialnicks,%y,44) != $gettok($1-,%nickloc,32)) { set %nl.temp_specialnicks $gettok(%nl.specialnicks,%y,44) $+ $chr(44) $+ %nl.temp_specialnicks }
        inc %y
      }
      set %nl.specialnicks %nl.temp_specialnicks
      unset %nl.temp_*
      inc %nickloc
    }
  }
}

#visiblewho off
raw 352:*: { haltdef }
raw 315:*: { haltdef | dec %whochan | if (%whochan <= 0) { .disable #visiblewho | unset %whochan } }
#visiblewho end

alias drawcolorpreview {
  window -hBpf +d @temp.colour -1 -1 16 16
  drawrect -fr @temp.colour $1 1 0 0 16 16
  drawsave @temp.colour " $+ $scriptdirIcons\ $+ $2 $+ .bmp $+ "
  window -c @temp.colour
}
alias nicklust { return $shortfn($scriptdirdlls\nicklust.dll) }
alias colordll { return $shortfn($scriptdirdlls\color.dll) } 

on *:join:*:{
  if ($nick == $me) {
    if (%whochan == $null) set %whochan 1
    else set %whochan $calc(%whochan + 1)
    .nicklist #
    .enable #visiblewho
    .who #
  }
}

alias nicktt {
  if ($1 == color) {
    if ($3 == $me) return %nl.owntext
    elseif ($istokcs(%nl.specialnicks,$3,44)) return %nl.specialtext
    elseif ($3 ishop $active) return %nl.halftext
    elseif ($3 isop $active) return %nl.optext
    elseif ($3 isvoice $active) return %nl.voicetext
    return %nl.regtext
  }

  if ($1 == tooltip) {
    return Nickname: $3 $+ $crlf $+ Address: $address( $+ $3 $+ ,1) $+ $crlf $+ Status: $getStatus($3,$active)
  }
}

alias getStatus {
  if ($istokcs(%nl.specialnicks,$1,44)) return Friends
  elseif ($1 == $me) return Yourself
  elseif ($1 ishop $2) return Halfops
  elseif ($1 isop $2) return Operator
  elseif ($1 isvoice $2) return Voice
  else return Regular
}


alias nicklist {
  dll $nicklust Mark $1 > nicktt borderselect autoarrange balloon
  dll $nicklust SetTipTitle $1 1 > Nickname Info
  dll $nicklust SetTipDelay $1 roll default
  dll $nicklust SetTipColor $1 text %nl.tiptext
  dll $nicklust SetTipColor $1 bkg %nl.tipbkg
  dll $nicklust SetHeaderText $1 > $1

  dll $nicklust SetIcon $1 op > $shortfn(%nl.operator)
  dll $nicklust SetIcon $1 voice > $shortfn(%nl.voice)
  dll $nicklust SetIcon $1 normal > $shortfn(%nl.regular)
  dll $nicklust SetIcon $1 halfop > $shortfn(%nl.halfops)
  dll $nicklust SetColor $1 bkg %nl.bkgcolor
}

alias nicklistedit {
  Dialog -m nicklistedit nicklistedit
}

alias checknicks {
  var %x 1
  while (%x <= $numtok(%nl.specialnicks,44)) {
    if ($gettok(%nl.specialnicks,%x,44) == $1) {
      return true
    }
    inc %x
  }
  return false
}

alias updatenickicon {
  var %x = 1
  while (%x <= $chan(0)) {
    nicklist $chan(%x)
    inc %x
  }
}


dialog NicklistEdit {
  title "Nicklist Preferences"
  size -1 -1 366 218
  option pixels
  tab "Icons", 1, 7 6 350 178
  edit %nl.operator, 4, 61 50 251 19, tab 1 autohs
  edit %nl.voice, 5, 61 85 251 19, tab 1 autohs
  edit %nl.regular, 6, 61 155 251 19, tab 1 autohs
  edit %nl.halfops, 38, 61 118 251 19, tab 1 autohs

  icon 7, 25 35 32 32,  $shortfn($scriptdirIcons\Operator.ico), 0, tab 1
  icon 8, 25 70 32 32,  $shortfn($scriptdirIcons\Voice.ico), 0, tab 1
  icon 9, 25 140 32 32,  $shortfn($scriptdirIcons\Normal.ico), 0, tab 1
  icon 37, 25 105 32 32, $shortfn($scriptdirIcons\Halfops.ico), 0, tab 1

  button "...", 12, 315 53 20 15, tab 1
  button "...", 13, 315 88 20 15, tab 1
  button "...", 14, 315 158 20 15, tab 1
  button "...", 40, 315 123 20 15, tab 1

  text "Operators", 15, 62 37 52 13, tab 1
  text "Voice", 16, 62 71 28 13, tab 1
  text "Normal", 17, 62 142 36 13, tab 1
  text "Halfops", 39, 62 105 50 13, tab 1

  tab "Colours", 2
  text "Operator (+o)", 18, 32 91 89 13, tab 2
  text "Voice (+v)", 19, 32 119 89 13, tab 2
  text "Normal", 20, 149 91 89 13, tab 2
  text "Friends", 21, 149 119 89 13, tab 2
  text "Own Nick", 22, 149 147 89 13, tab 2
  text "Background", 23, 263 147 89 13, tab 2
  text "Halfops (+h)", 41, 32 147 89 13, tab 2
  text "Info Text", 43, 263 91 89 13, tab 2
  text "Info Background", 45, 263 119 89 13, tab 2

  icon 24, 12 86 16 16,  $shortfn($scriptdirIcons\DoNotDel.bmp), 0, tab 2
  icon 25, 12 114 16 16,  $shortfn($scriptdirIcons\DoNotDel.bmp), 0, tab 2
  icon 26, 129 86 16 16,  $shortfn($scriptdirIcons\DoNotDel.bmp), 0, tab 2
  icon 27, 129 114 16 16,  $shortfn($scriptdirIcons\DoNotDel.bmp), 0, tab 2
  icon 28, 129 142 16 16,  $shortfn($scriptdirIcons\DoNotDel.bmp), 0, tab 2
  icon 29, 243 141 16 16,  $shortfn($scriptdirIcons\DoNotDel.bmp), 0, tab 2
  icon 42, 12 142 16 16, $shortfn($scriptdirIcons\DoNotDel.bmp), 0, tab 2
  icon 44, 243 85 16 16, $shortfn($scriptdirIcons\DoNotDel.bmp), 0, tab 2
  icon 46, 243 113 16 16, $shortfn($scriptdirIcons\DoNotDel.bmp), 0, tab 2

  text "To change the colour of the nick of the different groups, just click on the colour and the colour selection dialog will appear.", 30, 50 39 272 41, tab 2 center

  tab "Friends List", 3
  text "New Friend", 36, 22 42 89 19, tab 3
  list 31, 180 33 140 145, tab 3 sort extsel hsbar vsbar
  edit "", 32, 22 55 140 19, tab 3 autohs
  button "Add", 33, 18 77 50 23, tab 3
  button "Remove", 34, 68 77 50 23, tab 3
  button "Clear", 35, 118 77 50 23, tab 3
  button "&Save", 10, 85 190 89 23, ok
  button "&Cancel", 11, 191 190 89 23
}

on *:dialog:NicklistEdit:*:*:{
  if ($devent == init) {
    var %x 1
    while (%x <= $numtok(%nl.specialnicks,44)) {
      did -a NicklistEdit 31 $gettok(%nl.specialnicks,%x,44)
      inc %x
    }
    if ($exists($shortfn(%nl.operator)) == $true) { did -g NicklistEdit 7 $shortfn(%nl.operator) }
    else { set %nl.operator $scriptdirIcons\Parrot.ico | did -ar NicklistEdit 4 %nl.operator }

    if ($exists($shortfn(%nl.voice)) == $true) { did -g NicklistEdit 8 $shortfn(%nl.voice) }
    else { set %nl.voice $scriptdirIcons\Jelly.ico | did -ar NicklistEdit 5 %nl.voice }

    if ($exists($shortfn(%nl.regular)) == $true) { did -g NicklistEdit 9 $shortfn(%nl.regular) }
    else { set %nl.regular $scriptdirIcons\SeaStar.ico | did -ar NicklistEdit 6 %nl.regular }

    if ($exists($shortfn(%nl.halfops)) == $true) { did -g NicklistEdit 37 $shortfn(%nl.halfops) }
    else { set %nl.halfops $scriptdirIcons\Halfops.ico | did -ar NicklistEdit 38 %nl.halfops }

    drawcolorpreview %nl.optext Operator | did -g NicklistEdit 24 $shortfn($ScriptdirIcons\Operator.bmp)
    drawcolorpreview %nl.voicetext Voice | did -g NicklistEdit 25 $shortfn($ScriptdirIcons\Voice.bmp)
    drawcolorpreview %nl.regtext Regular | did -g NicklistEdit 26 $shortfn($ScriptdirIcons\Regular.bmp)
    drawcolorpreview %nl.specialtext Friends | did -g NicklistEdit 27 $shortfn($ScriptdirIcons\Friends.bmp)
    drawcolorpreview %nl.owntext Ownself | did -g NicklistEdit 28 $shortfn($ScriptdirIcons\Ownself.bmp)
    drawcolorpreview %nl.bkgcolor bckgrd | did -g NicklistEdit 29 $shortfn($ScriptdirIcons\bckgrd.bmp)
    drawcolorpreview %nl.tiptext infotxt | did -g NicklistEdit 44 $shortfn($ScriptdirIcons\infotxt.bmp)
    drawcolorpreview %nl.tipbkg infobck | did -g NicklistEdit 46 $shortfn($ScriptdirIcons\infobck.bmp)
    drawcolorpreview %nl.halftext halfops | did -g NicklistEdit 42 $shortfn($ScriptdirIcons\halfops.bmp)

  } 
  if ($devent == sclick) {

    if ($did == 12) { set %nl.temp_operator $sfile($mircdir,Choose operator's icon,Done!) 
      if ($len(%nl.temp_operator) > 0) { did -g NicklistEdit 7 $shortfn(%nl.temp_operator) | did -ar NicklistEdit 4 %nl.temp_operator } 
    }

    if ($did == 13) { set %nl.temp_voice $sfile($mircdir,Choose voice's icon,Done!)
      if ($len(%nl.temp_voice) > 0) { did -g NicklistEdit 8 $shortfn(%nl.temp_voice) | did -ar NicklistEdit 5 %nl.temp_voice }
    }

    if ($did == 14) { set %nl.temp_regular $sfile($mircdir,Choose regular's icon,Done!)
      if ($len(%nl.temp_regular) > 0) { did -g NicklistEdit 9 $shortfn(%nl.temp_regular) | did -ar NicklistEdit 6 %nl.temp_regular }
    }

    if ($did == 40) { set %nl.temp_halfops $sfile($mircdir,Choose regular's icon,Done!)
      if ($len(%nl.temp_halfops) > 0) { did -g NicklistEdit 37 $shortfn(%nl.temp_halfops) | did -ar NicklistEdit 38 %nl.temp_halfops }
    }

    if ($did == 24) { 
      set %nl.temp_optext $dll($colordll,Color,.)) 
      if (%nl.temp_optext != $false) { drawcolorpreview %nl.temp_optext Operator | did -g NicklistEdit 24 $shortfn($ScriptdirIcons\Operator.bmp) }
    }

    if ($did == 25) { 
      set %nl.temp_voicetext $dll($colordll,Color,.))
      if (%nl.temp_voicetext != $false) { drawcolorpreview %nl.temp_voicetext Voice | did -g NicklistEdit 25 $shortfn($ScriptdirIcons\Voice.bmp) }
    }

    if ($did == 26) { 
      set %nl.temp_regtext $dll($colordll,Color,.)) 
      if (%nl.temp_regtext != $false) { drawcolorpreview %nl.temp_regtext Regular | did -g NicklistEdit 26 $shortfn($ScriptdirIcons\Regular.bmp) }
    }

    if ($did == 27) { 
      set %nl.temp_specialtext $dll($colordll,Color,.))      
      if (%nl.temp_specialtext != $false) { drawcolorpreview %nl.temp_specialtext Friends | did -g NicklistEdit 27 $shortfn($ScriptdirIcons\Friends.bmp) }
    }

    if ($did == 28) { 
      set %nl.temp_owntext $dll($colordll,Color,.))
      if (%nl.temp_owntext != $false) { drawcolorpreview %nl.temp_owntext Ownself | did -g NicklistEdit 28 $shortfn($ScriptdirIcons\Ownself.bmp) }
    }

    if ($did == 29) { 
      set %nl.temp_bkgcolor $dll($colordll,Color,.)) 
      if (%nl.temp_bkgcolor != $false) { drawcolorpreview %nl.temp_bkgcolor bckgrd | did -g NicklistEdit 29 $shortfn($ScriptdirIcons\bckgrd.bmp) }
    }

    if ($did == 42) { 
      set %nl.temp_halftext $dll($colordll,Color,.)) 
      if (%nl.temp_halftext != $false) { drawcolorpreview %nl.temp_halftext halfops | did -g NicklistEdit 42 $shortfn($ScriptdirIcons\halfops.bmp) }
    }

    if ($did == 44) { 
      set %nl.temp_tiptext $dll($colordll,Color,.)) 
      if (%nl.temp_tiptext != $false) { drawcolorpreview %nl.temp_tiptext infotxt | did -g NicklistEdit 44 $shortfn($ScriptdirIcons\infotxt.bmp) }
    }

    if ($did == 46) { 
      set %nl.temp_tipbkg $dll($colordll,Color,.)) 
      if (%nl.temp_tipbkg != $false) { drawcolorpreview %nl.temp_tipbkg infobck | did -g NicklistEdit 46 $shortfn($ScriptdirIcons\infobck.bmp) }
    }

    if ($did == 33) { 
      if ($len($did(NicklistEdit,32).text) > 0) {
        if ($checknicks($did(NicklistEdit,32).text) == false) {
          did -a NicklistEdit 31 $did(NicklistEdit,32).text 
        }
        did -r NicklistEdit 32 
      }
    }
    if ($did == 10) { 
      if ($len($did(NicklistEdit,4).text) >= 5 && $exists($shortfn($did(NicklistEdit,4).text)) == $true) { set %nl.operator $did(NicklistEdit,4).text }
      if ($len($did(NicklistEdit,5).text) >= 5 && $exists($shortfn($did(NicklistEdit,5).text)) == $true) { set %nl.voice $did(NicklistEdit,5).text }
      if ($len($did(NicklistEdit,6).text) >= 5 && $exists($shortfn($did(NicklistEdit,6).text)) == $true) { set %nl.regular $did(NicklistEdit,6).text }
      if ($len($did(NicklistEdit,38).text) >= 5 && $exists($shortfn($did(NicklistEdit,38).text)) == $true) { set %nl.halfops $did(NicklistEdit,38).text }

      if (%nl.temp_optext != $false) && (%nl.temp_optext != $null) { set %nl.optext %nl.temp_optext }
      if (%nl.temp_voicetext != $false) && (%nl.temp_voicetext != $null)  { set %nl.voicetext %nl.temp_voicetext }
      if (%nl.temp_regtext != $false) && (%nl.temp_regtext != $null)  { set %nl.regtext %nl.temp_regtext }
      if (%nl.temp_bkgcolor != $false) && (%nl.temp_bkgcolor != $null)  { set %nl.bkgcolor %nl.temp_bkgcolor }
      if (%nl.temp_owntext != $false) && (%nl.temp_owntext != $null)  { set %nl.owntext %nl.temp_owntext }
      if (%nl.temp_specialtext != $false) && (%nl.temp_specialtext != $null)  { set %nl.specialtext %nl.temp_specialtext }
      if (%nl.temp_halftext != $false) && (%nl.temp_halftext != $null)  { set %nl.halftext %nl.temp_halftext }
      if (%nl.temp_tiptext != $false) && (%nl.temp_tiptext != $null)  { set %nl.tiptext %nl.temp_tiptext }
      if (%nl.temp_tipbkg != $false) && (%nl.temp_tipbkg != $null)  { set %nl.tipbkg %nl.temp_tipbkg }

      if ($did(NicklistEdit,31,0).lines > 0) {
        var %x 1
        unset %nl.specialnicks
        while (%x <= $did(NicklistEdit,31,0).lines) {
          set %nl.specialnicks $did(NicklistEdit,31,%x).text $+ $chr(44) $+ %nl.specialnicks
          inc %x
        } 
      } 
      if ($did(NicklistEdit,31,0).lines <= 0) { unset %nl.specialnicks }
      unset %nl.temp*
      updatenickicon
    }

    if ($did == 34) && ($did(NicklistEdit,31,0).sel != 0) { did -d NicklistEdit 31 $did(NicklistEdit,31).sel }
    if ($did == 35) { did -r NicklistEdit 31 }

    if ($did == 11) { unset %nl.temp* | dialog -x NicklistEdit }
  }
}

Edited by TaReK
Link to comment
Share on other sites

i use this alias to work it out

 

alias nickicon {
  if ($left($nick($active,$1).pnick,1) == ~) return 1
  if ($left($nick($active,$1).pnick,1) == &) return 2
  if ($left($nick($active,$1).pnick,1) == +) return 4
  if ($left($nick($active,$1).pnick,1) == %) return 2
  else return 3
}

 

and in the lopp adding the nicks i use

 

did -a nicklist 1 0 + $nickicon($nick($active,%x)) $nick($active,%x)

Edited by Haggis
Link to comment
Share on other sites

this is my code that warrior helpe dme with if it helps

 

 

dialog nicklist {
  title "Nick"
  size -1 -1 86 314
  option dbu
  list 1, 10 20 75 293, size extsel hsbar vsbar
  text "Room name", 2, 3 2 80 8
  text "Chatters:", 3, 3 10 43 8
  text "num", 4, 54 11 29 8, right
  button "", 5, 1 21 8 283
}

menu channel {
  Nicklist:
  .Turn Nicklist On: {
  ;This will turn the nicklist on for each channel you use it in.
    if ($dialog(nicklist $+ $active)) dialog -c nicklist $+ $active nicklist
    dialog -m nicklist $+ $active nicklist
  ;The codes above will determine if the nicklist for a channel is already running. If it is it will close, and reactivate it.
  }
  .Turn Nicklist off: dialog -c nicklist $+ $active nicklist
}

on *:dialog:nicklist*:init:*: {
  dll dll\mdx.dll MarkDialog $dname
  dll dll\mdx.dll SetMircVersion $version
  dll dll\mdx.dll SetDialog $dname style
  dll dll\mdx.dll SetFont $dname 1 12 50 verdana
  dll dll\mdx.dll SetColor $dname 1 text $rgb (0,0,139)
  dll dll\mdx.dll SetControlMDX $dname 1 ListView report showsel noheader smallicon hottrack single > dll\views.mdx
  dll dll\mdx.dll SetControlMDX $dname 5 scrollbar vertical > dll\ctl_gen.mdx
;The code above transforms the button above into a vertical scrollbar.
  did -i $dname 1 1 headerdims $calc($gettok($dll(dll\nicklist.dll,GetSize,$active),1,38) - 6) $+ :1 0:2
  dll dll\nicklist.dll Nicklist $dname $active
;The code above attaches your custom nicklist to the one in mIRC.
  did -ra $dname 5 1 0 114 15 2 1
  did -i $dname 1 1 iconsize normal small
  did -i $dname 1 1 seticon normal c:\mirc\icons\owner.ico
  did -i $dname 1 1 seticon normal c:\mirc\icons\host.ico
  did -i $dname 1 1 seticon normal c:\mirc\icons\no.ico
  did -i $dname 1 1 seticon normal c:\mirc\icons\voice.ico
  did -i $dname 1 1 seticon normal c:\mirc\icons\tick.ico
  listnicks
}

on *:dialog:nicklist*:*:*: {
  if ($devent == sclick) {
    if ($did == 1) echo -a $did(1).seltext
    if ($did == 5) relistnicks
  }
  elseif ($devent == close) .timerresize. $+ $remove($dialog(nicklist*),nicklist) off
}

on *:join:#: listnicks
on *:part:#: listnicks
on *:kick:#: listnicks

alias listnicks {
  did -ra nicklist $+ $active 4 $nick($active,0)
  did -ra nicklist $+ $active 2 $active
  var %x = 1
  did -r nicklist $+ $active 1
  while ($nick($active,%x)) {
    did -az nicklist $+ $active 1 0 + $nickicon($nick($active,%x)) $nick($active,%x)
    inc %x

  }
  .timerresize. $+ $active -m 0 1 resize $active
;This code resizes the nicklist if it needs to. Otherwise, it won't do anything.
}

;This code is used for scrolling with the scrollbar. It deletes the top names from the list while scrolling down, and readds them when scrolling up. It calculates the position of the scrollbar to determine which nicknames to add, and which to delete. Therefore giving it a scrolling perspective.
alias relistnicks {
  .remove nicklist.txt
  var %x = $gettok($calc($did(nicklist $+ $active,1).lines * $gettok($did(nicklist $+ $active,5).text,1,32) / 100),1,$asc(.))
  did -r nicklist $+ $active 1
  while ($nick($active,%x)) {
    write -l $+ %x nicklist.txt 0 + $nickicon($nick($active,%x)) $nick($active,%x)
    inc %x
  }
   loadbuf -ro nicklist $+ $active 1 nicklist.txt
  .timerresize. $+ $chan -m 0 1 resize $active
}
alias nickicon {
  if ($left($nick($active,$1).pnick,1) == ~) return 1
  if ($left($nick($active,$1).pnick,1) == &) || ($left($nick($active,$1).pnick,1) == @) return 2
  if ($left($nick($active,$1).pnick,1) == +) return 4
  if ($left($nick($active,$1).pnick,1) == %) return 2
  else return 3
}

;The following alias checks to see if the nicklist needs to be resized for whatever reason. If the nicklist isn't the size of mIRC's nicklist it will resize to compensate.
alias resize {
  var %achan $1-
  if ($dialog(nicklist $+ %achan)) {
    if ($dialog(nicklist $+ %achan).w $dialog(nicklist $+ %achan).h > $dll(dll\nicklist.dll,GetSize,%achan)) || ($dialog(nicklist $+ %achan).w $dialog(nicklist $+ %achan).h < $dll(dll\nicklist.dll,GetSize,%achan)) {
      dll dll\mdx.dll SetDialog nicklist $+ %achan coords 0 0 $dll(dll\nicklist.dll,GetSize,%achan)
      dll dll\mdx.dll MoveControl nicklist $+ %achan 1 * * $gettok($dll(dll\nicklist.dll,GetSize,%achan),1,32) 2000
      if ($dialog(nicklist $+ %achan)) {
        did -i nicklist $+ %achan 1 1 headerdims $calc($gettok($dll(dll\nicklist.dll,GetSize,%achan),1,38) - 6) $+ :1 0:2
      }
      listnicks
    }
  }
}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...