Skip to content

Making Scripts 101

PostScriptReal edited this page Nov 17, 2024 · 7 revisions

This page will teach you how to make scripts for PS's SMD tools.

What are scripts

Scripts are specialised text files that tells the program to perform a user-defined function, this is useful for automating tasks that would otherwise have to be done manually, such as renaming duplicate material pointers (see blender_name_fix.txt for an example of that). This system is incredibly customisable and, best of all, easy to utilise once you figure out how to make them yourself!

Creating Scripts

Mode setting

The first line of any script is the 'mode' header, this tells the program what function the script is utilising, this includes bone duping, pointer fixing and other different settings. Here is a list of each mode setting and what it does:

Bone Transformation Duping

mode dupe

Material Pointer Fixing

mode mat

.bmp Ext Appending

mode bmp

Script Syntax

After setting the 'mode' header, you can start writing the functional components of the script. Depending on what mode you've chosen the syntax will vary. Here is a dictionary that tells you the syntax of each possible script function:

mode dupe
Base Bone
New Bone
Parent Bone
mode mat
Substring to search
Substring to rename
Replacement string
mode bmp
Material to search

Script Creation

Once you understand the basics of scripts, you can begin writing them using the syntax of the respective mode you've chosen. Note that with the search part of mat and bmp modes you can use an asterisk symbol as a wildcard, allowing you to search any term that starts and ends with a specified string based on the position of the wildcard, searching for the start of a pointer requires the wildcard to be at the end, and having it at the start of the line makes the program search at the end of any pointer. If you want to perform multiple actions, you make a new line that has a '-' to represent the end of a task and the program will start a new task after the '-', remember to follow the syntax.

Clone this wiki locally