====== Implement my own scripts without touching any original script ======
It is useful not to change standard Wolfpack files as there can be problems with updating these changed files. So we will create a new directory where we will put our "own" scripts in.
===== Create "our" directory, files and edit wolfpack.xml =====
First of all we need a directory to put our scripts in. Let's name this directory "myownscripts". It should be in the Wolfpack directory.
Now you must edit your "wolfpack.xml". Search for "**
===== Python Script =====
Let's assume you create a script for a skirt which gives the system message "Hello World" when a player double clicks on it. Create a script file in your directory (let's say the name of the file is "skirt.py"). Implement it in your "myownscripts/index.xml":
And your skirt.py looks like this:
def onUse( char, item ):
char.socket.sysmessage( 'Hello World' )
return
OK, now we have the script, but the item definition is still missing.
===== Item definition =====
We create a file named "skirt.xml" in our "myonwscripts" directory. It contains the definition of our new item.
Clothes\Legs\Our Skirt0x1516equipment,myownscripts.skirt
This item has the values of the item with the item id 1531 (skirt, definitions/equipment/clothes.xml) plus our script (the additional tags make it. **Be careful: the tag will overwrite all inherited basescripts, so we need to add the "equipment" script, too.**).
Now, after reloading the scripts, we can add "our_skirt" and we will get the system message "Hello World" when double clicking it.