What you need is casting:
Bare in mind that casting is either powerful and dangerous. if you attempt to use it against a wrong class (that is, type), then you get an error. That's why you should check first if the player.target can be 'casted' to a tvehicle type:
Another thing. Classes are powerful, but you should use it wisely. If you have classes that inherits (extends in BMax) from a main class (in your example, tEngineNode), and share the same variable (like the speed# above), then you may put that variable in the main class, instead of spreading it in other classes.
That way you don't even need any casting later.
Good planned classes may save lots of work and time in the middle-long run of code development.
Sergio.
Type tEngineNode EndType Type tPlayer Extends tEngineNode Field target:tengineNode EndType Type tVehicle Extends tEngineNode Field speed#=100 Field target:tenginenode EndType player:tplayer=New tplayer vehicle:tvehicle=New tvehicle player.target=vehicle 'here is casting. If tvehicle(player.target) Then Notify tvehicle(player.target).speed# EndIf
Bare in mind that casting is either powerful and dangerous. if you attempt to use it against a wrong class (that is, type), then you get an error. That's why you should check first if the player.target can be 'casted' to a tvehicle type:
If tvehicle(player.target)
Another thing. Classes are powerful, but you should use it wisely. If you have classes that inherits (extends in BMax) from a main class (in your example, tEngineNode), and share the same variable (like the speed# above), then you may put that variable in the main class, instead of spreading it in other classes.
That way you don't even need any casting later.
Good planned classes may save lots of work and time in the middle-long run of code development.
Sergio.