NFS-VltEd - Usage #2 - the ModScript format


The ModScript

It's a simple scripting language that supports several commands, external files, basic file operations and comments. The format is text-based, so NFSMS files can be edited via any text editor (for example Notepad).





comment, starts with # and continue until the end of the line.


Examples:

#comment
# second comment

The following commands are supported:

game arg…

Specifies to which games the script can be imported to.
arg - allowed values are: MW, C, PS, UC and W. It's allowed to pass more than one parameter.

When the script will be imported to not supported game the following error message will be displayed:
Examples:

game MW # the script can be imported to Most Wanted only.
game C PS W # the script can be imported for the following games: Carbon, ProStreet and World


ui_text text continue until the end of the line.

Optional message that will be displayed during the import process. This command can be used multiple times to add multi-line text.

Examples:

ui_text1st line of the message
ui_text2nd line of the message
ui_text# this will display empty line
ui_text3rd line of the message

ui_image arg

arg – source relative path to the image that will be displayed in the wizard

Examples:
ui_image files\Image1.jpg
ui_image “My Custom Folder\Image2.jpg”


script path

path – relative path to mod script that will be displayed in the wizard. External script is executed starting from place where it was added. Only relative (relative to the main script) paths are supported. The file extension is not validated, so you can use your own.

Examples:

script files\settings.nfsms
script files\files.nfsms
script “My Custom Folder\Files.anything”


file_copy sourcePath destinationPath

Copies the file from the mod to the game's folder. Backup of target file will be created automatically.

sourcePath – source relative path (to mod script) of file that will be copied
destinationPath - destination relative path (to game main directory)

Examples:
file_copy FILE.BIN CARS\MIATA\GEOMETRY.BIN
file_copy “My Custom Folder\SuperCar.BIN” CARS\MIATA\GEOMETRY.BIN #comment


folder_create path

Creates folders and subfolders relative to the game's folder unless they already exist.


ui_control type name attribute text

The command allows to add a control to the wizard when importing the script. Two types of controls are supported: checkbox and radiobutton.
type - defines a type of control to create. Allowed values: checkbox, radiobutton.
name - unique control name
text - label to be displayed next to control
attribute - control's specific parameter. For checkbox this parameter defines initial state of the control. Allowed attributes are: true and false. Checkbox will be ticked by default when the attribute is true. Radiobutton control stores option unique name in the attribute.



Example:
ui_control checkbox files_checkbox false "Install files"
ui_control checkbox settings_checkbox true "Install settings"

ui_textFirst group of radiobuttons, only one option can be chosen:
ui_control radiobutton my_radio_button_1 option1 "Option 1"
ui_control radiobutton my_radio_button_1 option2 "Option 2"
ui_control radiobutton my_radio_button_1 option3 "Option 3"

ui_option files_checkbox
script files\files.nfsms
ui_option files_checkbox

ui_option settings_checkbox
script files\settings.nfsms
ui_option settings_checkbox

ui_option my_radio_button_1 option1
script files\settings.nfsms 
ui_option my_radio_button_1 option1

ui_option my_radio_button_1 option2
script files\files.nfsms
ui_option my_radio_button_1 option2

ui_option my_radio_button_1 option3
# do nothing
ui_option my_radio_button_1 option3

The example has 3 controls: 2 checkboxes and 1 radiobutton with 3 options. The settings_checkbox control is ticked by default because the argument value is true. The my_radio_button_1 control is a radiobutton with 3 options. Each of option has own and unique name (the is no restriction to use the option prefix), and is linked to the pair of the ui_option controls. When "Option 1" is ticked then only the following block will be executed:

ui_option my_radio_button_1 option1
script files\settings.nfsms 
ui_option my_radio_button_1 option1

other ui_option blocks assigned to the radiobutton will be skipped.



The following commands can be created using the graphical interface of NFS-VltEd:

add_node class parentNode nodeName

The command adds new node to the class.
class - name of the top-level node
parentNode - name of the node where the new node will be created
nodeName - name of the node to be created

Example:
add_node pvehicle cops superCar


copy_node class sourceNode parentNode nodeName

The command copies the node to different parent.
class - name of the top-level node
sourceNode - name of the node to be copied
parentNode – name of the parent node where the node will be copied
nodeName - name of the copied node

Example:
copy_node pvehicle ccx cops ccx_copy


delete_node class node

The command deletes the node given after the command.
class - name of the top-level node
node – name of the node to be deleted

Example:
delete_node pursuitsupport supportrace_10


rename_node class node name

The command renames the node.
class - name of the top-level node
node - the node to be modified
name – new name

Example:
rename_node pvehicle copgtoghost copnew


change_vault class node vaultName

The command changes the vault name.
class - name of the top-level node
node - node to be modified
vaultName – new vault name. The vault name is the name of the collection used internally by the game engine. This name is independent of files and allows to "group" nodes from different files into the same collection. The name cannot be changed for any of nodes that belong to the gameplay class. Not allowed names: db, frontend, cars and commerce.


add_field class node field

The command add a new field.
class - name of the top-level node
node – name of the node to be modified
field - name of the field to be created

Example:
add_field pvehicle 997tt PlayerUsable


delete_field class node field

The command deletes the field.
class - name of the top-level node
node – name of the node to be modified
field - name of the field to be deleted

Example:
delete_field pvehicle 997tt PlayerUsable


resize_field class node field size

The command resize the field.
class - name of the top-level node
node – name of the node to be modified
field - name of the field to be resized
size - target size. Size of the array must be greater than 0.

Example:
resize_field tires copmidsize_nis STEERING_RANGE 15


copy_fields class sourceNode targetNode options

The command copies the fields with values to different node.
sourceNode - name of the node from which the fields will be copied
targetNode – name of the node where the fields will be copied
options - allowed values: base, optional, overwrite. Values can be combined using the | char, for example: optional|overwrite, which means that only optional fields will be copied with overwriting.

Example:
copy_fields tires europa challenger71 base|optional


update_field class node field value

The command changes the value of the field.
class - name of the top-level node
node – name of the node to be modified
field - name of the field to be modified
value - new value of the modified field

Example:
update_field pvehicle copgtoghost MODEL Collision64 COPGTOGHOST

resize_collection class node field size

The command resize the collection.
class - name of the top-level node
node – name of the node to be modified
field - name of the field to be resized
size - target size. Size of the array must be greater than 0.

Example:
resize_collection car_tuning bmw_m3_e92_08 CAMBER_LEFT Front_XValues 1


update_collection class node field index property value

The command updates the value of the item from the collection.
class - name of the top-level node
node – name of the node to be modified
field - name of the field to be modified
index - item's index from the collection
property - property of the item to be modified
value - new value of the modified field

Example:
update_collection shiftpattern 911turbo_1 ShiftPattern[0] XValues 1 Value 0.9

Comments

  1. So Ill be able to create a mod for multiple games using just one script?

    ReplyDelete
  2. Ahh, ui_control is really needed thing for me, thanks!

    ReplyDelete
  3. Any chance you could answer my questions on Discord?

    ReplyDelete
  4. Nice! This is really helpful, thank you :^)

    ReplyDelete

Post a Comment

Popular posts from this blog

NFS-VltEd v4.5 Released