Adding expression function to array plugin

0 favourites
  • 1 posts
From the Asset Store
Kids Game
$49 USD
New Sounds Added Update: 115 new sound effects added for no additional cost!
  • I have attempted to add a new expression function to the Array "plugin", but having a hard time making Construct understand that the expression is taking one parameter.

    I've added the following code to runtime.js:

         Exps.prototype.rank = function (ret, playerNumber)

         {

              var ranking = 1;

                //Do whatever...

              ret.set_int(ranking);

         }

    And added the following to edittime.js:

    AddExpression(13, ef_return_number, "Get rank for player", "Array", "rank", "Get rank for a player");

    The expression shows up in Construct as expected (i.e. I can enter SomeArray. and the "rank" expression will show up in the dropdown menu). Though, if i enter SomeArray.rank(1), it says 'rank' does not take 1 parameter (should have 0).

    What am I doing wrong? How do I properly make the expression take a parameter?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)