Python scripts for Dark Radiant

From The DarkMod Wiki
Revision as of 14:28, 2 November 2009 by Flanders (talk | contribs) (py scripts for DR)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

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()