The Function Object....how DO you use it?

This forum is currently in read-only mode.
From the Asset Store
This is a single chapter from the "Construct Starter Kit Collection". It is the Student Workbook for its Workshop.
  • So I was inside of Construct tinkering around with a special project, when I came across the Function Object. I actually couldn't figure it out but I am assuming it is what I need to create what I want to create...

    For starters, I wanted to try my hand at doing something similar to

    messagebox(integer xpos, integer ypos, string message)
    {
             doStuff();
    }[/code:z417kdrq]
    
    But when I tried, I actually crashed the text EXE. I guess Function.Messagebox(x,y,"message") does not work. ;O)
    
    So I ask you guys, how is it used and how do you use it? What would be the equivelient of what I posted above in pseudocode? (The Wiki is down and plus, it wasn't clear on it last I checked it. But it did mention similar things as to how a normal function works last I recall!).
  • this is a very simple example of how to use a function

    http://dl.dropbox.com/u/1013446/functions.cap

    once that makes sense. here's another way to use functions, in an expression:

    http://dl.dropbox.com/u/1013446/functions2.cap

    notice you can also set a return value.

    I assumed you had enough programming knowledge that these examples make some sense without more of an explanation, but please ask questions if you have them. Also, you'll notice when you call functions from an action, it lets you choose to 'remember' or 'forget' picking. It does exactly that. It maintains the selected object list, or starts from scratch in the function, depending on your needs.

  • Odd, when I try to open them in Construct I get an "Out of Memory" error.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • here ya go, right click - view image if it doesn't fit in your browser normally:

    first one:

    <img src="http://dl.dropbox.com/u/1013446/functions.png">

    second one:

    <img src="http://dl.dropbox.com/u/1013446/functions2.png">

  • Oh wow. Very different than I imagined. I'm very grateful for you telling me (and posting the screenshots)

    So you're literally having to specify the parameters first (as Function.Param(number), and then adding the values later. I get it now.

    And then, AFTER telling specifing the parameters you can then use On Function.myFunction(parameter1,parameter2), so for the MessageBox...

    Messagebox.Param(1), MessageBox.Param(2), MessageBox.Param(3)

    Add parameter xpos

    Add parameter ypos

    Add parameter message

    Call function (And at this point on it works like a normal function)

    Again, thank you so much.

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