Displaying messages.

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

Sabresire

New Member
Nov 29, 2001
4
0
0
Visit site
New to unreal script and I just want to learn how to test my code in game. Is there any way of commanding the game to print current varibles that I define in the HUD? I guess I can settle for the console screen right now, but I'd like to learn how to display messages in the hud anyway that are from the system.

Even pointing me to a good tutorial on how to give a command in the game or hud and get it to return something in the HUD or even do something in the game would be great.
 

Brood_of_Evil

Selene's martyr
Nov 3, 2001
147
0
0
45
Look outside your window!
Visit site
Well, I dunno of any tutorial, but messages in the HUD are handled by the LocalMessage class, which is child of the Info class. As children of that class you'll find all the messages used in the game, like pickup messages, killing spree mesages, specific game type messages likt CTF's, DOM's etc (Yes even console messages). The function to call those messages is (as defined in Actor):

Code:
event BroadcastLocalizedMessage( class<LocalMessage> Message, optional int Switch, optional PlayerReplicationInfo RelatedPRI_1, optional PlayerReplicationInfo RelatedPRI_2, optional Object OptionalObject )
{
	local Pawn P;

	for ( P=Level.PawnList; P != None; P=P.nextPawn )
		if ( P.bIsPlayer || P.IsA('MessagingSpectator') )
		{
			if ( (Level.Game != None) && (Level.Game.MessageMutator != None) )
			{
				if ( Level.Game.MessageMutator.MutatorBroadcastLocalizedMessage(Self, P, Message, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject) )
					P.ReceiveLocalizedMessage( Message, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject );
			} else
				P.ReceiveLocalizedMessage( Message, Switch, RelatedPRI_1, RelatedPRI_2, OptionalObject );
		}
}
 

Wormbo

Administrator
Staff member
Jun 4, 2001
5,913
36
48
Germany
www.koehler-homepage.de
If you just want to print out the current value of variables you should use:
Code:
BroadcastMessage("YourVariable ="@YourVariable);
This displays "YourVariable = 12,345678" in the chat window.
 

ZitherMan

New Member
Oct 11, 2001
24
0
0
a good way of displaying all the variables and even editing them are to write
editactor class=yourpackage.yourclass
in the console when in windowed mode (alt+enter). This will bring up a window with all the variables used in that class.