my messy code

Become a member of the CGSociety

Connect, Share, and Learn with our Large Growing CG Art Community. It's Free!

THREAD CLOSED
 
Thread Tools Search this Thread Display Modes
  11 November 2013
for me as novice this code was most transparent

select geometry
mycontrollerlist=#(Position_XYZ,audioposition)

for o in selection do
(
local controller = classof o.position.controller

for item in mycontrollerlist do
(
if item == controller then
(
messagebox "I found my controllers"
exit
)
)

I check it on geometry with Position_XYZ controllers
But don't work.
 
  11 November 2013
Originally Posted by kredka: Without your help I would't be able to do much

(
	-- make a test scene
	delete objects
	which = #(Box, Sphere, Cone, Teapot)
	for k=1 to 100 do which[random 1 4] name:(formattedprint k format:"03d")

	-- do a check
	for n in objects do
	(
		i = finditem which (classof n)
		case i of
		(
			1: format "%:\t-> Box\n" n.name 
			2: format "%:\t-> Sphere\n" n.name 
			3: format "%:\t-> Cone\n" n.name 
	  default: format "%:\t-> X3\n" n.name 
		)
	)
)
 
  12 December 2013
simplest list compare case

ok, let say I have such a case: I have numbers in list and I what popup if I found on of object from my list. Code is:

objlist=#(2,4,5)
for i =1 to 10 do
(
print i
if i==objlist then messagebox "sss" --<--- here is my action but don't work
)

and second case:

I want loop in exception(exclude) of my objlist=#(2,4,5)

so it should be:
for i=(from 1 with exception of objlist)? to 10

I know it's simple but I know I'm very close with first one however something is missing. Second case may be totally wrong.
 
  12 December 2013
Originally Posted by kredka: ok, let say I have such a case: I have numbers in list and I what popup if I found on of object from my list. Code is:

objlist=#(2,4,5)
for i =1 to 10 do
(
print i
if i==objlist then messagebox "sss" --<--- here is my action but don't work
)

and second case:

I want loop in exception(exclude) of my objlist=#(2,4,5)

so it should be:
for i=(from 1 with exception of objlist)? to 10

I know it's simple but I know I'm very close with first one however something is missing. Second case may be totally wrong.

First case
for i = 1 to 10 where findItem objlist i != 0 do print i 

And second case (opposite)
for i = 1 to 10 where findItem objlist i == 0 do print i

BTW read about "Array Values" topic in mxs help
__________________
Looking in the right side. [bgaTools]
 
  12 December 2013
Thread automatically closed

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.
__________________
CGTalk Policy/Legalities
Note that as CGTalk Members, you agree to the terms and conditions of using this website.
 
Thread Closed share thread



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
CGSociety
Society of Digital Artists
www.cgsociety.org

Powered by vBulletin
Copyright ©2000 - 2006,
Jelsoft Enterprises Ltd.
Minimize Ads
Forum Jump
Miscellaneous

All times are GMT. The time now is 04:58 AM.


Powered by vBulletin
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.