![]() |
Custom Classes!
Yea... I was talking with Stan, and I was like 'you can't make custom classes using the new operator'... And it dawned: A function call is what you need. Taking inspiration from Java, I created a custom-class. :)
class manager: (DB: Class ) PHP Code:
PHP Code:
PHP Code:
PHP Code:
:) |
Shouldn't this be in code gallery?
|
Quote:
PHP Code:
PHP Code:
|
Quote:
|
Though I'd like if there was a function called in the class when it was joined and had to be completed before the next class could be joined.
onCreated does not work like this :( |
Osnap, Inver beat you to it, Novo. :(
|
Quote:
|
Quote:
|
Quote:
|
Quote:
PHP Code:
PHP Code:
Such as: PHP Code:
PHP Code:
|
You're overdoing it as far as Graal goes :P
I tried doing something like that for my Mud system and making it modular and stuff, but its easier to just make a class that does everything at once. |
I actually went ahead and did it anyways... So I added inheritance and static functions... :: hums ::
Bah. For some reason, I can't sent it over forums. It says there's a bad request that the server can't understand. |
Quote:
|
Quote:
|
Custom Classes (Database):
PHP Code:
PHP Code:
PHP Code:
PHP Code:
|
If we had support for global functions the way I wanted (including Control-NPC in the function lookup), it would be a simple and easy deal to have global functions (temp.var = TObjectType();) to return the new object instance.
|
Quote:
I made an addition to my TMap set. For those of you who want to use it, I've made a static function for it: class_tmap_static (Class) PHP Code:
PHP Code:
|
Quote:
|
Quote:
PHP Code:
|
Quote:
|
Sure... Phone-Address look-up. In Era.
PHP Code:
Item System: PHP Code:
What I use it for is to have a cumulative effects from the clothing that the player uses. For instance, let's say 'Speed'... PHP Code:
PHP Code:
|
Quote:
Quote:
You're really over-complicating things that are simple to do with regular scripts. Thats not a good way to bring new scripters into the scene. |
Quote:
I don't think introducing new programmers to concepts such as these will help... But alternatively, for those in the know, these techniques could be used with a wide range of successful usage. Ultimately, by my publishing the code, I didn't make it ANY HARDER to learn to script. In fact, that wasn't even my targeted audience. (Additionally, new programmers could learn by example, so they might not see the full utility, but something like that could let them see how reflective programming could be done ) Whether it is overcomplicating something, or providing a bigger re-usability... It doesn't matter that much. Sure, some things just need a little function to work. Others will need more. And in the end, everything can be hard-coded as one massive monolith. In fact, you could program Graal in ONE FUNCTION. Now, if you want to argue the value of TMap... I just provided it as a quick freebie and numerous incidents it could be used. If you're debating about Class System... I think you would already be in a level where you can use it if you considered that it is beneficial to use it in the first place. I provided quite a bit of flexibility. Ultimately, I AM SORRY FOR GIVING YOU FREE CODE, go cry me a river. ( I refuse to feed your troll habits any further. ) |
Quote:
|
Quote:
Though it seems our situations are different if you don't have something you need to be working on and are just scripting for fun. Though, if you do have something you need to do with this all (like making the system for a server) I wouldn't suggest such things. I'm just trying to save you from wasting time overdoing it :P, redesigning systems and such can kill a server under construction. Quote:
|
Quote:
|
Quote:
You're supposed to nip it in the bud. *Shining aura of pure awesome* |
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Quote:
|
Quote:
PHP Code:
|
Welcome, brothers, to the secret thread of elite scripters! I've got some tea and biscuits on the table.
Hi Dan! Show us your 1337 skillz! I'm sure Inverness is no match to your prowess. |
Quote:
Quote:
|
Quote:
|
Quote:
|
Quote:
|
| All times are GMT +2. The time now is 03:08 AM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.