Graal Forums  

Go Back   Graal Forums > Private forums > Graal4 Forums > Graal V4 Main Forum
FAQ Members List Calendar Today's Posts

 
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 09-23-2005, 03:28 AM
Velox Cruentus Velox Cruentus is offline
Registered User
Velox Cruentus's Avatar
Join Date: Dec 2004
Location: Quebec, Canada
Posts: 465
Velox Cruentus is on a distinguished road
Send a message via ICQ to Velox Cruentus Send a message via AIM to Velox Cruentus
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.
__________________
In a world of change... Who'll you believe?
  #2  
Old 09-23-2005, 04:46 AM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
Explain what you mean by 'override'? I'm thinking you could do a catchEvent type thing... Not sure though.
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
  #3  
Old 09-23-2005, 05:07 AM
Velox Cruentus Velox Cruentus is offline
Registered User
Velox Cruentus's Avatar
Join Date: Dec 2004
Location: Quebec, Canada
Posts: 465
Velox Cruentus is on a distinguished road
Send a message via ICQ to Velox Cruentus Send a message via AIM to Velox Cruentus
function __echo(message)
{
sendtonc(player.account @ ":" @ message);
}

This overrides the default "echo" command.
__________________
In a world of change... Who'll you believe?
  #4  
Old 09-24-2005, 12:23 AM
ForgottenLegacy ForgottenLegacy is offline
-Backtoscripts-
Join Date: Aug 2003
Location: California
Posts: 289
ForgottenLegacy is on a distinguished road
Send a message via AIM to ForgottenLegacy
Quote:
Originally Posted by Velox Cruentus
function __echo(message)
{
sendtonc(player.account @ ":" @ message);
}

This overrides the default "echo" command.
PHP Code:
(target).catchEvent(Object,PreviousEvent,NewEvent); 
Ex:

NPC Code:

player.catchEvent(player,"onKeyPressed","onAttacki ngTheKeyboard");
function onAttackingTheKeyboard(code,key) {
// Various scripts.
}



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.
__________________
"The higher you fly, the harder it is to breathe."

[Kaidenn] Maybe I will somehow take control of Lance's body when he isn't looking, have him log onto Kingdoms, update one script, and leave.
[Kaidenn] And leave him exactly where I found him, unchanged and completely unnaware of what just took place the last two minutes.
[GrowlZ] Lance: You might want to lock your bedroom door tonight
  #5  
Old 09-24-2005, 03:05 AM
Velox Cruentus Velox Cruentus is offline
Registered User
Velox Cruentus's Avatar
Join Date: Dec 2004
Location: Quebec, Canada
Posts: 465
Velox Cruentus is on a distinguished road
Send a message via ICQ to Velox Cruentus Send a message via AIM to Velox Cruentus
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.
__________________
In a world of change... Who'll you believe?
  #6  
Old 09-24-2005, 04:34 AM
napo_p2p napo_p2p is offline
oh snaps
napo_p2p's Avatar
Join Date: Sep 2003
Location: Pismo Beach, California
Posts: 2,118
napo_p2p has a spectacular aura aboutnapo_p2p has a spectacular aura about
Send a message via AIM to napo_p2p Send a message via MSN to napo_p2p
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).
__________________
Scito hoc super omnia.
Haec vita est tua una sola.
Dum vita superest, utere maxime quoque puncto, momento, et hora quae habes.
Tempus neminem non manet.
Noli manere tempus.
Carpe Diem

Seize the Day.
  #7  
Old 09-24-2005, 12:58 PM
Sildae Sildae is offline
Elven sorceress!
Sildae's Avatar
Join Date: Dec 2001
Location: Lothlòrien
Posts: 159
Sildae is on a distinguished road
Quote:
Originally Posted by napo_p2p
Plus, it is a common trait of the newer object-oriented programming languages (I am not sure about the older ones).
Overriding functions is like the trait of object oriented programming languages. If a language does not support it, it is hardly object oriented.
__________________
"The reasonable man adapts himself to the world; the unreasonable one persists in trying to adapt the world to himself. Therefore all progress depends on the unreasonable man."
-- George Bernard Shaw
  #8  
Old 09-24-2005, 04:18 PM
Admins Admins is offline
Graal Administration
Join Date: Jan 2000
Location: Admins
Posts: 11,693
Admins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud ofAdmins has much to be proud of
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.
  #9  
Old 09-24-2005, 06:16 PM
Velox Cruentus Velox Cruentus is offline
Registered User
Velox Cruentus's Avatar
Join Date: Dec 2004
Location: Quebec, Canada
Posts: 465
Velox Cruentus is on a distinguished road
Send a message via ICQ to Velox Cruentus Send a message via AIM to Velox Cruentus
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"
__________________
In a world of change... Who'll you believe?
  #10  
Old 09-25-2005, 04:07 AM
Inverness Inverness is offline
Incubator
Inverness's Avatar
Join Date: Aug 2004
Location: Houston, Texas
Posts: 3,613
Inverness is a jewel in the roughInverness is a jewel in the rough
Could make the base functions editable in Control-NPC like you can with Java.
I really want more flexibility in the NPC-Server
__________________
  #11  
Old 09-25-2005, 08:14 AM
DarkFireXZ3 DarkFireXZ3 is offline
Owner - Kudosai
Join Date: May 2005
Location: Texas
Posts: 84
DarkFireXZ3 is on a distinguished road
Send a message via ICQ to DarkFireXZ3 Send a message via AIM to DarkFireXZ3 Send a message via MSN to DarkFireXZ3 Send a message via Yahoo to DarkFireXZ3
Interesting.. Inverness it would be better to have more over riding functions for the NPC-Control.
__________________
Email: [email protected]
Yahoo: [email protected]
Aim: DarkFireXZ3







 


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 10:36 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.