[STICKY] A four-step guide for using Javascripts from the Vault

Got any custom JavaScript additions/tweaks you think other people would like to see? Post 'em here!
Post Reply
User avatar
Xuri
Site Admin
Posts: 3704
Joined: Mon Jun 02, 2003 9:11 am
Location: Norway
Has thanked: 48 times
Been thanked: 8 times
Contact:

A four-step guide for using Javascripts from the Vault

Post by Xuri »

Setting up the Javascripts you find in the Script Vault may differ from script to script, and sometimes setup-instructions are included in the scripts, but generally speaking the process goes something like this:

Step One:
Copy & paste (or click the "Download" link if available) the script into a new text-file and save that text-file with the file-extension .js somewhere inside the UOX3/JS/ folder (the CUSTOM\ folder being a popular choice).

Step Two:
Open jse_fileassociations.scp in your favourite text-editor, and add an entry for your new .js script, assigning it a unique scriptID not used elsewhere in the file. Make sure that you add the entry for your script inside the proper section of the file. Most scripts go inside the [SCRIPT_LIST]-section, commands go inside the [COMMAND_SCRIPTS]-section, etc.

Example:
scriptID=foldername/scriptname.js
or
6000=custom/myCustomJavascript.js


Step Three:
Either restart UOX3 or reload the Javascript portion of the server through the console menu (accessible through * followed by ? in the console window)

Step Four:
Set up your item or NPC with the newly added JS-script, either by using the in-game command 'SETSCPTRIG <scriptID> or by adding a SCRIPT=<scriptID> tag to the definition of your item or NPC. If the latter, make sure that you reload the DFN-portion of UOX3 (or restart the server) using the console menu before you try adding the item/NPC ingame, or the script will not be active for said item/NPC.
-= Ho Eyo He Hum =-
Post Reply