Because as soon as you solve the character problem you will immediately have another one waiting for you.
However, wanting to continue your work, the answer you are looking for has been given to you:
You didn’t initialize ThirdPersonNavigation instance. In Object Pascal, to create an instance of an object, we can call its special Create method, which is a constructor or another custom constructor defined by the class itself.
So, it would appear that to create an instance of ThirdPersonNavigation you need to use the Create method or a custom constructor.
Why don’t you start by searching the Internet for how to use the Create method or take a look at the different CGE demos where you can probably find good examples?
I’m not sure what you mean by “pointers usually store constant amounts of data”. You allocate a pointer, it can hold the amount of data you specified. You can later reallocate to hold more or less. But even if pointer keeps storing the same amount of data, it doesn’t mean that the data is constant.
To be more straightforward, a “pointer” is a very different concept that a “constant” in programming languages. Above you seem to equate them, but they are different concepts. A pointer is an address to some data. A constant is a data that cannot change.
If you declare a variable like var MyObject: TObject, it is
an instance of a class (but remember to initialize it)
every instance of a class is internally also a pointer
not a constant.
Anyhow, thank you for taking my advise and reading and learning. I’m happy to clear some mistakes (like above mixing “constants” with “pointers”) if I see you take learning on your own.
As for the book ( Free Object Pascal Handbook by Marco Cantu - Embarcadero ), I cannot send you a PDF – the author doesn’t want the book to be distributed freely, I don’t want to break it. I’m not sure what goes wrong (did you really check thousand times, as you say you literally did :), that you provided correct email? and checked spam?). You can always create a new email, there’s lots of places (like gmail or protonmail or tutanota) to get a free email account. The book is worth it.
Valterb in his post already provided more concrete hints how to initialize an instance.
Oh, just to clarify I know pointers and constants are different concepts, but the tutorials I found seemed to tell you that they will be treated as constants when passed as reference, which again is fine with me and I can get used to weird exceptions like that with practice, and I know your point is I won’t get used to it without practice, which I wholly understand.
However, I also get your guys’ point that what I actually need in my case is to learn how to initalize an object by myself so I don’t repeat that particular mistake a hundred times,
and I get that variables and such need to be initalized or they are undefined as well.
Sadly, the particular tutorial I read (the FPC and Lazrus Wiki) didn’t mention anything about classes needing to be initalized, only a general idea of what a class was.
And yes, I am positive I checked continously, although I admit a thousand is more for
exaggeration, but it certainly wasn’t just two or three times either is my point.
I suppose however, getting a free email account is my better option if this one doesn’t
cooperate for whatever reason.
Okay, now it downloads succesfully on my new email account.
Excellent! Now I can read it, and it’s 100% aimed at beginners I am assuming, like it will spell out that I need to initalize my classes first for example, whereas the other ones, even the tutorial on cars you gave me for example doesn’t actually do that and just assumes you know that’s what’s needed to be done.
I know this is gonna be a great read, and so I won’t need to ask questions based on basic misunderstandings anymore is my hope.
Okay, I have been doing some reading and got through most of chapter 1, and it’s been very helpful about giving me every detail.
So like before, in the other tutorials like in the Manual page it was just telling me to copy directions without asking too many questions about understanding why it works, but here it clarifies that Units give you a set of procedures and routines that you wouldn’t have otherwise, just like an include file in C++ programming.
And now I’m on the very beginning of chapter 2, on variables, so it explains to me that Pascal is highly structured and “strongly-typed” in programming speak, and so I need everything in a specific types because Pascal is particular about what operations act on what data types, which is something I rememeber you explaining to me but you knew I wouldn’t understand unless I actually read something that explained it to me in layman terms.
The book is still an awesome resource, and thank you very much for it!
And it also explains to me that vars have to be intialized before you can use them in the chapter, just like you were saying. I get as well that classes need the same thing, even though I am not on that chapter yet.
It is a little annoying that classes need to be initailized with a weird Constructor thing rather than just typing “class := value”, but I guess it’s just in the nature of how classes work, like they’re a lot different and more complicated than simple vars.
And now I also get your guys’ point that it’s not necessary to initalize the ThirdPersonNavigation at all, because it’s already initalized for me in the third person navigation unit.
However, even the book tells me that unit variables are always accessed with “unitname.variable”, like if you have multiple units with the same variable name as is probably my case with here with the huge amount of units I have in my project.
Oh, I mean in the book, it tells me that if I include Units, it includes variables that are defined in it; maybe I should have been more specific about saying “define” and not “initalize” in the spirit of not making silly mistakes.
Oh yeah, and it includes procedures and functions as well. From what I can understand Units are nothing more than pieces of code that give you code already so you don’t have to type every single little thing from the ground up, a lot like libraries from C++ and many other languages. Does that sound right to you as well?
Okay, and I get how to do the constructor in general following the TViewMain example, and doing it the same way, but unfortunately get an error about method identifier expected, even though I am using the same exact method as is given for TViewMain and I know from looking it up on the TCastleThirdPersonNavigation page, that it is in fact done the same exact way as TViewMain syntax wise.
And because I have a problem on this line first and foremost, I decided to ignore everything else and focus on only this error, because that’s what the compiler is telling me is wrong even though it shouldn’t be logically based on how I notice classes and class constructers are defined.
I also know that “method” is something different in Castle Game Engine vs the more general meaning of “technique”, like it means more like a code that does something specific, like a procedure but different, but either way if the manual tells me that I should type the exact code I did type, then I don’t know what the heck is going on.
For that matter, even when I include “begin” and “end” sections like I saw is done for TViewMain, (I know begin and end mean the beginning and ending of a block of code from reading the help book and inferring from other examples), it gives me the same exact error on the same exact line. It doesn’t make sense to get errors when I follow the same exact formatting as other class constructors focusing on that one line.