Class Method-Attribute Clarification

I came across the following code snippet on the forums and it illustrates some of the comprehension problems that I’m having:

    println("Hello I am " " and I am at " owner.transform.@translation)
    ] looks like regular OOP syntax. owner.transform.@transition confuses me. How do you know when you can use ., @ and ! to access member methods or attributes?

Also, the post mentions the method on_begin_play, but I can only find receive_begin_play. Has the function been renamed, or am I overlooking the “on” version?

The language is exciting, but it makes my head hurt :slight_smile:

Here are specific sections of the docs that should answer this question on differentiating classes, variables and data members.

on_begin_play is a method in the SkookumScriptBehaviorComponent class.

I haven’t seen SkookumScriptBehaviorComponent in any of the demos/tutorials. Is this component automatically inherited, or do I have to do it manually? I really appreciate Agog taking so much time to help me understand.

This is an optional actor component that can be added to any class. I would recommend that you don’t use it as it has some unintended behaviors, it just happens to be used in a few examples. You can easily wire up your own begin play by creating any &blueprint function in :sk: and calling that from the blueprint BeginPlay node.

1 Like

I think I’ve got the @ and ! figured out, but I still don’t see a pattern as to how to use “.” Referring to the above expression, I don’t understand why it isn’t owner@name and owner@transform@translation.

Can you shed any light on this?

Methods that take no arguments or for which you want to take default arguments can omit the (). could be re-written from C++ Actor::GetName().
Similarly owner.transform could be re-written owner.transform() from C++ Actor::GetTransform(). So owner.transform.@translation is calling the transform() method which returns a Transform and @translation pulls out the translation variable from the Transform type.

The dot operator . needs to be used to access the members of a given type (variables or methods). should be read as accessing a method name from class owner. owner.transform.@translation should be read as accessing a variable @translation from class Transform (returned by method transform) from class owner.

1 Like

@error454 Thank you, it is so much clearer for me now. Thanks as well for all of the help you’ve provided on this question. I have never dealt with an organization as client-centric as Agog.

Hopefully, Epic will at least commit to keeping the :sk: plugin up to date with each new version. Thanks again.