brass fish
10-20-2002, 09:36 PM
hey, im made a script that makes text moves back and forth in the status bar. and i thought it was kinda bulka so i remade it.
this is what it should look like in the status
blah blah
blah blah
blah blah
blah blah
blah blah
blah blah
blah blah
blah blah
blah blah
blah blah
blah blah
blah blah
blah blah
and it keeps going like that. (each line is what the status looks like after .1 seconds). the first script did it fine. but when i remade it the spaces where huge.heres the code
var s='';
var spaces=new Array();
var p=0;
var fast=100;
var text;
function start(t,maxLength,item)
{
text=t;
textL=text.length;
if(textL>=maxLength)return false;
numospace=maxLength-textL;
for(var i=0;i<numospace;i++)
{
for(var j=0;j<=i;j++)
{
s=s+item;
}
spaces[i]=s;
}
right();
}
function right()
{
status=spaces[p]+text;
if(p<textL)p++;
else if(p==textL){left();return false;}
setTimeout('right();',fast);
}
function left()
{
status=spaces[p]+text;
if(p==0){right();return false;}
else p--;
setTimeout('left();',fast);
}
thanks :thumbsup:
fixed sum things
<html>
<head>
<script language="Javascript">
<!--
var spaces=new Array();
var p=0;
var fast=100;
var text;
function start(t,maxLength,item)
{
var s='';
text=t;
textL=text.length;
if(textL>=maxLength)return false;
numospace=maxLength-textL;
for(var i=0;i<numospace;i++)
{
for(var j=0;j<i;j++)
{
s+=item;
}
spaces[i]=s;
}
right();
}
function right()
{
status=spaces[p]+text;
if(p<numospace)p++;
else if(p==numospace){p--;left();return false;}
setTimeout('right();',fast);
}
function left()
{
status=spaces[p]+text;
if(!p){p++;right();return false;}
p--;
setTimeout('left();',fast);
}
start('example example example example example example example, Ooh, bouncy!',100,' ');
//-->
</script>
</head>
<body>
</body>
</html>
but i still cant fix the spaces thing, why are they so big!! oh, theres a pattern in the length of the spaces :
array # length of spaces
~~~~~~ ~~
spaces[0]= 0 0+1= 1
spaces[1]= 1 1+2= 3
spaces[2]= 3 3+3= 6
spaces[3]= 6 6+4=10
spaces[4]= 10 10+5=15
spaces[5]= 15 15+6=21
spaces[6]= 21 21+7=28
spaces[7]= 28 28+8=36.....
this is what it should look like in the status
blah blah
blah blah
blah blah
blah blah
blah blah
blah blah
blah blah
blah blah
blah blah
blah blah
blah blah
blah blah
blah blah
and it keeps going like that. (each line is what the status looks like after .1 seconds). the first script did it fine. but when i remade it the spaces where huge.heres the code
var s='';
var spaces=new Array();
var p=0;
var fast=100;
var text;
function start(t,maxLength,item)
{
text=t;
textL=text.length;
if(textL>=maxLength)return false;
numospace=maxLength-textL;
for(var i=0;i<numospace;i++)
{
for(var j=0;j<=i;j++)
{
s=s+item;
}
spaces[i]=s;
}
right();
}
function right()
{
status=spaces[p]+text;
if(p<textL)p++;
else if(p==textL){left();return false;}
setTimeout('right();',fast);
}
function left()
{
status=spaces[p]+text;
if(p==0){right();return false;}
else p--;
setTimeout('left();',fast);
}
thanks :thumbsup:
fixed sum things
<html>
<head>
<script language="Javascript">
<!--
var spaces=new Array();
var p=0;
var fast=100;
var text;
function start(t,maxLength,item)
{
var s='';
text=t;
textL=text.length;
if(textL>=maxLength)return false;
numospace=maxLength-textL;
for(var i=0;i<numospace;i++)
{
for(var j=0;j<i;j++)
{
s+=item;
}
spaces[i]=s;
}
right();
}
function right()
{
status=spaces[p]+text;
if(p<numospace)p++;
else if(p==numospace){p--;left();return false;}
setTimeout('right();',fast);
}
function left()
{
status=spaces[p]+text;
if(!p){p++;right();return false;}
p--;
setTimeout('left();',fast);
}
start('example example example example example example example, Ooh, bouncy!',100,' ');
//-->
</script>
</head>
<body>
</body>
</html>
but i still cant fix the spaces thing, why are they so big!! oh, theres a pattern in the length of the spaces :
array # length of spaces
~~~~~~ ~~
spaces[0]= 0 0+1= 1
spaces[1]= 1 1+2= 3
spaces[2]= 3 3+3= 6
spaces[3]= 6 6+4=10
spaces[4]= 10 10+5=15
spaces[5]= 15 15+6=21
spaces[6]= 21 21+7=28
spaces[7]= 28 28+8=36.....