PDA

View Full Version : another scripting question....


icedeyes
08-03-2002, 10:43 AM
This is a start of a script i want to create for randomization of objects position in time.... Since i am quite new to scripting, I have some problems right from the start.... this is a part of the script....

dim a,s,d,button,myselection
randomize
a=rnd*120
s=rnd*100
d=rnd*120
myselection= getvalue ("selectionlist")
myselection.kine.global.posx=a

the last line is my problem..... It pops up a message saying
"ERROR: "object required: 'circle' " or whatever the primitive might be.... I tried something like: myselection.position.x=a but it didn't work either.... I suppose that the program doesn't identify my selection.... how can i make it do this??? Thanks in advance for any replies....

Atyss
08-03-2002, 03:48 PM
I don't know if this will help, but instead of using myselection, try using MySel &

Example:
SetValue MySel & ".geomapprox.gapproxmosl",2


Hope this helps
Salutations - Cheers
Bernard Lebel

icedeyes
08-03-2002, 10:12 PM
thanks atyss... I didn't use your advice preciselly but it helped me figure out what was wrong with my script.... ok i fixed that(it didn't need the equal,just a ,).... but i have another prob.... here is the part of the script so far....

dim a,s,d,myselection,myobj
myselection= getvalue ("selectionlist")
randomize
a=rnd*120
s=rnd*100
d=rnd*120
setvalue myselection & ".kine.local.pos.posx" , a
setvalue myselection & ".kine.local.pos.posy" , s
setvalue myselection & ".kine.local.pos.posz" , d
logmessage "position is " & a & ","& s &","& d

well... the problem is that it works for just one object.... does
anyone have any pointers on how to make it work in an array of elements??? In theory this sould work but it doesn't:

dim a,s,d,myselection,myobj
myselection= getvalue ("selectionlist")
for each myselection
randomize
a=rnd*120
s=rnd*100
d=rnd*120
setvalue myselection & ".kine.local.pos.posx" , a
setvalue myselection & ".kine.local.pos.posy" , s
setvalue myselection & ".kine.local.pos.posz" , d
logmessage "position is " & a & ","& s &","& d
next


Please help me out guys cause this is getting kind of a pain in the ass.... help me out please.... thanks in advance again....

EAP!
08-06-2002, 11:35 AM
what doesn't work right?

are you trying to get this script to move a selected object to a random location? what exactly are you trying to accomplish?

icedeyes
08-06-2002, 11:45 AM
made it work... here is this part of the script.... EAP: for this part all i want it to do is move the objects in a random location but i can't tell you what the full script will do cause i am not sure it is gonna work..... If it works i will post it here... It will be great if it works:buttrock: ....

here it goes:

dim a,s,d,myselection,myobj
set myselection= getvalue ("selectionlist")
for each item in myselection
randomize
a=rnd*120
s=rnd*100
d=rnd*120
setvalue item & ".kine.local.pos.posx" , a
setvalue item & ".kine.local.pos.posy" , s
setvalue item & ".kine.local.pos.posz" , d
logmessage "position is " & a & ","& s &","& d
next

The prob was that i had to create a collection (with set) and then pick all the items in turn....

EAP!
08-06-2002, 10:01 PM
glad you worked it out hope for the best.

CGTalk Moderation
01-13-2006, 01:00 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.