You can.bjorn98009_91 wrote:But can't I write super(missionscript).timer(); also? And cut out the middleman in that function aswell?
Help with DX: Revision
Moderators: Master_Kale, TNM Team
Re: Help with DX: Revision
Jonas Wæver
Chief Poking Manager of TNM
I've made some videogames:
Expeditions: Rome
Expeditions: Viking
Expeditions: Conquistador
Clandestine
Chief Poking Manager of TNM
I've made some videogames:
Expeditions: Rome
Expeditions: Viking
Expeditions: Conquistador
Clandestine
- bjorn98009_91
- Silhouette
- Posts: 688
- Joined: Thu May 08, 2008 8:17 am
- Location: Hufvudstaden, Sweden
- Contact:
Re: Help with DX: Revision
Still is it super(missionscript) or super(revisionmissionscript06)?
Producer and Quality Assurance Manager for Deus Ex: Revision.
Re: Help with DX: Revision
Super(revisionmissionscript06) would be bad: you'd be calling a function from within itself == infinite loop.
Essentially, super.whatever() just calls function whatever() in whichever class your class (the child) is directly extended from (the parent), so you'll then get everything in whatever() in the parent class (which often itself has super.whatever() statements so it propagates up the class heirarchy), and also everything in your own whatever().
If, however, you had duplicated stuff in the parent's whatever() (for example, taking the entire function, and changing some stuff in the middle), then you might not want to directly super.whatever, as then you'd be doing stuff twice per call.
So super(missionscript).whatever() tells the code to skip straight to function whatever() in missionscript, avoiding any code in mission06's whatever().
And you can do this all the way up to actor (and sometimes even object), if you wanted to (but you shouldn't, coz here it would break stuff).
Erm..does that make any sense?
Essentially, super.whatever() just calls function whatever() in whichever class your class (the child) is directly extended from (the parent), so you'll then get everything in whatever() in the parent class (which often itself has super.whatever() statements so it propagates up the class heirarchy), and also everything in your own whatever().
If, however, you had duplicated stuff in the parent's whatever() (for example, taking the entire function, and changing some stuff in the middle), then you might not want to directly super.whatever, as then you'd be doing stuff twice per call.
So super(missionscript).whatever() tells the code to skip straight to function whatever() in missionscript, avoiding any code in mission06's whatever().
And you can do this all the way up to actor (and sometimes even object), if you wanted to (but you shouldn't, coz here it would break stuff).
Erm..does that make any sense?
- bjorn98009_91
- Silhouette
- Posts: 688
- Joined: Thu May 08, 2008 8:17 am
- Location: Hufvudstaden, Sweden
- Contact:
Re: Help with DX: Revision
Oh, I see. And the original Mission06 called its parent firstframe, ie. Mission06 called firstframe in missionscript.
Now, if I do super.firstframe() I'll be calling Mission06 which in turn will be calling Missionscript.
I now know what you are getting at.
Thanks for all the help!
Now, if I do super.firstframe() I'll be calling Mission06 which in turn will be calling Missionscript.
I now know what you are getting at.
Thanks for all the help!
Producer and Quality Assurance Manager for Deus Ex: Revision.