mIRC Homepage
Posted By: Solo1 scrolling text - 13/03/08 04:59 PM
Hi Guys
I want to make a scrolling text in a project of mine but i need a kick start as i have no idea where to start, and need an example. If i have a window called @scroll how would i scroll "this is scrolling text" in that window.

Thank You.
Posted By: foshizzle Re: scrolling text - 13/03/08 05:25 PM
do u just want it to slide across the window, looping forever? and which direction
Posted By: Solo1 Re: scrolling text - 13/03/08 09:14 PM
Hi
I just want a small example i can work off. For now lets have it running on an endless loop and scrolling upwards. But any example will help me.

Thank-You
Posted By: genius_at_work Re: scrolling text - 14/03/08 01:07 AM
This code should make the given message scroll in a dialog editbox. It should be a good starting point for you.

Code:

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

alias mq.disp {
  ;*** Scrolls one character for each call (chr(32) ignored)
  var %mq.title = This is the text to scroll in the textbox
  inc %mq.point 1
  if (%mq.point > $len(%mq.title)) set %mq.point 1
  if ($mid(%mq.title,%mq.point,1) == $chr(32)) inc %mq.point 1
  var %mq.disp = $right(%mq.title,$calc($len(%mq.title) - %mq.point)) $left(%mq.title,%mq.point)
  echo -a did -ra <id_of_textbox> %mq.disp
}

alias mq.stop {
  unset %mq.*
  .timer.mq off
}



-genius_at_work
Posted By: Solo1 Re: scrolling text - 14/03/08 09:50 AM
Hi genius_at_work
That is an absolutely fabulous example, i have created the dialog and got it working and understand the concept. The only trouble i have at the moment is that the text is scrolling but the whole text shows in the edit box before it starts scrolling, is it possible that is should start scrolling from the first character?
Posted By: genius_at_work Re: scrolling text - 14/03/08 02:30 PM
So you want the text to display 1 character at a time until it is all showing, and then continue scrolling from then on? If so, then yes you can. I would do it by making a separate alias to do that first part, and then start calling the existing alias after the full text is displayed. You should be able to reuse part of the existing alias and just modify it so it only shows the $left part. I can give an example after work.

-genius_at_work
Posted By: sparta Re: scrolling text - 15/03/08 06:26 PM
Originally Posted By: genius_at_work
This code should make the given message scroll in a dialog editbox. It should be a good starting point for you.

Code:

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

alias mq.disp {
  ;*** Scrolls one character for each call (chr(32) ignored)
  var %mq.title = This is the text to scroll in the textbox
  inc %mq.point 1
  if (%mq.point > $len(%mq.title)) set %mq.point 1
  if ($mid(%mq.title,%mq.point,1) == $chr(32)) inc %mq.point 1
  var %mq.disp = $right(%mq.title,$calc($len(%mq.title) - %mq.point)) $left(%mq.title,%mq.point)
  echo -a did -ra <id_of_textbox> %mq.disp
}

alias mq.stop {
  unset %mq.*
  .timer.mq off
}



-genius_at_work

Lo !

I found this code intresting so i tested it a bit, and i noticed one problem with it, if you add color to the text, then when it scrolling it will send the number for the color, not the color. Can someone explain to me why? smile and how it can be solved a easy way smile
Posted By: genius_at_work Re: scrolling text - 15/03/08 09:04 PM
The code was written to scroll text in a dialog editbox. Editboxes do not support color codes (as anything other than regular ascii characters) so the script does not make allowances for color codes in the text. You could correct this by detecting the control codes, and rearranging them as necessary to display properly.

-genius_at_work
Posted By: Solo1 Re: scrolling text - 18/03/08 05:09 PM
Hi, just reminding you about that example promised.
© mIRC Discussion Forums