![]() |
Comprehension of classes
Hi, most of you knew me as a decent scripter, but after 2 years of playing WoW I forgot most of my knowledge of GS2. Something I never did understand was classes and how to utilize them. I know in C++ classes can be used for a multitude of useful things, I'm wondering if the same thing applies with GScript?
For example: Can I call a class(join(X); ) and then later in the script use a string or command set in that class without error? If this currently doesn't exist I think it'd be an awesome idea.. |
I think of Graal classes as include functions.
Class: bob PHP Code:
PHP Code:
|
Classes in GScript are probably more closely related to header files in C++ (or object files, even); join is somewhat like #include (or your linker).
|
Yeah, classes are more like objects in C++, as far as I know.
Classes in Graal are very much like inserting the code of a class into any other script. You can also unjoin (so to speak) classes by using the leave() command. Also, onCreated() in the class is separate from onCreated() in the script you join a class to. onCreated() in a class is called when the class is joined. |
Just the type of responses I was looking for, thanks guys :)
|
Quote:
No. o_o When you join something serverside it only uses the serverside portion of the class, and vice versa. |
Quote:
You can't join clientside, then use functions serverside, but it does work vica-versa. I always join serverside, except for player functions. Classes are a way to make a standard object, or a stand script. For example, for a staff block you might want to make a class so that you can just putnpc2, then join the class, rather then putting in the whole script. And this way, if you need to change something, you can. Another way to use classes are to provide functions. Class foo PHP Code:
PHP Code:
EDIT: Also you said Quote:
|
Quote:
|
Quote:
And when joining serverside, you only get the clientside functions if that object has an instance of it clientside, like weapons or npcs in levels. Though players don't appear to work like that, from what little I experimented at least. |
Quote:
|
Quote:
|
Sorry, I was unclear.
I mean that for a player class with clientside functions, it needs to be joined clientside. I join my player classes serverside in the control-npc script, but for the clientside functions, you have to join clientside. Sorry if I was unclear. |
Quote:
|
Quote:
For other classes, always join serverside. |
All times are GMT +2. The time now is 04:22 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.