0 Favourites

Why does this return 0.1? - Parse.com plugin

  • Hello

    I'm developing a Parse.com plugin for C2, and I get this annoying error.

    When I set the value to a variable in C2 using an expressesion, it gets turned into 0.1 for any integer or float.

    When I log to the console directly from runtime, it returns the correct result. When I do it using C2, it returns 0.1 in the console log.

    This is my code in runtime:

    Exps.prototype.QueryHighest = function (ret,par0,par1,par2)
    	var Object = Parse.Object.extend(par0);
    	var query = new Parse.Query(Object);
    	// Retrieve the values descending
    		success: function(result) {
    			var Return = result.get(par2);
    			}else if(!isNaN(Return)){
    		error: function(error) {
    			alert("Error: " + error.code + " " + error.message);
    And for the edittime:
    [code:re1csazq]AddStringParam("class","Which class does the object lie in?");
    AddStringParam("search attribute","The attribute whose value you want to search for.");
    AddStringParam("attribute","The attribute whose value you want to get.");
    AddExpression(0, ef_return_any, "Parse query: highest result", "Search Query", "QueryHighest", "Returns the highest value from a specified attribute.");
    And in C2:
  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • Values must be returned synchronously from expressions. If query.first() is asynchronous, then you return a value after the expression has already returned, which is not allowed. It is really a bad idea to use anything asynchronous in an expression anyway, it doesn't fit the model of how Construct 2 works. Instead you should have an action to start the asynchronous task, a trigger that fires when it completes, and then synchronous expressions that return the results of the task.

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