mIRC Home    About    Download    Register    News    Help

Topic Options
#196240 - 13/03/08 04:59 PM scrolling text
Solo1 Offline
Vogon poet

Registered: 13/03/07
Posts: 139
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.

Top
#196241 - 13/03/08 05:25 PM Re: scrolling text [Re: Solo1]
foshizzle Offline
Fjord artisan

Registered: 20/08/07
Posts: 333
Loc: Silicon Valley
do u just want it to slide across the window, looping forever? and which direction
_________________________
This is not the signature you are looking for

Top
#196259 - 13/03/08 09:14 PM Re: scrolling text [Re: foshizzle]
Solo1 Offline
Vogon poet

Registered: 13/03/07
Posts: 139
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

Top
#196268 - 14/03/08 01:07 AM Re: scrolling text [Re: Solo1]
genius_at_work Offline
Hoopy frood

Registered: 08/10/05
Posts: 1741
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

Top
#196277 - 14/03/08 09:50 AM Re: scrolling text [Re: genius_at_work]
Solo1 Offline
Vogon poet

Registered: 13/03/07
Posts: 139
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?

Top
#196288 - 14/03/08 02:30 PM Re: scrolling text [Re: Solo1]
genius_at_work Offline
Hoopy frood

Registered: 08/10/05
Posts: 1741
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

Top
#196363 - 15/03/08 06:26 PM Re: scrolling text [Re: genius_at_work]
sparta Offline
Planetary brain

Registered: 22/02/03
Posts: 3432
Loc: Sweden/Borlänge
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
_________________________
if ($me != tired) { return } | else { echo -a Get a pot of coffee now $+($me,.) }

Top
#196371 - 15/03/08 09:04 PM Re: scrolling text [Re: sparta]
genius_at_work Offline
Hoopy frood

Registered: 08/10/05
Posts: 1741
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

Top
#196547 - 18/03/08 05:09 PM Re: scrolling text [Re: genius_at_work]
Solo1 Offline
Vogon poet

Registered: 13/03/07
Posts: 139
Hi, just reminding you about that example promised.

Top