Page 2 of 2

Re: Getting started with Unreal - lots of confusion

Posted: 27 Mar 2024, 11:22
by sfernandez
Hi,

If you have a way to convert the char id number into some text, then you can specify a converter in the style like this:
<Style x:Key="char" TargetType="ContentControl">
  <Setter Property="Template">
    <Setter.Value>
      <ControlTemplate TargetType="ContentControl">
          <TextBlock Text="{Binding Path=., Converter={StaticResource CharIdConverter}}" Foreground="DodgerBlue" FontWeight="Bold"/>
      </ControlTemplate>
    </Setter.Value>
  </Setter>
</Style>
And the log string should specify the number as the content of the style tag: "Day 1, 4h: <char>552</> has spawned"

Could something like this work for you?

Re: Getting started with Unreal - lots of confusion

Posted: 25 Apr 2024, 10:25
by mprey
Thanks, that seems to be what I need. But how do I get the game world from within TryConvert? For some reason GetWorld() returns null from inside it so I assume I need some other way to get the world context, as I need access to my character subsystem to retrieve the name.

Additionally I am also not quite sure about the type conversions involved - am I supposed to return the FString I would ultimately retrieve from my subsystem as the name like this?
result = Noesis::Boxing::Box<Noesis::String>(TCHAR_TO_UTF8(*charName));

Re: Getting started with Unreal - lots of confusion

Posted: 29 Apr 2024, 12:52
by hcpizzi
Hi,

I'm not sure you even need a converter. You can just write the char ID when you add the string to the array, can't you? Those strings aren't meant to change, are they?

The way you use RichText::SetTryCreateInlineCallback is that you set it once. It's a global handler. You can then use a global variable to store the currect World to use within the function (or perhaps GWorld would just do). You can call the function once in you game module's startup function and then update the World variable as it changes.

Hope this helps!