Jump to content


GM 8.1 "tiny" feature request...

  • This topic is locked This topic is locked
185 replies to this topic

#181 Gamer3D


    Human* me = this;

  • GMC Member
  • 1819 posts
  • Version:GM:Studio

Posted 20 March 2011 - 07:23 AM

What about overloading of extension functions?

Currently, when defining an extension function, we must define:
  • NAME
I would like to be able to define two functions with the same NAME, but with different EXTERNAL_NAMEs and either different ARGUMENT_COUNTs or ARGUMENT_TYPEs. Current result(yes, I tested it): one function (always the same) gets called whether string or real is put in.

Why this would be useful:
As an example, DLLs for data structures. If the user wants to call add("blah") and add(1), then with the current system, the original programmer must have written this script for add:
if (is_real(argument0))
    return add_real(argument0);
    return add_string(argument0);
This adds significant overhead when the DLL itself is fast. Also, the complexity of the script required increases to 2^n when n are variables able to be either string OR real. With overloading, the entire burden would be shifted onto significantly faster compiled code, and would not require the script.

Potential benefits: Massive in some cases, none in others. Potential problems: Not backwards-compatible with GM7.
I also considered requesting this for DLLs, but because those are done with what is effectively a function pointer, it would be impossible.

Edited by Gamer3D, 20 March 2011 - 07:24 AM.

  • 0

#182 Rani_sputnik


    GMC Member

  • GMC Member
  • 434 posts
  • Version:GM:Studio

Posted 20 March 2011 - 08:13 AM

EDIT: And if I may be so bold as to bring my feature request up to 15 minutes, point_distance_3d(x1, y1, z1, x2, y2, z2) and point_distance_squared_3d(x1, y1, z1, x2, y2, z2) would also be nice!

Agree! but I think that would end in a whirlpool situation like Mike discussed earlier, there are so many 3d math functions that would just be awesome to have added!
@ Mike, if 3d math is branching into a pool of math that's far to big, could you add a dot(x1,y1,x2,y2) I know it wouldn't be used very often so are probably low priority but I use it :) it's useful for 2d verlet physics and fake 3d engines. I use both every now and then and I don't imagine it'd be too hard. I can understand if you don't though, they are seldom used for most people I guess *shrug*

EDIT: Oh I am a fool, if point_distance_squared was implimented you could do 2d dot products *face palm* nevermind

Edited by Rani_sputnik, 20 March 2011 - 08:37 AM.

  • 0

#183 sabriath



  • GMC Member
  • 3189 posts

Posted 20 March 2011 - 08:53 AM

#define taking too long to add? Joke?

Would you like me to add it for you?

Yes, it is more than a 10 minute fix...only 1 person on these forums can boast about their programming abilities, and that's me, and there's no way I am that fast. You require the following BNF/EBNF addition:

<preproc> := "#define" <ws>+ <ident> ['(' <ws>* <ident> [',' <ws>* <ident>]* ')' <ws>*] <notlf>* <lf>
<stmt> := <preproc>

Even if 'ws' and 'ident' parsing functionality is complete, that still leaves all the other things to parse, gen, verify, and test. Not to mention that anything that is done for the compiler, must also be done for the runner's runtime compilation part as well (including testing).
  • 0

#184 TheSnidr


    Heavy metal viking dentist

  • Global Moderators
  • 3117 posts
  • Version:GM:Studio

Posted 20 March 2011 - 08:54 AM

There's a script called angle_difference. Wouldn't it be great if this was a function?
  • 3

#185 Manuel777



  • GMC Member
  • 3552 posts
  • Version:GM:Studio

Posted 20 March 2011 - 09:02 AM

There's a script called angle_difference. Wouldn't it be great if this was a function?

A few pages before Mike said it was too complex to add new functions and test them (so, hopepefully this suggestions will be added to GM9)

Speaking of functions, is it too complex to expand the max number of arguments?

PS: why in hell GML is limited in the number of arguments?? :mellow:
  • 0

#186 Mike.Dailly


    Evil YoYo Games Employee

  • Administrators
  • 4380 posts
  • Version:GM:Studio

Posted 20 March 2011 - 10:13 AM

Okay... I'm gonna close this down. The suggestions are getting downright silly.

As "a last hurrah", I've added..

dot_product(x1,y1, x2,y2)
dot_product_3d(x1,y1,z1, x2,y2,z2)
point_distance_3d(x1,y1,z1, x2,y2,z2)

..mainly because I couldn't sleep and was feeling generous, but also because I can see these taking a long time in GML. The dot products will also normalise the vectors.

You can also now specify the default TAB that will show on the object form. This allows the script tab to be the one that pops up, meaning it's one less click for you.

So that's it... I think I still have a couple of previous suggestions to review, but that'll be them all for now. I hope when 8.1 comes out, you'll all be please at what we've managed to get in, particularly in the areas you've been suggesting.

Cheers folks.
  • 10

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users