HomePortalFAQSearchRegisterMemberlistUsergroupsLog in

Share | 
 

 @PB, the benevolent programmer

View previous topic View next topic Go down 
AuthorMessage
thereclaimer

avatar

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

PostSubject: @PB, the benevolent programmer   Fri 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:



WTFITS?!?!

In exchange for answer, here's a girl I'd cheat on Hermione with.
Back to top Go down
View user profile
Galt

avatar

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

PostSubject: Re: @PB, the benevolent programmer   Fri 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
View user profile http://www.fuckyermother.com
Comotosis

avatar

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

PostSubject: Re: @PB, the benevolent programmer   Fri 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
View user profile
thereclaimer

avatar

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

PostSubject: Re: @PB, the benevolent programmer   Sat 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
View user profile
Kamma

avatar

Posts : 378
Join date : 2007-12-09

PostSubject: Re: @PB, the benevolent programmer   Sat 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
View user profile
Peanutbutter

avatar

Posts : 176
Join date : 2008-10-07

PostSubject: Re: @PB, the benevolent programmer   Sun 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
View user profile
thereclaimer

avatar

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

PostSubject: Re: @PB, the benevolent programmer   Wed 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
View user profile
Peanutbutter

avatar

Posts : 176
Join date : 2008-10-07

PostSubject: Re: @PB, the benevolent programmer   Fri 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
View user profile
thereclaimer

avatar

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

PostSubject: Re: @PB, the benevolent programmer   Sun 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
View user profile
Peanutbutter

avatar

Posts : 176
Join date : 2008-10-07

PostSubject: Re: @PB, the benevolent programmer   Tue 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
View user profile
Sponsored content




PostSubject: Re: @PB, the benevolent programmer   

Back to top Go down
 
@PB, the benevolent programmer
View previous topic View next topic Back to top 
Page 1 of 1
 Similar topics
-
» DIY EEPROM Programmer Kit (Serial Version) by Seph & Pete ng Elab
» If someone could help me with this game issue? programmer prob
» uninty3d programmer challeng
» ChessBase Endorse Fritz 15 Banned Chess Programmer + Komodo 9
» Chess programmer wanted

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