mIRC Home    About    Download    Register    News    Help

Page 1 of 2 1 2 >
Topic Options
#112717 - 26/02/05 07:15 AM Custom Window / Query
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
I've been working on something to handle all my query's into a custom window. When someone pm's me it writes their nick to the list and when you double click the window you can private chat with them just like you would in a normal query window. When the window @Quer is closed and re-opened when you get another pm from them and you double click their nickname in the listbox you'll see recent history, my question is how could I improve it, what does it need.



Here is the code.

Code:
alias Quer {
  if (!$window(@Quer)) { 
    window -deSl11k0 @Quer 245 250 594 266 
  }
  else {
    return
  }
}

on ^*:Text:*:?: {
  closemsg $nick
  if (!$exists(QuerLogs)) {
    mkdir QuerLogs
    write QuerLogs\Quer. $+ $nick $+ .txt  $chr(91) $+ $time(HH:nn) $+ $chr(93) < $+ $nick $+ > $1-
    quer
    savebuf -a 1-$line(@Quer,0) @Quer QuerLogs\Quer. $+ $sline(@Quer,1) $+ .txt
    if ($fline(@Quer,$nick,0,1)) {
      return
    }
    elseif (!$fline(@Quer,$nick,0,1)) {
      aline -l @Quer $nick 
    }
  }
  else {
    write QuerLogs\Quer. $+ $nick $+ .txt $chr(91) $+ $time(HH:nn) $+ $chr(93) < $+ $nick $+ > $1-
    Quer
    savebuf -a 1-$line(@Quer,0) @Quer QuerLogs\Quer. $+ $sline(@Quer,1) $+ .txt
    if ($fline(@Quer,$nick,0,1)) {
      return 
    }
    elseif (!$fline(@Quer,$nick,0,1)) { 
      aline -l @Quer $nick 
    }
  }
}

menu @Quer {
  dclick: {
    dline @Quer 1- $+ $line(@Quer,0)
    if ($sline(@Quer,0) == 1) {
      renwin @Quer @Quer $chr(160) - $chr(160) Conversation with $sline(@Quer,1)
      loadbuf $lines(QuerLogs\Quer. $+ $sline(@Quer,1) $+ .txt) @Quer QuerLogs\Quer. $+ $sline(@Quer,1) $+ .txt
    }
  }
  Close $1 Conversation: {
    if ($sline(@Quer,0) < 2) {
      .timer 1 1 dline -l @Quer $sline(@Quer,1).ln
    }
  }
  Delete $1 History: {
    if ($sline(@Quer,0) < 2) {
      dline -l @Quer $sline(@Quer,1).ln
      .remove QuerLogs\Quer. $+ $1 $+ .txt
    }
  }
}

on 1:Input:@Quer: {
  .quer.msg $1-
}

alias quer.msg {
  if ($sline(@Quer,0) == 1) && ($window(@Quer)) {
    if ($input(Secure Send Message $+ $crlf $+ Send this message to $sline(@Quer,1) $+ ? $+ $crlf $+ $crlf $+ $1-,c,Send Message.) == $true) {
      .Raw PRIVMSG $sline(@Quer,1) : $1-
      aline -p @Quer $chr(91) $+ $time(HH:nn) $+ $chr(93) < $+ $me $+ > $1-
      savebuf -a 1-$line(@Quer,0) @Quer QuerLogs\Quer. $+ $sline(@Quer,1) $+ .txt
    }
    else { 
editbox @Quer $1-
 }
  }
  else { 
    return
  }
}

on 1:Keydown:@Quer:*: {
  splay sounds\typewriter.wav
  if ($keyval == 27) { window -c @Quer }
}


Edited by SladeKraven (26/02/05 08:09 AM)

Top
#112718 - 26/02/05 08:22 AM Re: Custom Window / Query
Iori Offline
Hoopy frood

Registered: 30/08/03
Posts: 1831
Well, here's a few changes smile

Code:
alias Quer if (!$window(@Quer)) { window -deSl11k0 @Quer 245 250 594 266 }

^ Doesn't even really need that if, unless you want to prevent it re-positionng itself

Quote:
savebuf -a 1-$line(@Quer,0) @Quer QuerLogs\Quer. $+ $sline(@Quer,1) $+ .txt

-a will add al of the windows buffer to the logfile. :tongue: (well it would except for 1-$line(@Quer,0) won;t work like that.) Needs to be $+(1-,$line(@Quer,0))
Why not just /write the line to the file?

Code:
    /*
    if ($fline(@Quer,$nick,0,1)) {
      return
    }
    elseif (!$fline(@Quer,$nick,0,1)) {
      aline -l @Quer $nick 
    }
    [color:green]Don't need that ^, Just use[/color]
    */
    aline -l[color:red]n[/color] @Quer $nick


You don't need that else in the text event. (Nor a text event seeing as you immediately close the window smile)
Code:
on ^*:[color:blue]open[/color]:?:{
  mkdir QuerLogs
  write $+(QuerLogs\Quer.,$nick,.txt [,$time(HH:nn),] <,$nick,>) $1-
  quer
  savebuf -a $+(1-,$line(@Quer,0)) @Quer QuerLogs\Quer. $+ $sline(@Quer,1) $+ .txt
  aline -ln @Quer $nick
  [color:blue]halt[/color]
}


Code:
alias quer.msg {
  if ($sline(@Quer,0) == 1) {
    if ($input(Secure Send $+(Message,$crlf,Send this message to $!sline(@Quer,1),?,$crlf,$crlf,$1-),c,Send Message.)) {
      PRIVMSG $sline(@Quer,1) $1-
      aline -p @Quer $+([,$time(HH:nn),] <,$me,>) $1-
      write $+(QuerLogs\Quer.,$sline(@Quer,1),.txt) $+([,$time(HH:nn),] <,$me,>) $1-
      ; writing the single line rather than adding the entire buffer to the file (again)
    }
    else { editbox @Quer $1- }
  }
}

Top
#112719 - 26/02/05 08:47 AM Re: Custom Window / Query
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
Should that be: On ^*:Open:?:*: { ?

And is this correct, if not could you show me where needs correcting please?

Code:
alias Quer {
  if (!$window(@Quer)) { 
    window -deSl11k0 @Quer 245 250 594 266 
  }
  else {
    return
  }
}

on ^*:open:?:*: {
  mkdir QuerLogs
  write $+(QuerLogs\Quer.,$nick,.txt [,$time(HH:nn),] <,$nick,>) $1-
  quer
  savebuf -a 1-$line(@Quer,0) @Quer QuerLogs\Quer. $+ $sline(@Quer,1) $+ .txt
  aline -ln @Quer $nick
  echo @Quer $+([,$time(HH:nn),] <,$nick,>) $1-
  halt
}

menu @Quer {
  dclick: {
    dline @Quer 1- $+ $line(@Quer,0)
    if ($sline(@Quer,0) == 1) {
      renwin @Quer @Quer $chr(160) - $chr(160) Conversation with $sline(@Quer,1)
      loadbuf $lines(QuerLogs\Quer. $+ $sline(@Quer,1) $+ .txt) @Quer QuerLogs\Quer. $+ $sline(@Quer,1) $+ .txt
    }
  }
  Close $1 Conversation: {
    if ($sline(@Quer,0) < 2) {
      .timer 1 1 dline -l @Quer $sline(@Quer,1).ln
    }
  }
  Delete $1 History: {
    if ($sline(@Quer,0) < 2) {
      dline -l @Quer $sline(@Quer,1).ln
      .remove QuerLogs\Quer. $+ $1 $+ .txt
    }
  }
}

on 1:Input:@Quer: {
  .quer.msg $1-
}

alias quer.msg {
  if ($sline(@Quer,0) == 1) {
    if ($input(Secure Send $+(Message,$crlf,Send this message to $!sline(@Quer,1),?,$crlf,$crlf,$1-),c,Send Message.)) {
      PRIVMSG $sline(@Quer,1) $1-
      write $+(QuerLogs\Quer.,$sline(@Quer,1),.txt) $+([,$time(HH:nn),] <,$me,>) $1-
      ; writing the single line rather than adding the entire buffer to the file (again)
    }
    else { editbox @Quer $1- }
  }
}


on 1:Keydown:@Quer:*: {
  splay sounds\typewriter.wav
  if ($keyval == 27) {
    window -c @Quer
  }
}


I've not been to sleep yet, I'm wrecked, and lord...in 25 minutes I've got to go the park and train football (soccer) to little children on a rainy day. The joy.. mad

Cheers for your suggestions an all, greatly appreciated.

Top
#112720 - 26/02/05 08:57 AM Re: Custom Window / Query
Iori Offline
Hoopy frood

Registered: 30/08/03
Posts: 1831
Er no, it only needs to be "on ^*:open:?:{" sorry laugh

I already showed the "Quer" alias...
Quote:
Code:
alias Quer if (!$window(@Quer)) { window -deSl11k0 @Quer 245 250 594 266 }


I already showed the mistake in "1-$line()"

Maybe go away and re-read after you have slept laugh

BTW: Forgot to mention about PRIVMSG, mIRC will add the colon in the appropriate position, and it is already a silent command. smile

Top
#112721 - 26/02/05 09:03 AM Re: Custom Window / Query
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
Yeah will do man, cheers. smile

Shower time now, I'm way behind schedule, I usually spend 40 minutes in the bathroom, showering,shaving styling hair I'm like a woman, just don't tell anyone.

Cya dude, keep cool. grin

Top
#112722 - 26/02/05 08:46 PM Re: Custom Window / Query
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
I liked your idea so much that I took your script and worked it up a small amount an am using it myself now all the time, I have also taken on Iori's comments, i thought id share it to show what I thought of that might improve it.

Code:
alias QuerWindow {
  set %QuerWindow $+(@Message,$chr(160),Queuer)
  if (!$window(%QuerWindow)) { window -deSl11k0 %QuerWindow 245 250 594 266 @Quer.MENU }
  return %QuerWindow
}
;
on ^*:Open:?:*: { quer.open.and.text.event $1- }
on ^*:Text:*:?: { quer.open.and.text.event $1- }
alias quer.open.and.text.event {
  mkdir QuerLogs
  write $+(QuerLogs\Quer.,$nick,.txt) $+([,$time(HH:nn),] <,$nick,>) $1-
  aline -ln $QuerWindow $nick 
  if ($sline($QuerWindow,1) == $nick) { aline -pi $QuerWindow $+([,$time(HH:nn),] <,$nick,>) $1- }
  closemsg $nick | halt
}
;
menu @Quer.MENU {
  lbclick: {
    sline -l $QuerWindow $1
    clear $QuerWindow
    if ($sline($QuerWindow,0) == 1) {
      quer.titlebar 
      loadbuf -pi $QuerWindow $+(QuerLogs\Quer.,$sline($QuerWindow,1),.txt)
    }
  }
  Close $$1 Conversation: {
    if ($sline($QuerWindow,0) == 1) {
      clear $QuerWindow
      dline -l $QuerWindow $sline($QuerWindow,1).ln
    }
  }
  Delete $$1 History: {
    if ($sline($QuerWindow,0) == 1) {
      clear $QuerWindow
      dline -l $QuerWindow $sline($QuerWindow,1).ln
      .remove $+(QuerLogs\Quer.,$1,.txt)
    }
  }
}
;
on *:input:@:{
  if ($active == %QuerWindow) {
    if ((%QuerTextWin) || ($ctrlenter) || (/* !iswm $1-)) { .quer.msg $1- }
    else { .timer 1 0 savebuf $QuerWindow $+(QuerLogs\Quer.,$sline($QuerWindow,1),.txt) }
  }
}
alias quer.msg {
  if ($sline($QuerWindow,0) == 1) {
    if ((%QuerConfirmOff) || ($input(Secure Send Message $+ $crlf $+ Send this message to $sline($QuerWindow,1) $+ ? $+ $crlf $+ $crlf $+ $1-,c,Send Message.) == $true)) {
      PRIVMSG $sline($QuerWindow,1) $1-
      aline -p $QuerWindow $+([,$time(HH:nn),] <,$me,>) $1-
      haltdef
    }
    else { editbox $QuerWindow $1- }
    savebuf $QuerWindow $+(QuerLogs\Quer.,$sline($QuerWindow,1),.txt)
  }
}
;
on *:Keydown:%QuerWindow:*: {
  ;splay sounds\typewriter.wav
  if ($keyval == 18) { 
    var %cycle = $!false $!false/$true $!false/$true $!true/$false $!true/$false $!false
    var %cycle = $gettok(%cycle,$calc($findtok(%cycle,%QuerTextWin %QuerConfirmOff,1,47)+1),47)
    set %QuerTextWin $gettok(%cycle,1,32)
    set %QuerConfirmOff $gettok(%cycle,2,32)
    Quer.Titlebar
  }
  elseif ($keyval == 27) { window -c $QuerWindow }
}
;
alias Quer.Titlebar { titlebar $QuerWindow - Conversation with $sline($QuerWindow,1) - $iif(%QuerTextWin,TW,NW) - $iif(%QuerConfirmOff,IM,CM) }


Top down...
(1) I Dont like hardcoding window names into scripts if i can avoid it, so I call an $identifier alias to get me the window name, it also creates the window if its not there , and stores a global var of the name. $QuerWindow (i happend to have renamed the window, but its the first line of the alias so not hard to see smile )
(2) I identify the menu by naming it on the window creation line, lets me rename the window without having menu problems.
(3) triggering on OPEN and TEXT events, doing a closemsg and halt at the event ends to cover for both
(4) you should only write the event line text to the window if the matching $nick is the highlighted one, you were doing it all the time
(5) changed to lbclick, and set the only selected line to the one u just clicked on, since you can only see one at a time.
(6) used /clear instead of dline to clear the window, also clearing the window in the close and history options
(7) changed the titlebar of the window rather than renaming the window
(8) on *:input:@: and not on *:input:%QuerWindow: becuase mirc is broken and doesnt accept a var in there, so i just check if its the $active window
(9) accounted for /commands being entered and/or ctrlenter being pressed
(10) I thought it better to savebuf the whole window, that way you get results of any command you ran that did local echos etc, anything that appeared in the window etc
(11) Pressing ctrl-alt cycles through 4 states the window can be in TW or NW and CM or IM
* TW is a text only Window if you type /echo BLAH its send like you have the ctrl key down with enter
* NW is a normal window behavour
* CM is Confirm the message send
* IM is instantly send the message

Top
#112723 - 27/02/05 04:20 AM Re: Custom Window / Query
Skeletor Offline
Vogon poet

Registered: 24/02/05
Posts: 185
Loc: Nottingham, England
Hey guys, that is some great coding, now what i would like to know is... it states "Secure Send Message" now was that just a hyperthetical or is it actually secure, both myself and a friend have both used this code in our Remotes, but now would there be a way to make it for DCC as well?
_________________________
sub-zero.homeip.net:6667


Top
#112724 - 27/02/05 04:35 AM Re: Custom Window / Query
Lord_Raiden Offline
Pikka bird

Registered: 26/02/05
Posts: 10
Loc: South Africa
Lord_Raiden tips hat

This is an awsome idea!! I like it much!!

1) Wot I would like is for this little window to pop up, everytime I receive a msg, not just when I receive a new message.

2) Can the nicks, that are already present in the nicklist, change colour when a response is received? How would one do this?

thanks for all the good stuff chaps!

Lord_Raiden tips hat

Top
#112725 - 27/02/05 07:43 AM Re: Custom Window / Query
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
Nice improvements, this was going to be the last thing I was going to code too. grin

Top
#112726 - 27/02/05 08:44 AM Re: Custom Window / Query
Lord_Raiden Offline
Pikka bird

Registered: 26/02/05
Posts: 10
Loc: South Africa
Lord_Raiden tips hat

Glad you like. laugh

In my script, this little window is see-thru. laugh
In straight mIRC, it's not.

Why would that be? confused

Also, can i suggest a whois, chan scan & clone scan in that same window, which is not the case now...

The nickchange msg and quit msg from a nick, in the event of that nick leaving or changing would also b handy.

Lord_Raiden tips hat

Top
#112727 - 27/02/05 04:18 PM Re: Custom Window / Query
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
Just an update for the improvements made by DaveC and Iori on the Query script I made. Only 2 minor updates.

Code:
alias QuerWindow {
    set %QuerWindow $+(@Message,$chr(160),Queuer)
  if (!$window(%QuerWindow)) { window -odeSl11k0 %QuerWindow 245 250 594 266 @Quer.MENU }
  return %QuerWindow
}

on ^*:Open:?:*: { quer.open.and.text.event $1- }
on ^*:Text:*:?: { quer.open.and.text.event $1- }

alias quer.open.and.text.event {
  mkdir QuerLogs
  write $+(QuerLogs\Quer.,$nick,.txt) $+([,$time(HH:nn),] <,$nick,>) $1-
  aline -ln $QuerWindow $nick 
  if ($sline($QuerWindow,1) == $nick) { aline -pi $QuerWindow $+([,$time(HH:nn),] <,$nick,>) $1- }
  window -h $nick
  halt
}

menu @Quer.MENU {
  dclick:  {
    if ($sline($QuerWindow,0) == 1) {
      whois $sline($QuerWindow,1)
    }
  }
  lbclick: {
    sline -l $QuerWindow $1
    clear $QuerWindow
    if ($sline($QuerWindow,0) == 1) {
      quer.titlebar 
      loadbuf -pi $QuerWindow $+(QuerLogs\Quer.,$sline($QuerWindow,1),.txt)
    }
  }
  Close $$1 Conversation: {
    if ($sline($QuerWindow,0) == 1) {
      clear $QuerWindow
      dline -l $QuerWindow $sline($QuerWindow,1).ln
    }
  }
  Delete $$1 History: {
    if ($sline($QuerWindow,0) == 1) {
      clear $QuerWindow
      dline -l $QuerWindow $sline($QuerWindow,1).ln
      .remove $+(QuerLogs\Quer.,$1,.txt)
    }
  }
}

on *:input:@:{
  if ($active == %QuerWindow) {
    if ((%QuerTextWin) || ($ctrlenter) || (/* !iswm $1-)) { .quer.msg $1- }
    else { .timer 1 0 savebuf $QuerWindow $+(QuerLogs\Quer.,$sline($QuerWindow,1),.txt) }
  }
}
alias quer.msg {
  if ($sline($QuerWindow,0) == 1) {
    if ((%QuerConfirmOff) || ($input(Secure Send Message $+ $crlf $+ Send this message to $sline($QuerWindow,1) $+ ? $+ $crlf $+ $crlf $+ $1-,c,Send Message.) == $true)) {
      PRIVMSG $sline($QuerWindow,1) $1-
      aline -p $QuerWindow $+([,$time(HH:nn),] <,$me,>) $1-
      haltdef
    }
    else { editbox $QuerWindow $1- }
    savebuf $QuerWindow $+(QuerLogs\Quer.,$sline($QuerWindow,1),.txt)
  }
}

on *:Keydown:%QuerWindow:*: {
  if ($exists(sounds\typewriter.wav)) { splay sounds\typewriter.wav } 
  if ($keyval == 18) { 
    var %cycle = $!false $!false/$true $!false/$true $!true/$false $!true/$false $!false
    var %cycle = $gettok(%cycle,$calc($findtok(%cycle,%QuerTextWin %QuerConfirmOff,1,47)+1),47)
    set %QuerTextWin $gettok(%cycle,1,32)
    set %QuerConfirmOff $gettok(%cycle,2,32)
    Quer.Titlebar
  }
  elseif ($keyval == 27) { window -c $QuerWindow }
}

alias Quer.Titlebar { 
  titlebar $QuerWindow - Conversation with $sline($QuerWindow,1) - $iif(%QuerTextWin,TW,NW) - $iif(%QuerConfirmOff,IM,CM) 
}


*Added whois feature when you double click on $sline($QuerWindow,1) it will whois that person
* Added ontop of all windows feature.

Told you they was minor.

Top
#112728 - 27/02/05 05:40 PM Re: Custom Window / Query
Iori Offline
Hoopy frood

Registered: 30/08/03
Posts: 1831
Just a couple minor suggestions
[*] After closing a session re-set the titlebar.
[*] Write session close line to logfiles
Code:
menu @Quer.MENU {
  dclick:  {
    if ($sline($QuerWindow,0) == 1) {
      whois $sline($QuerWindow,1)
    }
  }
  lbclick: {
    sline -l $QuerWindow $1
    clear $QuerWindow
    if ($sline($QuerWindow,0) == 1) {
      quer.titlebar 
      loadbuf -pi $QuerWindow $+(QuerLogs\Quer.,$sline($QuerWindow,1),.txt)
    }
  }
  Close $$1 Conversation: {
    if ($sline($QuerWindow,0) == 1) {
      clear $QuerWindow
[color:blue]      write $+(QuerLogs\Quer.,$1,.txt) Session ended: $+([,$asctime,],$lf,$lf)
      close -m $1 | ; see below
      titlebar $QuerWindow[/color]
      dline -l $QuerWindow $sline($QuerWindow,1).ln
    }
  }
  Delete $$1 History: {
    if ($sline($QuerWindow,0) == 1) {
      clear $QuerWindow
[color:blue]      close -m $1 | ; see below
      titlebar $QuerWindow[/color]
      dline -l $QuerWindow $sline($QuerWindow,1).ln
      .remove $+(QuerLogs\Quer.,$1,.txt)
    }
  }
}

And maybe the on open wasn't great to parse the message from, it doesn't differentiate between text and action. Perhaps hiding the query would be better.
Code:
on ^*:open:?:*:{ query -n $nick | window -h $nick }
on ^*:text:*:?:{ quer.open.and.text.event $1- }
on ^*:action:*:?:{ quer.open.and.text.event $1- }


But then of course you need to change the quer.open.and.text.event alias... smile
[*] Changes to allow for event differentiating.
[*] Color for action msgs.
[*] Window button highlighting.
Code:
alias quer.open.and.text.event {
  mkdir QuerLogs
  var %a = $+([,$time(HH:nn),]) $iif($event == action,* $nick,$+(<,$nick,>)) $1-
  write $+(QuerLogs\Quer.,$nick,.txt) %a
  aline -ln $QuerWindow $nick 
  if ($sline($QuerWindow,1) == $nick) { aline -pi $iif($event == action,$color(action)) $QuerWindow %a }
  window -g1 $QuerWindow
  window -h $nick
  halt[color:green]def[/color]
}

Top
#112729 - 27/02/05 07:29 PM Re: Custom Window / Query
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
Good points. smile

Top
#112730 - 27/02/05 07:59 PM Re: Custom Window / Query
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
Excellent point on adding actions and just hiding the query windows to enable the differences.

I would just say to do this tho...
Code:
alias quer.open.and.text.event {
  mkdir QuerLogs
  var %a = $+($iif($event == action, $+ $color(action)),[,$time(HH:nn),]) $iif($event == action,* $nick,$+(<,$nick,>)) $1-
  write $+(QuerLogs\Quer.,$nick,.txt) %a
  aline -ln $QuerWindow $nick 
  if ($sline($QuerWindow,1) == $nick) { aline -pi $QuerWindow %a }
  window -g1 $QuerWindow
  window -h $nick
  haltdef
}


Cant just set a aline color, as there all trashed when the loadbuf occurs, have to insert it onto the line.

Top
#112731 - 27/02/05 08:07 PM Re: Custom Window / Query
Iori Offline
Hoopy frood

Registered: 30/08/03
Posts: 1831
The line colors are lost in mIRCs reload logs feature too, but it doesn't bother me. smile

Top
#112732 - 27/02/05 08:31 PM Re: Custom Window / Query
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
Doesnt actually bother me either just looks a bit dodgy when you click on the same nicks name and the colors disapear out of lines.

Top
#112733 - 27/02/05 08:35 PM Re: Custom Window / Query
Iori Offline
Hoopy frood

Registered: 30/08/03
Posts: 1831
lol
Well why not disable re-loading if the same nick is selected?

Top
#112734 - 27/02/05 11:35 PM Re: Custom Window / Query
Lord_Raiden Offline
Pikka bird

Registered: 26/02/05
Posts: 10
Loc: South Africa
Lord_Raiden tips hat

Gentleman, (and ladies if any), this is great stuff!

I know nothing bout coding confused, so I copy and paste what i find in the forums here. All these changes and improvements r gr8! grin grin
My problem is this:

1) I have tried to implement the changes in the code that i have for this window, but I have messed up somewhere, cos I cant get it to work now. Is it possible to get the whole code as it is atm?

2) I noticed that when the nicks in this little window reaches a certain number, it doesn't work anymore, ie the new queries happen in the "old" fashion, and not in the little window... Why is this?

3) When a person u r in pvt convo with in this little window changes his/her nick to another, the nick in the window doesn't update, so u end up sending to a nick that doesn't exist anymore, but u don't realy notice it untill u receive no responses from the person or check in your status window.
How can this b fixed?

4) Most of all thanks for the excellent answers and stuff on these forums. We (the noobs) enjoy it much!

Lord_Raiden tips hat

Top
#112735 - 28/02/05 02:08 AM Re: Custom Window / Query
Lord_Raiden Offline
Pikka bird

Registered: 26/02/05
Posts: 10
Loc: South Africa
Lord_Raiden tips hat

I found a bit of a bug...

1) If a nick has a character in it that cant be used in the name of a *.txt file, the query message will not be entered into the message queuer window, it will happen the normal way as if you are running normal mIRC 6.16.

That could explain why i thought that if it reaches a certain amount of nicks, the queries continue in the normal mIRC 6.16 way.

Any fixes for this problem?

2) I still dont get a /whois when i receive a query... If I dbl click in the open window, or on the nick itself, no joy either way...

3) Thanks again!

Lord_Raiden tips hat

Top
#112736 - 28/02/05 06:39 AM Re: Custom Window / Query
Iori Offline
Hoopy frood

Registered: 30/08/03
Posts: 1831
[*] 1. Find each of the lines in the first set below and change them to their corresponding line in the second set.

Old:
Code:
  write $+(QuerLogs\Quer.,$nick,.txt) %a
  write $+(QuerLogs\Quer.,$nick,.txt) $+([,$time(HH:nn),] <,$nick,>) $1-
      loadbuf -pi $QuerWindow $+(QuerLogs\Quer.,$sline($QuerWindow,1),.txt)
      .remove $+(QuerLogs\Quer.,$1,.txt)
    savebuf $QuerWindow $+(QuerLogs\Quer.,$sline($QuerWindow,1),.txt)
    else { .timer 1 0 savebuf $QuerWindow $+(QuerLogs\Quer.,$sline($QuerWindow,1),.txt) }
    savebuf $QuerWindow $+(QuerLogs\Quer.,$sline($QuerWindow,1),.txt)


New:
Code:
  write $+(QuerLogs\Quer.,[color:blue]$mkfn($nick)[/color],.txt) %a
  write $+(QuerLogs\Quer.,[color:blue]$mkfn($nick)[/color],.txt) $+([,$time(HH:nn),] <,$nick,>) $1-
      loadbuf -pi $QuerWindow $+(QuerLogs\Quer.,[color:blue]$mkfn($sline($QuerWindow,1))[/color],.txt)
      .remove $+(QuerLogs\Quer.,[color:blue]$mkfn($1)[/color],.txt)
    savebuf $QuerWindow $+(QuerLogs\Quer.,[color:blue]$mkfn($sline($QuerWindow,1))[/color],.txt)
    else { .timer 1 0 savebuf $QuerWindow $+(QuerLogs\Quer.,[color:blue]$mkfn($sline($QuerWindow,1))[/color],.txt) }
    savebuf $QuerWindow $+(QuerLogs\Quer.,[color:blue]$mkfn($sline($QuerWindow,1))[/color],.txt)



[*] 2)
Options > IRC > [] "Whois on query"

You can also add " Whois $$1:whois $1" to the end of the menu code, like so..
Code:
menu @Quer.MENU {
  ; code......
  ;.....
  ;...
  Delete $$1 History: {
    if ($sline($QuerWindow,0) == 1) {
      clear $QuerWindow
      titlebar $QuerWindow
      close -m $1
      dline -l $QuerWindow $sline($QuerWindow,1).ln
      .remove $+(QuerLogs\Quer.,[color:blue]$mkfn($1)[/color],.txt)
    }
  }
  Whois $$1:whois $1
}

Top
#112737 - 28/02/05 08:24 AM Re: Custom Window / Query
Lord_Raiden Offline
Pikka bird

Registered: 26/02/05
Posts: 10
Loc: South Africa
Lord_Raiden tips hat

Thanks a million man! grin

Will report back

Lord_Raiden tips hat
_________________________
"Raiden... Lord of Thunder"

Top
#112738 - 28/02/05 07:22 PM Re: Custom Window / Query
Iori Offline
Hoopy frood

Registered: 30/08/03
Posts: 1831
You also might include an on close event to close any hidden queries or to unhide them if you prefer. May as well use this event to save the current position/size too.

Code:
on *:close:%QuerWindow:{
  while $line(%QuerWindow,1,1) {
    close -m $v1 | ; Use this to close the queries
    ; window -w $v1 | ; Use this to unhide them 
    dline -l %QuerWindow 1
  }
  writeini $+(",$mircini,") windows %QuerWindow $window($target).x $window($target).w $window($target).y $window($target).h
}
alias QuerWindow {
  set %QuerWindow $+(@Message,$chr(160),Queuer)
[color:blue]  if (!$window(%QuerWindow)) { window -odeSl11k0 %QuerWindow @Quer.MENU }[/color]
  return %QuerWindow
}

Top
#112739 - 01/03/05 12:45 PM Re: Custom Window / Query
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
Ill post what I did to mine, i added the nick change stuff for you, I personally dont care when someone changes nicks also not many people i talk to change them so it wasnt likely to happen to me. The problem with tracking nick changes is that you need to be in a channel with them, and also they might start changing nicks to ones you have convos logged for, so do you keep the old one or rename the current one and replace the old ones convo etc etc. I just did what i felt like smile whcih was delete $newnick log, then rename $nick log to $newnick log.
If u dont like it ill refund your money ok? (please see contact my accounts lady Helen Waite for assistance on this)

What have I done to this
(1) Fixed bad filenames I use a custom fix rather than $mkfn comes to the same thing mostly.
(2) Monitor for nick changes
(3) Confirm on window close, and close all hidden query windows if closing
(4) Double click whois info gets displayed in background

The code is getting a bit big to be posted in total over and over BUT i thought that some might like what i did with the Double Click Whois so ill post it once here, I been experementing with the process ever since Iori came up with this quick clean method of making bitmaps in mirc.
I didnt spend much time on checking what RAW's a whois uses just looked at my debug window and took a punt at 300-320, and 614, if there wrong sue me smile

Someone give me some feed back on the whois info thing, is it good or just poser material?

Code:
;
; ** Misc **
;
alias -l Fix.Str2File { return $replace($1,&,&26,\,&5C,/,&2F,:,&3A,*,&2A,?,&3F,",&22,<,&3C,>,&3E,|,&7C,.,&2E) }
alias -l Fix.File2Str { return $replace($1,&5C,\,&2F,/,&3A,:,&2A,*,&3F,?,&22,",&3C,<,&3E,>,&7C,|,&2E,.,&26,&) }
;
; ** Menus **
;
menu @Quer.MENU {
  ;mouse  :/echo -st mouse moved at $mouse.x $mouse.y in $active $1
  ;sclick :/echo -st single click at $mouse.x $mouse.y
  ;dclick :/echo -st double click at $mouse.x $mouse.y
  ;uclick :/echo -st mouse released at $mouse.x $mouse.y
  ;rclick :/echo -st single right-click at $mouse.x $mouse.y in $active $1
  ;leave  :/echo -st mouse left $leftwin
  ;drop   :/echo -st drag and drop at $mouse.x $mouse.y
  ;lbclick:/echo -st lbclick at $mouse.x $mouse.y in $active $1
  lbclick: {
    sline -l $QuerWindow $1
    clear $QuerWindow
    background -x $QuerWindow 
    if ($sline($QuerWindow,0) == 1) {
      quer.titlebar
      var %f = $+(QuerLogs\Quer.,$Fix.Str2File($sline($QuerWindow,1)),.jpg) | if ($isfile(%f)) { background -p $QuerWindow %f }
      var %f = $+(QuerLogs\Quer.,$Fix.Str2File($sline($QuerWindow,1)),.txt) | if ($isfile(%f)) { loadbuf -pi $QuerWindow %f }
    }
  }
  dclick: {
    if ($sline($QuerWindow,0) == 1) {
      whois $sline($QuerWindow,1)
      set %Quer.Whois $sline($QuerWindow,1)
    }
  }
  Close $$1 Conversation: {
    if ($sline($QuerWindow,0) == 1) {
      clear $QuerWindow
      write $+(QuerLogs\Quer.,$Fix.Str2File($1),.txt) Session ended: $+([,$asctime,],$lf,$lf)
      close -m $1
      background -x $QuerWindow
      titlebar $QuerWindow
      dline -l $QuerWindow $sline($QuerWindow,1).ln
    }
  }
  Delete $$1 History: {
    if ($sline($QuerWindow,0) == 1) {
      clear $QuerWindow
      close -m $1
      background -x $QuerWindow
      titlebar $QuerWindow
      dline -l $QuerWindow $sline($QuerWindow,1).ln
      .remove $+(QuerLogs\Quer.,$Fix.Str2File($1),.txt)
    }
  }
}
;
; ** identifiers **
;
alias QuerWindow {
  set %QuerWindow $+(@Message,$chr(160),Queuer)
  if (!$window(%QuerWindow)) { window -odeSl11k0 %QuerWindow 245 250 594 266 @Quer.MENU }
  return %QuerWindow
}
;
; ** Aliases **
;
alias Quer.Titlebar { titlebar $QuerWindow - Conversation with $sline($QuerWindow,1) - $iif(%QuerTextWin,TW,NW) - $iif(%QuerConfirmOff,IM,CM) }
;
; ** Events **
;
on ^*:open:?:*:{ query -n $nick | window -h $nick }
;
on ^*:text:*:?:{ quer.open.and.text.event $1- }
on ^*:action:*:?:{ quer.open.and.text.event $1- }
alias quer.open.and.text.event {
  mkdir QuerLogs
  var %t = $+($iif($event == action, $+ $color(action)),[,$time(HH:nn),]) $iif($event == action,* $nick,$+(<,$nick,>)) $1-
  write $+(QuerLogs\Quer.,$Fix.Str2File($nick),.txt) %t
  aline -ln $QuerWindow $nick 
  if ($sline($QuerWindow,1) == $nick) { aline -pi $QuerWindow %t }
  window -g1 $QuerWindow
  window -h $nick
  haltdef
}
;
on *:input:@:{
  if ($active == %QuerWindow) {
    if ((%QuerTextWin) || ($ctrlenter) || (/* !iswm $1-)) { .quer.msg $1- }
    else { .timer 1 0 savebuf $QuerWindow $+(QuerLogs\Quer.,$Fix.Str2File($sline($QuerWindow,1)),.txt) }
  }
}
alias quer.msg {
  if ($sline($QuerWindow,0) == 1) {
    if ((%QuerConfirmOff) || ($input(Secure Send Message $+ $crlf $+ Send this message to $sline($QuerWindow,1) $+ ? $+ $crlf $+ $crlf $+ $1-,c,Send Message.) == $true)) {
      PRIVMSG $sline($QuerWindow,1) $1-
      aline -p $QuerWindow $+([,$time(HH:nn),] <,$me,>) $1-
      haltdef
    }
    else { editbox $QuerWindow $1- }
    savebuf $QuerWindow $+(QuerLogs\Quer.,$Fix.Str2File($sline($QuerWindow,1)),.txt)
  }
}
;
on *:NICK:{
  if ($fline($QuerWindow,$nick,1,1)) { 
    if ($sline($QuerWindow,1) == $nick) {
      dline -l $QuerWindow $fline($QuerWindow,$nick,1,1)
      aline -ln $QuerWindow $newnick
      sline -l $QuerWindow $fline($QuerWindow,$newnick,1,1)
      quer.titlebar
    }
    else {
      dline -l $QuerWindow $fline($QuerWindow,$nick,1,1)
      aline -ln $QuerWindow $newnick
    }
  }
  var %of = $+(QuerLogs\Quer.,$Fix.Str2File($nick),.txt)
  if ($isfile(%of)) { 
    var %nf = $+(QuerLogs\Quer.,$Fix.Str2File($newnick),.txt)
    .remove %nf
    .timer 1 0 .rename %of %nf
  }
  var %of = $+(QuerLogs\Quer.,$Fix.Str2File($nick),.jpg)
  if ($isfile(%of)) { 
    var %nf = $+(QuerLogs\Quer.,$Fix.Str2File($newnick),.jpg)
    .remove %nf
    .timer 1 0 .rename %of %nf
  }
}
;
on *:Keydown:%QuerWindow:*: { 
  ;/echo -st DN $keyval .. $keyrpt 
  ;splay sounds\typewriter.wav
  if ($keyval == 18) { 
    var %cycle = $!false $!false/$true $!false/$true $!true/$false $!true/$false $!false
    var %cycle = $gettok(%cycle,$calc($findtok(%cycle,%QuerTextWin %QuerConfirmOff,1,47)+1),47)
    set %QuerTextWin $gettok(%cycle,1,32)
    set %QuerConfirmOff $gettok(%cycle,2,32)
    Quer.Titlebar
  }
  elseif ($keyval == 27) { window -c $QuerWindow }
}
;
on *:CLOSE:%QuerWindow:{
  window -n $QuerWindow
  if ($?!="Are you sure you want to close the $QuerWindow window?" != $true ) {
    close -@ $QuerWindow $+ Closing
    renwin $QuerWindow $QuerWindow $+ Closing
    filter -cpzww $QuerWindow $+ Closing $QuerWindow *
    filter -czwwlL $QuerWindow $+ Closing $QuerWindow *
    if ($sline($QuerWindow $+ Closing,1).ln) {
      sline -l $QuerWindow [ $v1 ]
      Quer.Titlebar
      var %f = $+(QuerLogs\Quer.,$Fix.Str2File($sline($QuerWindow,1)),.jpg) | if ($isfile(%f)) { background -p $QuerWindow %f }
    }
  }
  else {
    background -x $QuerWindow
    var %i = $line($QuerWindow,0,1)
    while (%i) { 
      close -m $line($QuerWindow,%i,1)
      dec %i
    }
  }
}
;
;ON WHOIS uses RAW 300-320,614 (maybe some others?) see below
alias quer.whois.image {
  set %quer.whois.image @quer.whois.image
  if (!$window(%quer.whois.image)) { 
    window -c %quer.whois.image
    set %Quer.whois.image.x 5
    set %Quer.Whois.image.y 5
    window -hp %quer.whois.image 1 1 100 100
    set %Quer.whois.image.w.adjust $calc($window(%quer.whois.image).w - $window(%quer.whois.image).bw + 10)
    set %Quer.whois.image.h.adjust $calc($window(%quer.whois.image).h - $window(%quer.whois.image).bh + 10)
  }
  return %quer.whois.image
}
alias quer.whois.line {
  ;/echo -st RAW $numeric : $1-
  var %width = $width($1-,$window($quer.whois.image).font,$window($quer.whois.image).fontsize,0,1) + %Quer.whois.image.w.adjust
  var %height = $height($1-,$window($quer.whois.image).font,$window($quer.whois.image).fontsize)
  window $quer.whois.image 1 1 %width $calc(%Quer.whois.image.y + %height + %Quer.whois.image.h.adjust)
  drawtext -p $quer.whois.image $color(normal text) 5 %Quer.whois.image.y $1-
  inc %Quer.whois.image.y %height
  haltdef
}
alias quer.whois.finish {
  window $quer.whois.image 1 1 1 240
  var %f = $+(QuerLogs\Quer.,$Fix.Str2File(%Quer.whois),.jpg)
  drawsave $quer.whois.image %f
  background -p $QuerWindow %f
  window -c $quer.whois.image
  haltdef
}
raw 300:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 301:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 302:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 303:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 304:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 305:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 306:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 307:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 308:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 309:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 310:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 311:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 312:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 313:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 314:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 315:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 316:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 317:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 318:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.finish
raw 319:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 320:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 614:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-

Top
#112740 - 01/03/05 12:49 PM Re: Custom Window / Query
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
Sorry missed that, didnt relaiase there was a second page to the thread, untill i posted and couldnt find my post. frown

Top
#112741 - 01/03/05 01:10 PM Re: Custom Window / Query
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
Nice update there Dave, just a minor note to those who want to see new updates please keep posting, I never thought it'd get this far to be honest it was just an idea I had so my switchbar wasn't filling up with PM's.

Thanks mainly to Iori and Dave, for telling me how to improve it. grin

And to everyone who has tried it.

Top
#112742 - 01/03/05 01:47 PM Re: Custom Window / Query
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
*** I've made a few adjustments, I've removed the comments in the splay part and changed it to isfile so it will either play the files or it wont. *** smile

*** Changed the $?!="" on close to $input to play the system sound associated with the question mark icon. ***
Code:

alias -l Fix.Str2File { 
  return $replace($1,&,&26,\,&5C,/,&2F,:,&3A,*,&2A,?,&3F,",&22,<,&3C,>,&3E,|,&7C,.,&2E) 
}
alias -l Fix.File2Str { 
  return $replace($1,&5C,\,&2F,/,&3A,:,&2A,*,&3F,?,&22,",&3C,<,&3E,>,&7C,|,&2E,.,&26,&) 
}

menu @Quer.MENU {
  lbclick: {
    sline -l $QuerWindow $1
    clear $QuerWindow
    background -x $QuerWindow 
    if ($sline($QuerWindow,0) == 1) {
      quer.titlebar
      var %f = $+(QuerLogs\Quer.,$Fix.Str2File($sline($QuerWindow,1)),.jpg) | if ($isfile(%f)) { 
        background -p $QuerWindow %f 
      }
      var %f = $+(QuerLogs\Quer.,$Fix.Str2File($sline($QuerWindow,1)),.txt) | if ($isfile(%f)) { 
        loadbuf -pi $QuerWindow %f
      }
    }
  }
  dclick: {
    if ($sline($QuerWindow,0) == 1) {
      whois $sline($QuerWindow,1)
      set %Quer.Whois $sline($QuerWindow,1)
    }
  }
  Close $$1 Conversation: {
    if ($sline($QuerWindow,0) == 1) {
      clear $QuerWindow
      write $+(QuerLogs\Quer.,$Fix.Str2File($1),.txt) Session ended: $+([,$asctime,],$lf,$lf)
      close -m $1
      background -x $QuerWindow
      titlebar $QuerWindow
      dline -l $QuerWindow $sline($QuerWindow,1).ln
    }
  }
  Delete $$1 History: {
    if ($sline($QuerWindow,0) == 1) {
      clear $QuerWindow
      close -m $1
      background -x $QuerWindow
      titlebar $QuerWindow
      dline -l $QuerWindow $sline($QuerWindow,1).ln
      .remove $+(QuerLogs\Quer.,$Fix.Str2File($1),.txt)
    }
  }
}

alias QuerWindow {
  set %QuerWindow @Quer
  if (!$window(%QuerWindow)) { 
    window -odeSl11k0 %QuerWindow 245 250 594 266 @Quer.MENU 
  }
  return %QuerWindow
}

alias Quer.Titlebar { 
  titlebar $QuerWindow - Conversation with $sline($QuerWindow,1) - $iif(%QuerTextWin,TW,NW) - $iif(%QuerConfirmOff,IM,CM) 
}

on ^*:open:?:*: {
  query -n $nick 
  window -h $nick 
}

on ^*:text:*:?: { 
  quer.open.and.text.event $1-
}

on ^*:action:*:?: {
  quer.open.and.text.event $1-
}

alias quer.open.and.text.event {
  mkdir QuerLogs
  var %t = $+($iif($event == action, $+ $color(action)),[,$time(HH:nn),]) $iif($event == action,* $nick,$+(<,$nick,>)) $1-
  write $+(QuerLogs\Quer.,$Fix.Str2File($nick),.txt) %t
  aline -ln $QuerWindow $nick 
  if ($sline($QuerWindow,1) == $nick) {
    aline -pi $QuerWindow %t
  }
  window -g1 $QuerWindow
  window -h $nick
  haltdef
}

on *:input:@:{
  if ($active == %QuerWindow) {
    if ((%QuerTextWin) || ($ctrlenter) || (/* !iswm $1-)) { 
      .quer.msg $1- 
      if ($isfile(sounds/enter.wav)) { splay sounds/enter.wav }
    }
    else { 
      .timer 1 0 savebuf $QuerWindow $+(QuerLogs\Quer.,$Fix.Str2File($sline($QuerWindow,1)),.txt)
    }
  }
}
alias quer.msg {
  if ($sline($QuerWindow,0) == 1) {
    if ((%QuerConfirmOff) || ($input(Secure Send Message $+ $crlf $+ Send this message to $sline($QuerWindow,1) $+ ? $+ $crlf $+ $crlf $+ $1-,c,Send Message.) == $true)) {
      PRIVMSG $sline($QuerWindow,1) $1-
      aline -p $QuerWindow $+([,$time(HH:nn),] <,$me,>) $1-
      haltdef
    }
    else { editbox $QuerWindow $1- }
    savebuf $QuerWindow $+(QuerLogs\Quer.,$Fix.Str2File($sline($QuerWindow,1)),.txt)
  }
}

on *:NICK:{
  if ($fline($QuerWindow,$nick,1,1)) { 
    if ($sline($QuerWindow,1) == $nick) {
      dline -l $QuerWindow $fline($QuerWindow,$nick,1,1)
      aline -ln $QuerWindow $newnick
      sline -l $QuerWindow $fline($QuerWindow,$newnick,1,1)
      quer.titlebar
    }
    else {
      dline -l $QuerWindow $fline($QuerWindow,$nick,1,1)
      aline -ln $QuerWindow $newnick
    }
  }
  var %of = $+(QuerLogs\Quer.,$Fix.Str2File($nick),.txt)
  if ($isfile(%of)) { 
    var %nf = $+(QuerLogs\Quer.,$Fix.Str2File($newnick),.txt)
    .remove %nf
    .timer 1 0 .rename %of %nf
  }
  var %of = $+(QuerLogs\Quer.,$Fix.Str2File($nick),.jpg)
  if ($isfile(%of)) { 
    var %nf = $+(QuerLogs\Quer.,$Fix.Str2File($newnick),.jpg)
    .remove %nf
    .timer 1 0 .rename %of %nf
  }
}

on *:Keydown:%QuerWindow:*: {
[color:red] 
  if ($isfile(sounds\typewriter.wav)) { 
splay sounds\typewriter.wav 
}
[/color]
[color:red]
  if ($keyval == 8) {  
    if ($isfile(sounds\back.wav)) { 
splay sounds\back.wav 
}
  }
[/color]
  if ($keyval == 18) { 
    var %cycle = $!false $!false/$true $!false/$true $!true/$false $!true/$false $!false
    var %cycle = $gettok(%cycle,$calc($findtok(%cycle,%QuerTextWin %QuerConfirmOff,1,47)+1),47)
    set %QuerTextWin $gettok(%cycle,1,32)
    set %QuerConfirmOff $gettok(%cycle,2,32)
    Quer.Titlebar
  }
  elseif ($keyval == 27) { 
    window -c $QuerWindow
  }
}

on *:CLOSE:%QuerWindow:{
  window -n %QuerWindow
  if ($input(Are you sure you want to close the $QuerWindow window?,dq,Confirm close) != $true) {
    close -@ $QuerWindow $+ Closing
    renwin $QuerWindow $QuerWindow $+ Closing
    filter -cpzww $QuerWindow $+ Closing $QuerWindow *
    filter -czwwlL $QuerWindow $+ Closing $QuerWindow *
    if ($sline($QuerWindow $+ Closing,1).ln) {
      sline -l $QuerWindow [ $v1 ]
      Quer.Titlebar
      var %f = $+(QuerLogs\Quer.,$Fix.Str2File($sline($QuerWindow,1)),.jpg) | if ($isfile(%f)) { 
        background -p $QuerWindow %f
      }
    }
  }
  else {
    background -x $QuerWindow
    var %i = $line($QuerWindow,0,1)
    while (%i) { 
      close -m $line($QuerWindow,%i,1)
      dec %i
    }
  }
}

alias quer.whois.image {
  set %quer.whois.image @quer.whois.image
  if (!$window(%quer.whois.image)) { 
    window -c %quer.whois.image
    set %Quer.whois.image.x 5
    set %Quer.Whois.image.y 5
    window -hp %quer.whois.image 1 1 100 100
    set %Quer.whois.image.w.adjust $calc($window(%quer.whois.image).w - $window(%quer.whois.image).bw + 10)
    set %Quer.whois.image.h.adjust $calc($window(%quer.whois.image).h - $window(%quer.whois.image).bh + 10)
  }
  return %quer.whois.image
}

alias quer.whois.line {
  var %width = $width($1-,$window($quer.whois.image).font,$window($quer.whois.image).fontsize,0,1) + %Quer.whois.image.w.adjust
  var %height = $height($1-,$window($quer.whois.image).font,$window($quer.whois.image).fontsize)
  window $quer.whois.image 1 1 %width $calc(%Quer.whois.image.y + %height + %Quer.whois.image.h.adjust)
  drawtext -p $quer.whois.image $color(normal text) 5 %Quer.whois.image.y $1-
  inc %Quer.whois.image.y %height
  haltdef
}

alias quer.whois.finish {
  window $quer.whois.image 1 1 1 240
  var %f = $+(QuerLogs\Quer.,$Fix.Str2File(%Quer.whois),.jpg)
  drawsave $quer.whois.image %f
  background -p $QuerWindow %f
  window -c $quer.whois.image
  haltdef
}

raw 300:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 301:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 302:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 303:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 304:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 305:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 306:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 307:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 308:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 309:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 310:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 311:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 312:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 313:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 314:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 315:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 316:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 317:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 318:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.finish
raw 319:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 320:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-
raw 614:$(& $iif(%Quer.whois,$v1,-) *):quer.whois.line $3-

Top
#112743 - 01/03/05 02:32 PM Re: Custom Window / Query
DaveC Offline
Planetary brain

Registered: 26/09/03
Posts: 4230
Quote:
I've made a few adjustments, I've removed the comments in the splay part and changed it to isfile so it will either play the files or it wont.


LOL didnt even notice it, i must have remarked it in the first version and not unmarked it since.

Quote:

if ($sline($QuerWindow $+ Closing,1).ln) {
sline -l $QuerWindow [ $v1 ]
Quer.Titlebar
var %f = $+(QuerLogs\Quer.,$Fix.Str2File($sline($QuerWindow,1)),.jpg) | if ($isfile(%f)) {
background -p $QuerWindow %f
}


I see you dont like putting some things on the same lines, your choice of course, no harm either way, i just find if its one command, i might as well do it, it makes code more straight down in my eyes.

But i actually quoted this for another reason, its the
if ($sline($QuerWindow $+ Closing,1).ln) {
sline -l $QuerWindow [ $v1 ]

If your altering any of the code watch out for using $v1 $v2 and $ifmatch, around the custom $identifiers, the [ ] around [ $v1 ] is there on purpose as they are needed so its evaluated Prior to $QuerWindow, as that $identifier well alter the contents of $v1, something I have got used to in my coding, but is a easy trap to miss, you end up staring at the code, going ,well theres $v1 and next i use it here, why isnt it set correctly?!?!?!?!?

Top
#112744 - 01/03/05 02:45 PM Re: Custom Window / Query
SladeKraven Offline
Planetary brain

Registered: 19/12/02
Posts: 3547
Loc: Kent, England
Hehe yeah it was in the first version.

When coding something I will always put them on about 3-4 lines and then go back and put them on one line for some reason. It's something I have always done as you'll see in my posts, another thing as you'd define as hardcoding window names into scripts, that's another thing I've always done.

As you said there's no harm in it, it's just something over a long period of time you become somewhat comfortable with it. smile

Top
#263933 - 13/10/18 08:48 AM Re: Custom Window / Query [Re: SladeKraven]
Candent Offline
Pikka bird

Registered: 08/10/15
Posts: 12
Hey,

Sorry for opening an old thread.
I like this code, but can I do that in 2018 so that a private name will flash?
If I have 3-4 query openings, and I see who wrote?


Ps! English is not my native language. Sorry wink

Top
#263944 - 14/10/18 02:48 AM Re: Custom Window / Query [Re: Candent]
maroon Offline
Hoopy frood

Registered: 12/01/04
Posts: 970
It seems your question is unrelated to this thread. They are scripting to evade the behavior you're asking for, which should already be happening unless you've changed something.

By default, mirc-options/display has the box checked for "flash icons". When that box is checked, the query window in the switchbar and the treebar flashes each time a query window receives a message, otherwise it's a solid color. The color dropdown at the bottom of that same menu window controls which color the query window uses.

Top
Page 1 of 2 1 2 >