How to use a function from a class inside a different class/file?

I know that the specifier exists, but even using that does not let me call that function outside of the class it’s in. Here is a test example of what I am trying to do:

Foo := class():
var FooTest : int = 25

FooReturn<public>():int= 1

TestClass := class(creative_device):
var TestInt : int = 0

OnBegin<override>()<suspends>:void=
    set TestInt = FooReturn()

Says “Unknown identifier ‘FooReturn’”

You need a reference to the class object.

@editable PlayerManager : player_manager = player_manager{}

...

if (Target := PlayerManager.GetRandomCharacter[]):
            Position := Target.GetTransform().Translation

and in player_manager.verse

GetRandomCharacter()<decides><transacts>:fort_character=
        Players := GetPlayspace().GetPlayers()
        Index := GetRandomInt(0, Players.Length)
        Character := Players[Index].GetFortCharacter[]
        return Character

NOTE: you don’t need <public> it appears to be the default.

2 Likes

Thank you!!

1 Like