Hello World in UnrealScript

Our first program will print the classic “hello world” message. Here’s the full source code.

class HelloWorld extends Object
{
    simulated function Init()
    {
        `log("hello world");
    }
}

To run the program, you typically place the code into a script and ensure it is compiled and included in your Unreal Engine project. The way to run UnrealScript will depend on your game setup and configuration.

Compile the script and then initiate the appropriate game mode or debug environment to see the output.

# Example compile command
$ UCC make

# Assuming the script is set up correctly, run your game or specific script as needed
$ LaunchUnrealGame

Sometimes we’ll want to package our programs or scripts into a mod or game build. Ensure your UnrealScript files are properly integrated into your Unreal Engine project and tested.

To execute the compiled script:

  1. Make sure the compilation was successful:

    $ UCC make
  2. Launch your Unreal Engine project:

    $ UnrealEditor MyProject
  3. Run the specific game mode or script to see “hello world” in the logs.

Now that we can run and build basic UnrealScript programs, let’s learn more about the language.