Time for action – Using strings
Well, by now we know the drill, so let's declare a string!
Change our float declaration to this:
var string DeathMessage;
By default, strings are empty. We can see this... or not see this, rather, by changing our
PostBeginPlay
function:function PostBeginPlay() { 'log("Death message:" @ DeathMessage); }
Compile and test to see that nothing shows up:
[0007.74] ScriptLog: Death message:
Well that doesn't help much. Let's change that.
Add this line to our PostBeginPlay function:
DeathMessage = "Tom Stewart killed me!";
Now it looks like this:
function PostBeginPlay() { DeathMessage = "Tom Stewart killed me!"; 'log("Death message:" @ DeathMessage); }
Compile and run the code, and check the log.
[0007.67] ScriptLog: Death message: Tom Stewart killed me!
What just happened?
There's not much to strings either, and they're not used nearly as much as other types of variables. They're mostly used for things that need to be made readable to the player like character or...