![]() |
Classes?
Alright. I haven't been scripting in a while but decided to pick it up again. I started playing with mouse stuff and replacement status displays, menus, etc. and it seems simple enough.
I know that Stefan calls something on NPC server "classes" are these really classes as in objectorientedness? If so how do you declair a class and it's methods etc? If GScript were objectoriented it would be much eaiser to do a lot of cool stuff. :) |
Nope.
You can put scripts into units that are called classes. NPCs can join these classes using the 'join classname;' statement, obviously (which should be put outside of any block). These classes are then linked with the NPCs joining them as if they were a part of the main NPC's script. The NPC can call functions from the class, and the other way around, and events in the class get executed just as if you had placed them directly in the NPC. The advantage is easier maintenance, and less memory use because code is not duplicated for multiple NPCs. |
So it's like pesudo-class. Gottcha.
I haven't tried this yet, but can you pass arguments to function calls? If so what's the syntax? |
Quote:
|
Well that stinks. Glad it's been added :D
Having coded for years I find myself amazingly fustrated at the amount of redundency required in GScript :) |
Aren't they often called database-NPCs?
Anyway, yeah it's a NPC stored in the NPCserver which then can be 'called' [with certain variables i believe]. |
Quote:
|
Quote:
And osrs is right. |
Quote:
Half. Then what are database NPCs? |
Quote:
|
Quote:
|
No.
|
LOL, classes are classes, and dbnpcs are dbnpcs, that's why there's two different buttons on the RC? Meaning there is a difference?
|
NPC Code: That message code got the name of the class when I used it in a class. When I do /stats and it says: DB NPCs: 2017 Babylon does NOT have 2017 DB NPCs in our NPC List. That number is how many NPCs are either joining a class, or are a class. |
You counted? :megaeek:
|
Quote:
|
Quote:
|
Quote:
|
Geez, i didn't know that #N existed. :whatever:
|
o.o
I never knew local NPCs could use warpto...:O!
|
They don't. Putnpc2 doesn't make a local NPC, it's making a global NPC.... Like, for instance, the ships on GK isn't Database NPCs, each of them is a putnpc2 variable (except the Ferries, they run by a DB NPC themselves)
The differance between classes and Database NPCs is that: Classes aren't NPCs, they are only excistant by the pure fact that they are used by NPCs Database NPCs are NPCs on thier own. They aren't attached to levels as other NPCs are, and they can travel. (Thus, when you update a level, putnpc2 aren't wiped out because they aren't part of the level, however you could use /clearnpcs levelname and clear only the putnpc2's out, and not the npcs) Hope that clairfies. |
| All times are GMT +2. The time now is 10:46 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.