UDN
Search public documentation:

DevelopmentKitGemsConcatenateStringsKismetNode
日本語訳
中国翻译
한국어

Interested in the Unreal Engine?
Visit the Unreal Technology site.

Looking for jobs and company info?
Check out the Epic games site.

Questions about support via UDN?
Contact the UDN Staff

UE3 Home > Unreal Development Kit Gems > Creating a Concatenate Strings Kismet node
UE3 Home > Kismet Visual Scripting > Creating a Concatenate Strings Kismet node

Creating a Concatenate Strings Kismet node


Last tested against UDK Apr, 2011
PC and iOS compatible

Overview


There currently isn't a simple way to add two strings in Kismet at this point. This gem helps you to add a Kismet node which does just that.

Unrealscript


This kismet node simply takes the inputs ValueA and ValueB, and uses Unrealscript's native concatenation operators to generate the composite string. There is also an option to allow users to concatenate with a space between the two strings. Most of the other logic such as retrieving the Kismet variable node values and setting the Kismet variable node is done internally by Unreal Engine.

SeqAct_ConcatenateStrings.uc
  class SeqAct_ConcatenateStrings extends SequenceAction;
  
  var() String ValueA;
  var() String ValueB;
  var() bool ConcatenateWithSpace;
  var string StringResult;
  
  event Activated()
  {
    StringResult = (ConcatenateWithSpace) ? ValueA@ValueB : ValueA$ValueB;
    ActivateOutputLink(0);
  }
  
  defaultproperties
  {
    ObjName="Concatenate Strings"
    ObjCategory="Misc"
    InputLinks(0)=(LinkDesc="In")
    OutputLinks(0)=(LinkDesc="Out")
    VariableLinks.Empty
    VariableLinks(0)=(ExpectedType=class'SeqVar_String',LinkDesc="A",PropertyName=ValueA)
    VariableLinks(1)=(ExpectedType=class'SeqVar_String',LinkDesc="B",PropertyName=ValueB)
    VariableLinks(2)=(ExpectedType=class'SeqVar_String',LinkDesc="StringResult",bWriteable=true,PropertyName=StringResult)
  }
  

How to use


Adding the Concatenate Strings Kismet node

Open up an existing level or create a new level. Open up Kismet. Add the Level Loaded kismet event node. Then add the Concatenate Strings kismet node. It is stored within the Misc category within the New Action menu.

01_AddConcatenateKismetNode.jpg

Concatenate String Kismet node properties

The Concatenate Strings Kismet node has a few properties you can set. If you don't wish to use Kismet variable string nodes, you can set the strings to concatenate directly in ValueA and ValueB. Concatenate With Space adds a space between the two values. Thus if you concatenate "A" and "B" with no space it will become "AB". With a space it becomes "A B".

02_ConcatenateKismetNodeProperties.jpg

Populating the Concatenate Strings Kismet node

From here, create new Kismet string variable nodes. Attach ValueA and ValueB to predefined strings. String Result can be attached to a Kismet string variable node which contains a value but it will override it.

03_PopulatingConcatenateKismetNode.jpg

Add the Log Kismet node

To test if the Concatenate Strings Kismet node is operating correctly, you can log the results. Do this by adding a Log Kismet node.

04_AddLogKismetNode.jpg

Expose the String * in the Log Kismet node

To log the String Result variable, right click on the Log Kismet node and expose the String * node.

05_ExpandLogKismetNode.jpg

Completed Kismet

Connect up the remaining lose ends, and your Kismet scene should look something like this.

06_FinalKismet.jpg

Testing in PIE

Run the level in PIE and you should see the concatenated string being logged on the screen.

07_Screenshot.jpg

Related topics