User avatar
sfernandez
Site Admin
Posts: 3001
Joined: 22 Dec 2011, 19:20

Re: Getting started with Unreal - lots of confusion

27 Mar 2024, 11:22

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?
 
mprey
Topic Author
Posts: 10
Joined: 22 Jan 2024, 09:58

Re: Getting started with Unreal - lots of confusion

25 Apr 2024, 10:25

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));
 
User avatar
hcpizzi
Site Admin
Posts: 322
Joined: 09 Feb 2012, 12:40

Re: Getting started with Unreal - lots of confusion

Today, 12:52

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!

Who is online

Users browsing this forum: Semrush [Bot] and 1 guest