![]() |
Function Overrides
The title says it, really...
Do you think you can make it such that objects can override particular commands? This would be useful in persay, classes that make an item act differently over a particular item, or if we want to override risky functions in order to log them... So on and so forth. Function Overrides. |
Explain what you mean by 'override'? I'm thinking you could do a catchEvent type thing... Not sure though.
|
function __echo(message)
{ sendtonc(player.account @ ":" @ message); } This overrides the default "echo" command. |
Quote:
PHP Code:
NPC Code: This is used in Guis quite a bit to catch and rename the "onAction" function with buttons to a new function name. Useful for many buttons that do simmilar things. |
Overriding means making a function that GOES OVER the current EXISTING function. It replaces the default function by the new one.
I don't want an alias of a function -- We have that possibility. |
I think would be a nice feature. Plus, it is a common trait of the newer object-oriented programming languages (I am not sure about the older ones).
|
Quote:
|
Why that? For better consistency and security most of the time a lot of base functionality cannot be modified or overriden. I don't really think that it's needed, it could save time though if you have already a lot of code and don't want to change all the code to modify some base behaviour.
|
Well -- One way would have classes overriding the default functions...
Lets say that I have a particular... Cat! And well, I have an animal NPC, and it's usually dogs! So when I join cats class to the animal NPC, it would override makeNoise() to say "Meow" instead of "Bark" |
Could make the base functions editable in Control-NPC like you can with Java.
I really want more flexibility in the NPC-Server |
Interesting.. Inverness it would be better to have more over riding functions for the NPC-Control.
|
| All times are GMT +2. The time now is 01:28 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.