Message 1 of 20
Maxscript problems
Not applicable
02-14-2011
11:19 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'd like to start off by saying that my native language is not English and I apologize for any spelling/grammar mistakes.
I've recently started getting into MAXscript and whilst making some practice scripts I've encountered problems where my current MAXscript knowledge fails (due to lack thereof) to solve these.
So if any of you were so kind to reply with an answer and maybe give some constructive critisism I'd greatly apreciate it. So far I have 2 questions I'd like to ask involving the code I've written so far.
Question 1:
This is what I've got so far. It's a variation of the script from the first CGacedemy "MAXscript fundamentals" series.
I'd like to expand on this and parent the houses to the vertexes at wich they were created but I have no idea how I'd have to do so.
Question 2:
When I found out I could make floaters and all those visual things, I tried to make an easy calculator script as practice. Evaluating the script doesn't give any errors but when I run the script and press the button "Calculate", nothing happens, not even an error. So if someone can find out what I'm doing wrong please tell me so.
Thanks for reading through all this and I appreciate all support.
I've recently started getting into MAXscript and whilst making some practice scripts I've encountered problems where my current MAXscript knowledge fails (due to lack thereof) to solve these.
So if any of you were so kind to reply with an answer and maybe give some constructive critisism I'd greatly apreciate it. So far I have 2 questions I'd like to ask involving the code I've written so far.
Question 1:
This is what I've got so far. It's a variation of the script from the first CGacedemy "MAXscript fundamentals" series.
I'd like to expand on this and parent the houses to the vertexes at wich they were created but I have no idea how I'd have to do so.
macroscript CreateACity
category:"myTESTscripts"
(
function makeSingleHouse inputhouseSize housePosition = (
rndValue1 = inputhouseSize - (inputhouseSize / 6.0)
rndValue2 = inputhouseSize + (inputhouseSize / 6.0)
houseSize = random rndValue1 rndValue2
houseBase = box length: houseSize width: houseSize height: (houseSize / 5.0 * 4.0)
houseRoof = pyramid width: houseSize depth: houseSize height: (houseSize / 5.0 * 3.0)
houseBase.mapcoords = true
houseRoof.mapcoords = true
houseBase.wirecolor = color 110 41 0
houseRoof.wirecolor = color 69 62 57
houseBase.position = housePosition
houseRoof.position = housePosition +
newSeed = random 0 9999
roofNoise = NoiseModifier seed: newSeed scale: 24.0 strength:
addModifier houseRoof roofNoise
)
baseArray = selection as array
for i = 1 to baseArray.count do ( --Repeat this step for every object in selection
vertexCount = getNumVerts baseArray.mesh
for vertIndex = 1 to vertexCount do ( --Repeat this step for every vertex in object
localVertexPosition = getvert baseArray.mesh vertIndex
newPosition = localVertexPosition*baseArray.transform
makeSingleHouse (random 18 22) newPosition
)
)
)
Question 2:
When I found out I could make floaters and all those visual things, I tried to make an easy calculator script as practice. Evaluating the script doesn't give any errors but when I run the script and press the button "Calculate", nothing happens, not even an error. So if someone can find out what I'm doing wrong please tell me so.
macroscript edittext
category: "myTESTscripts"
tooltip: "edittext test"
(
rollout EnterValues "Value Enter Rollout"
(
edittext Value1 "01"
edittext Value2 "02"
listbox wichCalculation "What to do?" items:#("Add", "Subtract", "Multiply", "Divide")
button calculate "Calculate"
on calculate pressed do
(
Value01 = (Value1.text as float)
Value02 = (Value2.text as float)
if wichCalculation.selection ==1 then result = ( Value01 + Value02)
else if wichCalculation.selection == 2 then result = ( Value01 - Value02)
else if wichCalculation.selection == 3 then result = ( Value01 * Value02)
else if wichCalculation.selection == 4 then result = ( Value01 / Value02)
)
)
addRollout EnterValues (newRolloutFloater "Calculator" 320 300)
print result
)
Thanks for reading through all this and I appreciate all support.
