mIRC Home    About    Download    Register    News    Help

Print Thread
#166623 13/12/06 02:36 AM
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
I've got the feeling that I'm forgetting something simple for this, but I'm not sure what.
The following code changes my titlebar based on the information from the active channel. The problem is, I can't get the topic to scroll, like a marquee, or on a line by line basis (with each line being a calculated length).
Here's the code that I currently have
Code:
on *:active:#:{
  if $server {
    set %nick.count $nickcount($chan)
    set %chan.mode $chan($chan).mode
    set %topic $chan($chan).topic
    .timertitlebar 0 2 titlebar $channelbar($chan)
  }
}
alias -l channelbar {
  set %topic.display $iif(!%topic.display || %topic.display > $len(%topic),1,$calc(%topic.display + %topic.display.length))
  set %display.length $calc($len($me) + $len(%chan.mode) + $len(%nick.count))
  set %topic.display.length $calc(100 - %display.length)
  return $me %chan.mode %nick.count %topic
}
alias -l nickcount { return $+($nick($1,0,a,hvr) Ops,$chr(44),$nick($1,0,a,ovr) Half-ops,$chr(44),$nick($1,0,a,ohr) Voices,$chr(44),$nick($1,0,a,ohv) Regular) }

I realize that there's nothing currently in the code for a scrolling effect for the topic, but that's because the options that I've tried have not worked.

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
Try this:
Code:
alias sb.title {
  ;*** The text to scroll in the titlebar
  return This is my titlebar text
}

alias sb.break {
  ;*** Characters to divide the scrolling text
  return ***
}

alias sb.pre {
  ;*** Text to put before the scrolling text
  return -
}

alias sb.suf {
  ;*** Text to put after the scrolling text
  return 
}

alias sb.start {
  ;*** Call to start the scrolling
  unset %sb.*
  set %sb.point 0
  .timer.sb -m 0 500 sb.disp
}

alias sb.stop {
  ;*** Call to stop the scrolling
  unset %sb.*
  .timer.sb off
  titlebar $sb.pre $sb.title $sb.suf
}

alias sb.disp {
  ;*** Updates the titlebar
  ;*** Scrolls one character for each call (chr(32) ignored)
  var %sb.title = $sb.break $sb.title
  inc %sb.point 1
  if (%sb.point > $len(%sb.title)) set %sb.point 1
  if ($mid(%sb.title,%sb.point,1) == $chr(32)) inc %sb.point 1
  var %sb.disp = $right(%sb.title,$calc($len(%sb.title) - %sb.point)) $left(%sb.title,%sb.point)
  titlebar $sb.pre %sb.disp $sb.suf
}


Modify /sb.title /sb.pre /sb.suf /sb.break to suit your needs. These aliases are called everytime /sb.disp is executed by the timer, so keep them short and efficient.

Call /sb.start to start the scrolling, /sb.stop to stop scrolling. When /sb.stop is called, the topic is reset so it is readable.

Adjust the scroll speed by changing the timer delay in /sb.start

-genius_at_work

Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Looked good in theory, unfortunately (and I'm having a hard time believing that I'm actually saying this about one of your codes), it's not working in actuality.
This is a part of a screen shot, showing the titlebar
and the current topic for that channel reads "——::::: [ Maximum-IRC Services and Support ] :::::—— www.maximum-irc.com — Jan. 1st 2007 IRC Op Meeting Will Happen - Time: To Be Set Soon! — http://www.maximum-irc.com/index.php?name=News&file=article&sid=4"

As an example, we'll use that topic line, as it's plenty long enough for what I want.
What I'm looking for would display that scrolling one character at a time (currently the display shows the first 104 characters (up to and including the n in Meeting)), then the titlebar changes to the data in sb.break, but even some of the data I have specified as part of sb.pre is being over-written.

Here's the full code as I currently have it, as there's something missing, although it completely escapes me as to what.
Code:
alias sb.title {
  ;*** The text to scroll in the titlebar
  return $chan($1).topic
}
alias sb.break {
  ;*** Characters to divide the scrolling text
  return ***
}
alias sb.pre {
  ;*** Text to put before the scrolling text
  return $me $chan($1).mode $nickcount($1)
}
alias sb.suf {
  ;*** Text to put after the scrolling text
  return 
}
alias sb.start {
  ;*** Call to start the scrolling
  unset %sb.*
  set %sb.point 0
  .timer.sb -m 0 500 sb.disp $1
}
alias sb.stop {
  ;*** Call to stop the scrolling
  unset %sb.*
  .timer.sb off
  titlebar $sb.pre $sb.title $sb.suf
}
alias sb.disp {
  ;*** Updates the titlebar
  ;*** Scrolls one character for each call (chr(32) ignored)
  var %sb.title = $sb.break $sb.title
  inc %sb.point 1
  if (%sb.point > $len(%sb.title)) set %sb.point 1
  if ($mid(%sb.title,%sb.point,1) == $chr(32)) inc %sb.point 1
  var %sb.disp = $right(%sb.title,$calc($len(%sb.title) - %sb.point)) $left(%sb.title,%sb.point)
  titlebar $sb.pre($1) %sb.disp $sb.suf
}
on *:active:#:{
  if $server {
    sb.start $chan
  }
}
alias -l nickcount { return $+($nick($1,0,a,hvr) Ops,$chr(44),$nick($1,0,a,ovr) Half-ops,$chr(44),$nick($1,0,a,ohr) Voices,$chr(44),$nick($1,0,a,ohv) Regular) }

This has been updated to include revisions of the aliases that you supplied me with.

Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
You need to change this line:

var %sb.title = $sb.break $sb.title

To this:

var %sb.title = $sb.break $sb.title($1)

I also added this line at the end (after the current last line) of the /sb.start alias. This makes the titlebar update immediately when the active channel is switched.

sb.disp $1


And just as a cosmetic thing, since titlebar space is limited, you could abbreviate the "ops, halfops" part to use symbols:

alias -l nickcount { return $nick($1,0,a,hvr) $+ @, $nick($1,0,a,ovr) $+ $(%,0), $nick($1,0,a,ohr) $+ +, $nick($1,0,a,ohv) $+ ø }

One more thing, you should stop the channel topic scroll when a non-channel window is chosen, such as Status Window. Maybe set some other data to scroll (usermodes, channel list, etc).

-genius_at_work

Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
OK...I made those changes and it works, but I've noticed something really weird. If I start the script in one channel, then change to a 2nd channel, the scrolled topic changes to the topic of the second channel, except for the time between the 3rd and 5th scroll character. That is, to say, it shows the topic from the second channel for a scroll of 3 characters, then it switches back to the topic from the first channel for the scroll of the 4th character, then back to the proper topic for the 5th character. This sequence repeats.

Correction..it's not just the topic that shows incorrectly at those points, but all of the information relayed from the channel.

Last edited by RusselB; 13/12/06 06:57 AM.
Joined: Oct 2005
Posts: 1,741
G
Hoopy frood
Offline
Hoopy frood
G
Joined: Oct 2005
Posts: 1,741
I tested on several channels, and they all seem to be displaying the correct data. It could be that another script is somehow interfering.


I did notice one small bug. When a channel topic has color codes, it appears that mIRC strips them from the /titlebar command, but when the code splits the color code from its color numbers, they are no longer stripped out, and the number part is shown in the title. To fix it, change this:

var %sb.title = $sb.break $sb.title($1)

to this:

var %sb.title = $sb.break $strip($sb.title($1))

-genius_at_work

Joined: Mar 2003
Posts: 612
B
Fjord artisan
Offline
Fjord artisan
B
Joined: Mar 2003
Posts: 612
not replying to anyone in particular but here is a scroll I made a long time ago using....


.play -c $dialog(dname) file.txt 100

hehehe

btk


billythekid
Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Thanks for the reply, however, I can't see how that would, realistically, be useful for my situation.

Joined: Aug 2004
Posts: 7,252
R
RusselB Offline OP
Hoopy frood
OP Offline
Hoopy frood
R
Joined: Aug 2004
Posts: 7,252
Not sure why it was doing that, but after a reboot it worked properly.


Link Copied to Clipboard