#!/usr/bin/python'''This script is GPLV2Copyright Gryc UeuspVersion 1189470955'''import randomimport stringimport uuidcountlowerbound = 300countupperbound = 500numberoftrees = random.randrange(countlowerbound, countupperbound)scalelowerbound = 5scaleupperbound = 50template = """<SceneObjectGroup><RootPart><SceneObjectPart xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><CreatorID UUID="ea05cb1b-eabe-46f1-9b64-81722f8995ae" /><OwnerID UUID="ea05cb1b-eabe-46f1-9b64-81722f8995ae" /><GroupID UUID="00000000-0000-0000-0000-000000000000" /><LastOwnerID UUID="00000000-0000-0000-0000-000000000000" /><CreationDate>1189412134</CreationDate><ParentID>0</ParentID><OwnerMask>2147483647</OwnerMask><NextOwnerMask>2147483647</NextOwnerMask><GroupMask>2147483647</GroupMask><EveryoneMask>2147483647</EveryoneMask><BaseMask>2147483647</BaseMask><TimeStampFull>1189442710</TimeStampFull><TimeStampTerse>1189444085</TimeStampTerse><UUID UUID="NewUUID" /><LocalID>702001</LocalID><Name>TreeName</Name><ObjectFlags>268632492</ObjectFlags><Material>0</Material><RegionHandle>1099511628032000</RegionHandle><GroupPosition X="NewPosX" Y="NewPosY" Z="NewPosZ" /><OffsetPosition X="0" Y="0" Z="0" /><RotationOffset X="NewRotationX" Y="0" Z="NewRotationZ" W="1" /><Velocity X="0" Y="0" Z="0" /><AngularVelocity X="0" Y="0" Z="0" /><Acceleration X="0" Y="0" Z="0" /><Description /><Text /><SitName /><TouchName /><Shape><PCode>255</PCode><PathBegin>0</PathBegin><PathEnd>49900</PathEnd><PathScaleX>0</PathScaleX><PathScaleY>0</PathScaleY><PathShearX>0</PathShearX><PathShearY>0</PathShearY><PathSkew>0</PathSkew><ProfileBegin>0</ProfileBegin><ProfileEnd>0</ProfileEnd><Scale X="NewScaleX" Y="NewScaleY" Z="NewScaleZ" /><PathCurve>16</PathCurve><ProfileCurve>0</ProfileCurve><ProfileHollow>0</ProfileHollow><PathRadiusOffset>0</PathRadiusOffset><PathRevolutions>0</PathRevolutions><PathTaperX>0</PathTaperX><PathTaperY>0</PathTaperY><PathTwist>0</PathTwist><PathTwistBegin>0</PathTwistBegin><TextureEntry>AAAAAAAAAACZmQAAAAAABQAAAAAAAAAAgD8AAACAPwAAAAAAAAAAAAAAAAA=</TextureEntry><ExtraParams>AA==</ExtraParams><ProfileShape>Circle</ProfileShape></Shape><Scale X="NewScaleX" Y="NewScaleY" Z="NewScaleZ" /></SceneObjectPart></RootPart><OtherParts /></SceneObjectGroup>"""#Does LocalID need to be random? Or can it stay as that generic number? Seems OpenSim doesnt care.trees = []for i in range(1, numberoftrees): tree = template tree = tree.replace("NewUUID", str(uuid.uuid4())) tree = tree.replace("TreeName", "Tree"+str(i)) tree = tree.replace("NewScaleX", str(random.random()*random.randrange(scalelowerbound, scaleupperbound))) tree = tree.replace("NewScaleY", str(random.random()*random.randrange(scalelowerbound, scaleupperbound))) tree = tree.replace("NewScaleZ", str(random.random()*random.randrange(scalelowerbound, scaleupperbound))) tree = tree.replace("NewRotationX", str(0)) tree = tree.replace("NewRotationY", str(0)) tree = tree.replace("NewRotationZ", str(random.randrange(0, 360))) #Perhaps start the pos at 128, 128, then add or subtract 0-128 from each. Though this would make it more dense at the center than at the edges. Maybe. tree = tree.replace("NewPosX", str(random.random()*random.randrange(0, 256))) tree = tree.replace("NewPosY", str(random.random()*random.randrange(0, 256))) tree = tree.replace("NewPosZ", str(22)) #Only works with flat terrains, I think? trees.append(tree)print("<scene>")print("")for i in trees: print(i)print("")print("</scene>")