Python scripts for Dark Radiant
From The DarkMod Wiki
Jump to navigationJump to search
YOU MUST HAVE PYTHON 2.6 INSTALLED FOR THESE TWO SCRIPTS
Shifts textures in one (the up) direction:
# Set the command name so that DarkRadiant recognises this file __commandName__ = 'shiftup' # The actual algorithm called by DarkRadiant # is contained in the execute() function def execute(): import random s = random.randint(0, 256) for i in range(0, s+1): GlobalCommandSystem.execute('texshiftup "' + str(s) + '"') else: print("texture translated over" + str(s) ) # The variable __executeCommand__ evaluates to true # when DarkRadiant executes this command if __executeCommand__: execute()
Shifts textures in both direction:
# Set the command name so that DarkRadiant recognises this file __commandName__ = 'shift' # The actual algorithm called by DarkRadiant # is contained in the execute() function def execute(): import random s = random.randint(0, 256) t = random.randint(0, 256) for i in range(0, s+1): GlobalCommandSystem.execute('texshiftright "' + str(s) + '"') else: for i in range(0, t+1): GlobalCommandSystem.execute('texshiftup "' + str(t) + '"') else: print("texture translated over" + str(s) + " " + str(t)) # The variable __executeCommand__ evaluates to true # when DarkRadiant executes this command if __executeCommand__: execute()