Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Request Scrolling HUD
#1
Rainbow 
Hi all,
I saw a lot of scrolling HUD's (at the bottom of screen like in PTK) but no one tutorial o_O
I tried to import code from PTK myself Nyan Cat but got error Smile

Who can post code?)
[Image: r212360a129ce9b84444093b6cd2699013a1fbn155.png]
Reply

#2
Code:
//Create level thread Create_Newsbar();
//level thread Set_Newsbartext();
//level thread Update_Newsbar(); in your onplayerswpawned(); then stick this anywhere else

Create_Newsbar( Shader, Align, Alpha, Color, Speed )
{
        News = spawnStruct();
        News.Text = newHudElem();
        News.Text.alignX = "CENTER";  
        News.Text.horzAlign = "CENTER";
        News.Text.foreGround = true;    
        News.Text.hideWhenInMenu = true;  
        News.Text.Glow = 1;
        News.Text.Sort = 2;  
        News.Shader = newHudElem();
        News.Shader.horzAlign = "CENTER";
        News.Shader.alignX = "CENTER";
        News.Shader.foreGround = FALSE;
        News.Shader.hideWhenInMenu = TRUE;      
        News.Shader.Sort = 1;            
        News.Speed = 60;
        if( isDefined( Speed ) ) News.Speed = Speed;
        if( isDefined( Align ) )
        {
                News.Text.alignY = Align;
                News.Text.vertAlign = Align;
                News.Shader.alignY = Align;
                News.Shader.vertAlign = Align;
        }
        else
        {
                News.Text.alignY = "TOP";
                News.Text.vertAlign = "TOP";
                News.Shader.alignY = "TOP";
                News.Shader.vertAlign = "TOP";
        }
        if( isDefined( Alpha ) ) News.Shader.Alpha = Alpha;
        else News.Shader.Alpha = 0.75;
        if( ( !isDefined( Color ) ) && ( !isDefined( Shader ) ) ) Shader = "BLACK";
        if( isDefined( Shader ) ) News.Shader setShader( Shader, 0, 25 );
        if( ( isDefined( Color ) ) && ( !isDefined( Shader ) ) )
        {
                News.Shader.Color = Color;
                News.Shader setShader( "WHITE", 0, 25 );
                        
        }
        News.Shader scaleOverTime( 7, 880, 25 );
        wait 7;
        level notify( "Created_Newsbar", News );
        wait ( 0.05 );
}

Set_Newsbartext( Text, Font, FontScale, Color, GColor, GAlpha )
{
        level waittill( "Created_Newsbar", News );
        News.Message = Text;
        if( isDefined( Font ) ) News.Text.Font = Font;
        else News.Text.Font = "BIGFIXED";
        if( isDefined( FontScale ) ) News.Text.FontScale = FontScale;
        else News.Text.FontScale = 1;
        if( isDefined( Color ) ) News.Text.Color = ( Color[0], Color[1], Color[2] );
        if( isDefined( GColor ) ) News.Text.GlowColor = ( GColor[0]/255, GColor[1]/255,

GColor[2]/255 );
        if( isDefined( GAlpha ) ) News.Text.GlowAlpha = GAlpha;
        if( isDefined( Text ) ) News.Text setText( Text );
        else News.Text setText( "INSERT YOUR TEXT HERE);
        News.Text.x += ( Text.size + 870 ) * 1.45;
        News.TextSize = Text.size;
        for( ;; )
        {
                wait ( 0.05 );
                News.Text moveOverTime( ( ( News.TextSize + 870 ) / News.Speed ) );
                News.Text.x -= ( News.TextSize + 870 ) * 2.9;
                wait ( ( News.TextSize + 870 ) / News.Speed ) - 0.05;
                News.Text.x += ( News.TextSize + 870 ) * 2.9;
                level notify ( "Done_Message", News );
        }
}

Update_Newsbar( NewText, KeepOld )
{
        self endon( "Done_Update" );
        level waittill( "Done_Message", News );
        News.OldMessage = News.Message;
        News.OldTextSize = News.TextSize;
        News.OldSpeed = News.Speed;
        News.Text setText( "^1News Update : ^7" + NewText );
        News.TextSize = NewText.size;
        News.Speed = 100;
        level waittill( "Done_Message" );
        News.Speed = News.OldSpeed;
        if( isDefined( KeepOld ) && KeepOld )
        {
                News.Text setText( News.OldMessage );
                News.TextSize = News.OldTextSize;
        }
        else
        {
                News.Text setText( NewText );
                News.TextSize = NewText.size;
        }
        level notify( "Done_Update" );
}
[Image: MaEIQ.png]
Reply

#3
hmmm... bad syntax man
[Image: r212360a129ce9b84444093b6cd2699013a1fbn155.png]
Reply

#4
i cant make it work can somebody please help me? ;D
I like turtles
[Image: thumb-275x274-design-609.png]

Reply

#5
Code:
//Create level thread Create_Newsbar();
//level thread Set_Newsbartext();
//level thread Update_Newsbar(); in your onplayerswpawned(); then stick this anywhere else

Create_Newsbar( Shader, Align, Alpha, Color, Speed )
{
        News = spawnStruct();
        News.Text = newHudElem();
        News.Text.alignX = "CENTER";  
        News.Text.horzAlign = "CENTER";
        News.Text.foreGround = true;    
        News.Text.hideWhenInMenu = true;  
        News.Text.Glow = 1;
        News.Text.Sort = 2;  
        News.Shader = newHudElem();
        News.Shader.horzAlign = "CENTER";
        News.Shader.alignX = "CENTER";
        News.Shader.foreGround = FALSE;
        News.Shader.hideWhenInMenu = TRUE;      
        News.Shader.Sort = 1;            
        News.Speed = 60;
        if( isDefined( Speed ) ) News.Speed = Speed;
        if( isDefined( Align ) )
        {
                News.Text.alignY = Align;
                News.Text.vertAlign = Align;
                News.Shader.alignY = Align;
                News.Shader.vertAlign = Align;
        }
        else
        {
                News.Text.alignY = "TOP";
                News.Text.vertAlign = "TOP";
                News.Shader.alignY = "TOP";
                News.Shader.vertAlign = "TOP";
        }
        if( isDefined( Alpha ) ) News.Shader.Alpha = Alpha;
        else News.Shader.Alpha = 0.75;
        if( !isDefined( Color ) ) && ( !isDefined( Shader ) ) Shader = "BLACK";
        if( isDefined( Shader ) ) News.Shader setShader( Shader, 0, 25 );
        if( isDefined( Color ) ) && ( !isDefined( Shader ) )
        {
                News.Shader.Color = Color;
                News.Shader setShader( "WHITE", 0, 25 );
                        
        }
        News.Shader scaleOverTime( 7, 880, 25 );
        wait 7;
        level notify( "Created_Newsbar", News );
        wait ( 0.05 );
}

Set_Newsbartext( Text, Font, FontScale, Color, GColor, GAlpha )
{
        level waittill( "Created_Newsbar", News );
        News.Message = Text;
        if( isDefined( Font ) ) News.Text.Font = Font;
        else News.Text.Font = "BIGFIXED";
        if( isDefined( FontScale ) ) News.Text.FontScale = FontScale;
        else News.Text.FontScale = 1;
        if( isDefined( Color ) ) News.Text.Color = ( Color[0], Color[1], Color[2] );
        if( isDefined( GColor ) ) News.Text.GlowColor = ( GColor[0]/255, GColor[1]/255,

GColor[2]/255 );
        if( isDefined( GAlpha ) ) News.Text.GlowAlpha = GAlpha;
        if( isDefined( Text ) ) News.Text setText( Text );
        else News.Text setText( "INSERT YOUR TEXT HERE);
        News.Text.x += ( Text.size + 870 ) * 1.45;
        News.TextSize = Text.size;
        for( ;; )
        {
                wait ( 0.05 );
                News.Text moveOverTime( ( ( News.TextSize + 870 ) / News.Speed ) );
                News.Text.x -= ( News.TextSize + 870 ) * 2.9;
                wait ( ( News.TextSize + 870 ) / News.Speed ) - 0.05;
                News.Text.x += ( News.TextSize + 870 ) * 2.9;
                level notify ( "Done_Message", News );
        }
}

Update_Newsbar( NewText, KeepOld )
{
        self endon( "Done_Update" );
        level waittill( "Done_Message", News );
        News.OldMessage = News.Message;
        News.OldTextSize = News.TextSize;
        News.OldSpeed = News.Speed;
        News.Text setText( "^1News Update : ^7" + NewText );
        News.TextSize = NewText.size;
        News.Speed = 100;
        level waittill( "Done_Message" );
        News.Speed = News.OldSpeed;
        if( isDefined( KeepOld ) && KeepOld )
        {
                News.Text setText( News.OldMessage );
                News.TextSize = News.OldTextSize;
        }
        else
        {
                News.Text setText( NewText );
                News.TextSize = NewText.size;
        }
        level notify( "Done_Update" );
}


Try this.. if it doesnt work run in dev mode and find the bad syntax.
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  Help scrolling text GSC help! IAmTicTac456 4 4,089 12-16-2011, 01:20
Last Post: x_slip_KNOT666
  Nyan cat modification video scrolling l.o.l. Arteq 6 3,579 06-18-2011, 21:43
Last Post: surtek

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.