The Daily Click ::. Forums ::. General Chat ::. Would anyone use...
 

Post Reply  Post Oekaki 
 

Posted By Message

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
20th September, 2007 at 08:59:48 -

I'm pondering building a small app to help with creating complex MMF expressions, and wondered if anyone would find it useful.

The main feature is gonna be handling internal variables. So as an example, we want to estimate the length of a quadratic curve by finding the distance between all 3 points. Except that we want to alter the position of the middle point to give a more conservative estimate. So we create a new numeric expression and call it 'QuadLen', then we write:

//Rough length of quadratic curve
//Using the control point, plot the zenith of the curve.

x("START") + (x("CONTROL") - x("START")) * 0.5 = ZenithX;
y("START") + (y("CONTROL") - y("START")) * 0.5 = ZenithY;

//Distance between Start point and Zenith
sqr((x("START") - ZenithX) pow 2 + (y("START") - ZenithY) pow 2) = Start_to_Zen;

//Distance between Zenith and End point
sqr((ZenithX - x("END")) pow 2 + (ZenithY - y("END")) pow 2) = Zen_to_End;

//Final Formula
Start_to_Zen + Zen_to_End



It uses all the variables you defined above and blends them into one final, enormous MMF expression:

(sqr((x("START") - (x("START") + (x("CONTROL") - x("START")) * 0.5)) pow 2 + (y("START") - (y("START") + (y("CONTROL") - y("START")) * 0.5)) pow 2)) + (sqr(((x("START") + (x("CONTROL") - x("START")) * 0.5) - x("END")) pow 2 + ((y("START") + (y("CONTROL") - y("START")) * 0.5) - y("END")) pow 2))

Then just before it finishes, it tags it with an id so it becomes:

val("QuadLen")-
(sqr((x("START") - (x("START") + (x("CONTROL") - x("START")) * 0.5)) pow 2 + (y("START") - (y("START") + (y("CONTROL") - y("START")) * 0.5)) pow 2)) + (sqr(((x("START") + (x("CONTROL") - x("START")) * 0.5) - x("END")) pow 2 + ((y("START") + (y("CONTROL") - y("START")) * 0.5) - y("END")) pow 2))

That results in a formula that MMF can read. But because the app saved the word 'QuadLen' at the start, we can copy this expression (or the first part of it) back into the application. It will recognise the word 'QuadLen' and bring up the original expression from its own records (complete with any formatting, comments, etc that we used).

Dunno about additional features, but you'll obviously be able to write comments, etc.

Image Edited by the Author.

 
191 / 9999 * 7 + 191 * 7

-Liam-

Cake Addict

Registered
  06/12/2008
Points
  556

Wii OwnerIt's-a me, Mario!Hero of TimeStrawberry
20th September, 2007 at 09:11:27 -

Wow, what the hell does all this mean?

 
Image

Tell 'em Babs is 'ere...

Joe.H

Evil Faker

Registered
  19/08/2002
Points
  3305
20th September, 2007 at 09:14:57 -

He's finding the rough length of a quadratic curve by finding the distance between the start point and the approximate middle, and the approximate middle to the end point.

 
My signature is never too big!!!

LIJI

Flava's Smarter Twin

Registered
  29/08/2006
Points
  2032

I like penguins
20th September, 2007 at 09:19:47 -

Do it and I will love you forever.

 
Service Unavailable

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
20th September, 2007 at 09:24:37 -

LOL!

It just lets you format your expressions so they're easier to read, and can have comments. It's only any use if you use complex or long expressions.

It also lets you keep complicated bits of your formula out of the equation.

For instance, your formula may be something quite brief like:
XPos of Planet + sin( Angle ) * Distance

But if you also have a really complex code just for setting the angle, then your simple formula's gonna look like:

XPos of Planet + sin( AngleBLAH BLAH BLAH BLAH BLAH YADA YADA BLAH BLAH NON BLAH SENSICAL BLAH WEIRD BLAH DOOBLE LARR HORRID LONG EQUATION BLAH ) * Distance

Using this, you can do something like this:

//My horrid angle equation:
BLAH BLAH BLAH HORRID EQUATION BLAH = Angle;

//The rest:
XPos of Planet + sin( Angle ) * Distance


See what I mean? It cuts a complex expression into lots of little ones, when you can't use an Alterable Value to abbreviate an expression.

 
191 / 9999 * 7 + 191 * 7

DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
20th September, 2007 at 09:52:12 -

I'd use it.
Though doesn't it make more sense to say Angle = LOL EXPRESSION rather than LOL EXPRESSION = Angle?

I take it this is going to be some sort of variable extension?

Image Edited by the Author.

 
Old member (~2004-2007).

DeadmanDines

Best Article Writer

Registered
  27/04/2006
Points
  4758
20th September, 2007 at 10:27:53 -

There was a reason why I went with Expression = Variable, but I can't remember what it was now, lol.

It's not an extension, just an app to run alongside MMF. Ideally, if enough people use it, CT will realise how much they need to include variables, comments and whitespace formatting in their own expression editor.

 
191 / 9999 * 7 + 191 * 7

Cazra

Crazy?

Registered
  24/07/2002
Points
  4472

Game of the Week WinnerVIP Member
22nd September, 2007 at 08:17:46 -

the solution: program in a scripting language.

MMF is great for most things, but when it comes to functions, it's not quite as useful even with fastloops.

 
n/a

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
22nd September, 2007 at 10:24:10 -

Del Duio reads the post..

YOU have failed to understand it!
YOUR math skills have decreased!! (14)
YOU should have paid more attention in school!

---

Ow my head, Dines. I'm glad we have people like you on our side!

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Tim

I'm on here way too much

Registered
  25/08/2006
Points
  132

You've Been Circy'd!Clickzine StaffSilverNova MemberVIP MemberTurtle Power!Evil klikerWii OwnerHero of TimeGhostbuster!Pokemon Ball!
22nd September, 2007 at 11:18:09 -


Originally Posted by Del Duio
Ow my head, Dines. I'm glad we have people like you on our side!



Yeah, thank goodness he's not supporting that whole 'constuct' thang

 
http://www.SilverNova.co.uk


DaVince

This fool just HAD to have a custom rating

Registered
  04/09/2004
Points
  7998

Game of the Week WinnerClickzine StaffHas Donated, Thank You!Cardboard BoxDos Rules!
24th September, 2007 at 06:13:07 -

I like how Clickteam became really active when competition started coming.

Image Edited by the Author.

 
Old member (~2004-2007).

Sketchy

Cornwall UK

Registered
  06/11/2004
Points
  1970

VIP MemberWeekly Picture Me This Round 43 Winner!Weekly Picture Me This Round 47 WinnerPicture Me This Round 49 Winner!
24th September, 2007 at 08:03:22 -

It's a good idea - I always try and use the fewest possible events/actions, but I'm not sure how well it would work. The problem is, I'm pretty sure there's a limit on the length of an expression, before it says "too complicated to understand" or something like that.

Also, in my experience (again, possibly just because I have a very old computer) very long expressions and esp. those with fastloops, can tend to go wrong quite often, even if they're written properly. I've had one event with a big long expression that just didn't work, yet when I split it into 2 it worked fine (just cutting/pasting - not changing anything).

 
n/a
   

Post Reply



 



Advertisement

Worth A Click