Asynchronous function in Cnds (conditions)

For developers using the Construct 2 Javascript SDK

Post » Thu Jan 10, 2013 5:51 pm

@Ashley
Gotcha! for the conditions :)
I have to work with expressions now - Thank you so much Ashley, without your help, the plugin won't never come !

Thanks again.
Passionate developer

If my work helped you to make your project, please consider making a donation :)
B
44
S
12
G
14
Posts: 631
Reputation: 10,987

Post » Thu Jan 10, 2013 10:31 pm

@Ashley
I begin to understand correctly this way of working, I want to thank for that. My expressions work perfectly now. There is something like a SDK bug though, let me know what do you think about it.

My expression checks (before returning something) if the file exists by checking some var. After that, either it returns the string, either it sends a log to the console.

It works perfectly, BUT, if the file doesn't exist, instead of doing nothing it returns the 'path' variable O_o ....

Here is my actual code:
[code]Exps.prototype.getFileContent = function (ret, path)
{
   if (this.triggeringFile == path && this.error_ret != 404)
        { ret.set_any(this.fileContent); }
   else
        { cr.logexport ("The file may not exist."); return false; };
};[/code]
     
Passionate developer

If my work helped you to make your project, please consider making a donation :)
B
44
S
12
G
14
Posts: 631
Reputation: 10,987

Post » Fri Jan 11, 2013 1:00 am

@septeven - your code is wrong. "return false" makes no sense in an expression - you must *always* return a value through 'ret'. In that case you should say ret.set_int(0) or some other value otherwise you'll leave undefined data in the return value.
Scirra Founder
B
386
S
229
G
87
Posts: 24,201
Reputation: 191,540

Post » Fri Jan 11, 2013 1:32 am

@Ashley, it works perfectly now :)
Passionate developer

If my work helped you to make your project, please consider making a donation :)
B
44
S
12
G
14
Posts: 631
Reputation: 10,987

Post » Fri Jan 11, 2013 7:54 pm

@Ashley
Here is the dropbox plugin, thanks for your help !
Passionate developer

If my work helped you to make your project, please consider making a donation :)
B
44
S
12
G
14
Posts: 631
Reputation: 10,987

Previous

Return to Javascript SDK

Who is online

Users browsing this forum: No registered users and 0 guests