Would you like to react to this message? Create an account in a few clicks or log in to continue.



 
HomePortalSearchLatest imagesRegisterLog in

 

 @PB, the benevolent programmer

Go down 
5 posters
AuthorMessage
thereclaimer

thereclaimer


Posts : 181
Join date : 2007-12-14
Location : San Francisco, CA

@PB, the benevolent programmer Empty
PostSubject: @PB, the benevolent programmer   @PB, the benevolent programmer I_icon_minitimeFri Dec 19, 2008 1:49 pm

I'm trying to teach myself how to write expressions in Maya/with mel script. Mel script is pretty much a dumbed down version of C. I took programming in high school and know the basic data structures and thought I would be fine... UNTIL I SAW THIS:

@PB, the benevolent programmer WTFITS

WTFITS?!?!

In exchange for answer, here's a girl I'd cheat on Hermione with.
@PB, the benevolent programmer 1229367590393
Back to top Go down
Galt

Galt


Posts : 767
Join date : 2007-12-11
Age : 40
Location : Get Fucked

@PB, the benevolent programmer Empty
PostSubject: Re: @PB, the benevolent programmer   @PB, the benevolent programmer I_icon_minitimeFri Dec 19, 2008 7:31 pm

Ah, the ol' Balloon,scaleY = (time < 2) ? time / 2: time * 2; gag. Generally this is indicative that a perpendicularly oriented pizza box monitor holder gave way and it fell on your face. At least that is what it ended up being the last 3 times I saw it.
Back to top Go down
http://www.fuckyermother.com
Comotosis

Comotosis


Posts : 453
Join date : 2007-12-10
Age : 38

@PB, the benevolent programmer Empty
PostSubject: Re: @PB, the benevolent programmer   @PB, the benevolent programmer I_icon_minitimeFri Dec 19, 2008 8:25 pm

Bitch might be hot if she didn't have a slutty ass nose ring.
Back to top Go down
thereclaimer

thereclaimer


Posts : 181
Join date : 2007-12-14
Location : San Francisco, CA

@PB, the benevolent programmer Empty
PostSubject: Re: @PB, the benevolent programmer   @PB, the benevolent programmer I_icon_minitimeSat Dec 20, 2008 2:16 am

Comotosis wrote:
Bitch might be hot if she didn't have a slutty ass nose ring.

You're just jealous because she's more tauren than you.

Besides, metal in limited quantities is more hot than you can fathom.
Back to top Go down
Kamma

Kamma


Posts : 378
Join date : 2007-12-09

@PB, the benevolent programmer Empty
PostSubject: Re: @PB, the benevolent programmer   @PB, the benevolent programmer I_icon_minitimeSat Dec 20, 2008 11:42 am

Comotosis wrote:
Bitch might be hot if she didn't have a slutty ass nose ring.

Seconded
Back to top Go down
Peanutbutter

Peanutbutter


Posts : 176
Join date : 2008-10-07

@PB, the benevolent programmer Empty
PostSubject: Re: @PB, the benevolent programmer   @PB, the benevolent programmer I_icon_minitimeSun Dec 21, 2008 12:03 pm

I don't know your language but if it's like C/C++/C#, then that is the only tertiary operator in the language (eg it takes three operands). In truth, it's just a fancy if/else statement.

Basically you can read it like this:

if X ? then Y : else Z

You evaluate the statement before the question mark. It must be boolean (true or false result). Then, if it evaluates to true, you do the thing on the left side of the colon. If it's false, you do the thing on the right side.

So it just assigns to the Ballon.scaleY property either time divided by 2 or time multiplied by two, dependent upon if time is less than 2.

You can just rewrite it like this:

if (time < 2)
Ballon.scaleY = time / 2;
else
Ballon.scaleY = time * 2;

Don't let it scare you. I don't know the purpose for it other than to write an if/else statement in one compact line.
Back to top Go down
thereclaimer

thereclaimer


Posts : 181
Join date : 2007-12-14
Location : San Francisco, CA

@PB, the benevolent programmer Empty
PostSubject: Re: @PB, the benevolent programmer   @PB, the benevolent programmer I_icon_minitimeWed Dec 31, 2008 7:52 pm

So.... They break the readability of having bracketed statements that let me make these "pretty tab trees" to make an if-else statement in one line? They can die in a fire.... I never learned what an "?" might be in high school programming =/
Back to top Go down
Peanutbutter

Peanutbutter


Posts : 176
Join date : 2008-10-07

@PB, the benevolent programmer Empty
PostSubject: Re: @PB, the benevolent programmer   @PB, the benevolent programmer I_icon_minitimeFri Jan 02, 2009 11:32 pm

Well I suppose it may look like that for you, but it's actually a very concise way to write something that would normally take four to seven lines.

Most verbose
Code:
if (condition)
{
statement
}
else
{
statement
}
Least verbose
Code:
if (condition)
statement
else
statement
You probably should remember that the operator is used pretty much for conditional assignments because all extra code is extra typing for lazy programmers. Look at it this way.
Code:

if (time < 2)
Ballon.scaleY = time/2;
else
Balloon.scaleY = time*2;
Note how you had to write Ballon.scaleY twice. The ternary operator allows you instead to write it once and then just have the right side of the operator show you what the ultimate assignment will be.
Back to top Go down
thereclaimer

thereclaimer


Posts : 181
Join date : 2007-12-14
Location : San Francisco, CA

@PB, the benevolent programmer Empty
PostSubject: Re: @PB, the benevolent programmer   @PB, the benevolent programmer I_icon_minitimeSun Jan 04, 2009 4:07 am

I still like my tab trees =/
Aesthetics > shortness

Also, I lol'd when I found out "Expressions 2: Advanced expressions" is pretty much *gasp* BOOLEAN OPERATORS, IF STATEMENTS AND WHILE/FOR LOOPS!!!

I may be an art student but that's pretty down on the doesn't-need-brain-matter category. Even a huntard can do it.
Back to top Go down
Peanutbutter

Peanutbutter


Posts : 176
Join date : 2008-10-07

@PB, the benevolent programmer Empty
PostSubject: Re: @PB, the benevolent programmer   @PB, the benevolent programmer I_icon_minitimeTue Jan 06, 2009 1:41 am

Conditional statements and loops are pretty basic in terms of programming. Pointers are a lot harder concept (assuming you work in unmanaged code environments like most universities).

Really though, the complexity of programming is that

1) it's not very hard to make the computer take some input, mess with it, and give you some output
2) it IS very hard to do it in a manageable, maintainable, flexible, user-friendly way
Back to top Go down
Sponsored content





@PB, the benevolent programmer Empty
PostSubject: Re: @PB, the benevolent programmer   @PB, the benevolent programmer I_icon_minitime

Back to top Go down
 
@PB, the benevolent programmer
Back to top 
Page 1 of 1

Permissions in this forum:You cannot reply to topics in this forum
 :: Public Topics :: Off-Topic-
Jump to: