[Feature Request] Functions List

  • Ashley I believe they are asking for a dropdown that lists all the functions that have been created in the project, similar to the other thread about having dropdown lists or combo boxes for animations, etc... basically anything that we have to type currently that we may have already defined by assigning a name to it (functions, animations, etc...) Either dropdown boxes or where it makes sense combo boxes for those that need to allow manual input still.

  • I have to agree with WhiteClaws in regards to the volatility of Functions. In relation when a variable is created; C2 makes it impossible to type in the var expression wrong.

    eg

    variable number called count

    in a typed expression: cout becomes wrong and the expression will fail as C2 checks to see if a variable cout exists. So C2 informs us when cout is invalid and won't close the window until corrected.

    eg

    variable text CONST GLOBAL GAMEMODE

    On Event > Compare variable... I have a drop down menu of variables

    So WhiteClaws and I would like the same type safe feature that variables get, but for On Function calls.

    Action> Call Function > Dropdown list of any Function that is registered with OnFunction() Event

    Typed Expression: Function.Call("[function foo]")

    where foo becomes typed safe similar to a variable(unless of course stored in a Text)

    OnFunction: change other references

    Similar to variables, when the OnFunction Event function name is changed. C2 can proceed to correct any other references to the function call string.

    The only exception to the this typesafe function system would be this kind of situation

    Object.TextFoo = FunctionName

    exception

    Function.Call(Object.TextFoo)

    this is the only case where C2 type safe would not apply. As the Function stored as a String is not accessible for type safe.

  • Or even a little message that would get incorporated when the text that got written is not registered as a call ... ( Excluding stuff that got written without the "" )

  • The way it is now is no different than comparing a string under system compare. Imagine having made the mistake of testing some text with capitols in it. That kind of mistake happens all the time.

    I can bet you'll not make the same error soon however.

  • The way it is now is no different than comparing a string under system compare. Imagine having made the mistake of testing some text with capitols in it. That kind of mistake happens all the time.

    I can bet you'll not make the same error soon however.

    Within C2, which is what we are talking about. Not actually text based code editing. C2 has numerous typesafe guards to reduce syntax errors. Which is the great strength of VPL based tools.

    In your example your making a comparison of

    "string" == "string"

    But that's not the case in C2. When comparing variables as a condition. The variable is drop down. Even if the variable is a string.

    Event Compare [Variable] = "string"

    In this case, 1 side the comparing variable side is typesafe. There is no way to make an error using the wrong variable. C2 never let's the developer use the wrong variable.

    Not only that. in C2 if you do

    Event Compare 2 values

    var1 = var2

    or

    Action > set var [ var1 > var2 ? var1 : var2 ]

    both vars must be spelled correctly for C2 to validate. Even in the typed expresion of embedding a logic code C2 requires that the name of the variables be valid before the action box can be closed.

    We know that syntactically that Function calls are just straight string compares, but thats the same for variables. So why not typesafe Function strings.

    Programming requires 3 primary components

    variables

    code flow(if, else, while, for, case...)

    routines(Functions, Methods, GoSub)

    Variables and Codeflow are type safe in C2. So why not typesafe the Functions?

    to achieve the goal of typesafing Functions. The Function Plugin would require a shared list. The list would be composed from the Event OnFunction. That way C2 can check string for validity when the expression Function.Call("check this string") is used in an action.

    It's totally doable and within C2 syntax safety makes a lot of sense :)

  • In the mean time. You can still get around by doing another method to get type safe. Use instance variables

    This would be set up in the setting of the object.

    Object with name of [foo]

    foo.DoDamage = "DoDamage"

    foo.TakeDamage= "TakeDamage"

    On FunctionCall (foo.DoDamage)

    On FunctionCall (foo.TakeDamage)

    Condition whatever

    --Action > Function.Call (foo.DoDamage)

    under this model. You are using variables which are typesafe. these variable store the string for the function calls. So if you do change the variable name or function string name. The changes are global to the event sheets.

  • I'm going to have to disagree with most of this.

    Whilst I know exactly what it feels like to spend hours debugging only to realise that it's a stupid tiny little mistake that I made, the thing is, it can happen anywhere. For example, realising that an object is behaving strangely but turns out it was on an incorrect layer that had parallax scrolling. Once you have fixed the mistake though, you would probably remember in future to check the layering right away if another glitch were to occur.

    I believe the concept I'm trying to get across links with the problem you have, Whiteclaws, with the function being typed incorrectly; since you spent a hellish long time trying to figure out the problem and eventually did, you will most likely look through and verify function names if you realise code is not working correctly from now on.

    Anyway, in my humble opinion on the suggestion itself, I'd find a separate "Dropdown list" for functions personally not very useful, and having an error message occur when typing would cripple the Function tool. What if, like Ashley said, you wanted to call a function that had't just been evented yet- you'd get an error and that would be counterproductive. Unless the error message is just a little notification that pops up then fades away, then I can see a little bit of potential in that idea. One problem I once had was I accidently made a new function that already existed and had no idea of telling how until my brain decided to clock on and remind me lol. (That taught me to note down my functions on a commentbox that I have in my capx to prevent future issues). Not to mention how would the Function dialog work if a user typed in variable stuff like ["Load_" & Player.Something]- since there's no definitive "Function" right there unless the game is running, how would the interface know to show an error message or not?

    I have no idea why I wrote so much about this but yeah! <img src="smileys/smiley33.gif" border="0" align="middle" />

  • Jase00 , yeah , that's what I'm asking for , a little pop-up message that pops when the function is incorrect and dissapears quickly ... That's not too much isn't it ?

  • This all seems like an unnecessary workaround to just checking the console tab. As Ashley said, if there is an error in your function name, it will show up there. I have 40+ functions in my tiny project and a massive dropdown isn't going to make things easier to manage.

    Now renaming functions and having them automatically update any related function calls, that I could get behind...

  • This all seems like an unnecessary workaround to just checking the console tab. As Ashley said, if there is an error in your function name, it will show up there. I have 40+ functions in my tiny project and a massive dropdown isn't going to make things easier to manage.

    Now renaming functions and having them automatically update any related function calls, that I could get behind...

    Indeed. Like the replacement system.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • None of the ideas will work well unless it is tracking the Function names anyways. Also with the replace method, then it becomes more type safe.

    I agree that you won't be able to use a Function until it's created in the OnFunctionCall, but right now I can't use a variable until it's declared first. So I don't see difference.

    I will agree that a dropdown list could get very large. I lost cout of the number of funtions I have :D sooooo maybe a drop down would be less effective :D. Then again if you can have more than one function plugin installed, with each being renamed to a theme of use.

    Anyways. I'm backing up the idea that assistance with handling Function naming would be a nice benefit. in the mean time I'm going to work with the object.varfunction = name model :)

    I have spoken my piece :) thanks for listening :)

  • I agree that you won't be able to use a Function until it's created in the OnFunctionCall, but right now I can't use a variable until it's declared first. So I don't see difference.

    You stated a very good point, man. <img src="smileys/smiley16.gif" border="0" align="middle" />

    I remember Construct Classic was able to declare variables whilst using the "Set Value" action. I wish this would be brought back.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)