Step by step instructions for extending a default script nee

Post » Tue Nov 20, 2012 2:49 am

I've looked at the wiki. It says it is easy but there are no instructions about how to do it.

Say I have an object with a default script attached. I can right click it and chose edit and make my changes. But does that change all instances of that script for all objects?
I could add a new empty script with a new name and paste the default script into it and change that script to suit. But what if I can't delete the origional? Do I need to delete the origional?
How the heck do I go about making a script extension? Do I simply give the new script copied and edited below the origional a special name?
User avatar
Angela
 
Posts: 3492
Joined: Mon Mar 05, 2007 8:33 am

Post » Tue Nov 20, 2012 7:56 am

I've looked at the wiki. It says it is easy but there are no instructions about how to do it.

Say I have an object with a default script attached. I can right click it and chose edit and make my changes. But does that change all instances of that script for all objects?
I could add a new empty script with a new name and paste the default script into it and change that script to suit. But what if I can't delete the origional? Do I need to delete the origional?
How the heck do I go about making a script extension? Do I simply give the new script copied and edited below the origional a special name?


It's normally "actor" for scripts that attach to an actor, "objectreference" for object reference scripts, etc. because theit code is not usually re-used, and if it is it's sometimes a global function instead. But... I think you could do something like extending actor to add one particular function, then extending that script for each individual actor script if you want them all to have access to that function with copying and pasting it in each of their scripts.

So something l ike:
scriptname blah extends actorfunction DoSomething()  ;//code hereendfunction
scriptname blahblah extends blah;//You should be able to call DoSomething() here.
scriptname blahblahblah extends blah;//You should be able to call DoSomething() here too.
And then it has access to all member functions and events of the script it extends.
I am not sure if properties and variables are inherited though, intuitively I think they probably aren't.

So: in your specific example, you could extend the default script and add whatever you want to it and still be able to use its functions/events. But if you want to actually change the contents of most of them, there isn't much point in extending it. Also yes, if you change that script it will affect the current users. But if you extend it as a different script, and then change things from the original one in the extension, the original one will not be affected. However, if you extend the original, then change the original later, the extension -will- be affected. (although you might need to recompile them both? not sure about that)
User avatar
alyssa ALYSSA
 
Posts: 3382
Joined: Mon Sep 25, 2006 8:36 pm

Post » Tue Nov 20, 2012 3:22 am

It's the mechanics of making the script I'm asking about. To make a new table you right click on one in the editor, duplicate it and give it a new name. I can't find scripts in the editor so I can't make a new script that way. I can add a new script to an object in the rendor window by choosing add - new, but how do a make that new script be an extension of another? What do I type and where do I type it? On one item I'm trying to put a varient of a default script on it won't let me remove the script that it has already. The little symbol in front of the script name changes from a green down arrow to a red minus when I try to remove that script. Why can't I simply delete it?
User avatar
neen
 
Posts: 3517
Joined: Sun Nov 26, 2006 1:19 pm

Post » Tue Nov 20, 2012 10:19 am

It's the mechanics of making the script I'm asking about. To make a new table you right click on one in the editor, duplicate it and give it a new name. I can't find scripts in the editor so I can't make a new script that way. I can add a new script to an object in the rendor window by choosing add - new, but how do a make that new script be an extension of another? What do I type and where do I type it? On one item I'm trying to put a varient of a default script on it won't let me remove the script that it has already. The little symbol in front of the script name changes from a green down arrow to a red minus when I try to remove that script. Why can't I simply delete it?

1) You can open the script manager from the "gameplay" tab on topmost bar in the CK, and from there you can right-click on any existing script and click "New..." to make a new one. To copy the contents of another one you have to open them both and just copy/paste everything.
2) To make the new script an extension of another, you just change the text after "extends" to the script name of the script you want to extend. It usually sets the extension to the base script for the object type you're adding it to by default.
3) The reason you can't remove some scripts for references in the render window is because they're attached to the base object. The arrow thingy changes so you know that they're disabled for that particular reference, but if you want to remove them from the object completely, you must edit the base object.
User avatar
Jhenna lee Lizama
 
Posts: 3344
Joined: Wed Jun 06, 2007 5:39 am


Return to V - Skyrim