Jump to content
Mostabdel

What is Mean This Script

Recommended Posts

void Set(ChatMessageEventParams params)	// Param 1 --> Channel, Param 2 --> sender name, Param 3 --> message, Param 4 ?? 
	{
		int channel; 
		
		m_NameWidget.SetText("");
		m_TextWidget.SetText("");
		
		SetColour(DEFAULT_COLOUR);
		m_RootWidget.Show(true);
		
		channel = params.param1; // 0 = Survior   1 = Game/System   2 = Admin 
		
		Print(channel);
		/*
		if (params.param2 != "")
		{
			m_NameWidget.SetText( params.param2 + " : "); 
		}
		
		if( channel & CCSystem )
 		{
			if(params.param2 != "")
			{
				m_NameWidget.SetText(GAME_PREFIX + ": " );
			} 
			SetColour(GAME_TEXT_COLOUR);
 		}
		else if( channel & CCAdmin )
		{
			m_NameWidget.SetText(ADMIN_PREFIX + ": ");
			SetColour(ADMIN_TEXT_COLOUR);			
		}
		else if( channel & CCTransmitter )
		{
			m_NameWidget.SetText(RADIO_PREFIX + params.param2 + " : ");
		}		
		*/
		
		if ( channel & CCSystem )
		{
			// Game
			if(params.param2 != "")
			{
				m_NameWidget.SetText(GAME_PREFIX + ": " );
			} 
			SetColour(GAME_TEXT_COLOUR);
		}
		else if ( channel & CCAdmin )
		{
			// Admin
			m_NameWidget.SetText(ADMIN_PREFIX + ": ");
			SetColour(ADMIN_TEXT_COLOUR);			
		}
		else if ( channel & CCTransmitter )
		{
			// Radio - Trasnmitter
			m_NameWidget.SetText(RADIO_PREFIX + params.param2 + " : ");
		}
		else if ( channel == 0 || channel & CCDirect )
		{
			// Player
			if(params.param2 != "")
			{
				m_NameWidget.SetText(params.param2 + " : ");
			}
		}
		
		
		m_TextWidget.SetText(params.param3);
		
		m_FadeTimer.FadeIn(m_RootWidget, FADE_IN_DURATION);
		m_TimeoutTimer.Run(FADE_TIMEOUT, m_FadeTimer, "FadeOut", new Param2<Widget, float>(m_RootWidget, FADE_OUT_DURATION));
	}
	
	private void SetColour(int colour)
	{
		m_NameWidget.SetColor(colour);
		m_TextWidget.SetColor(colour);
	}

	void Clear()
	{
		m_RootWidget.Show( false );
		m_TimeoutTimer.Stop();
		m_FadeTimer.Stop();
	}

 

Share this post


Link to post
Share on other sites

This script must set text bu submitted parameters.

1-st is definition: this is part of something GUI mode. (From game or someone's mode).

2-ns Parameters 
Param 1 --> Channel -> Where must showed. (It's not and ingame definition, you must find definition inside mode).
Param 2 --> sender name,  (I Guess here must String or instance of Man class. I guess player that must see that widget in game).
Param 3 --> message,  (String, ....)
Param 4 ?? -> really strange. You must find the constructor for class: "ChatMessageEventParams". Because in your script you have 3 param and no defenition and usage of 4-th param:
params.param1 (int) // 0 = Survior   1 = Game/System   2 = Admin. 11 line,
params.param2 (String) // "Survivor XYZ"  22 & 35 lines
params.param3 (String)  // Some message  69 line.

So It's something like old ARMA-like "hint"-style message, with fade support. Base idea is shown notification/message/warning and etc.

I guess that's all what I can say about it.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×