Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
This code works for Windows target but not Android??

ishmaru
Registered User
Quote
2019-01-19 05:46:17

So I was writing a simple behavior that will perform one of several specified actions randomly based if the values of 2 Coppercube variables are high enough.

Code works Perfectly fine in windows, it does not in Android. Any ideas why?


Link to my js file:
https://drive.google.com/file/d/...


ishmaru
Registered User
Quote
2019-01-19 05:48:14




just_in_case
Moderator
Quote
2019-01-19 07:25:36

Don't you get errors like IfResource5A and ActionSet5A and B is not defined.....??


ishmaru
Registered User
Quote
2019-01-19 14:57:14

It was a longer code block than this that's all the same from IfResource5A all the way to IfResource1A. When I cut out the repeating code (i couldn't fit it into the post) i left IfResource5A code not IfResource1A code. I updated the post.

to eliminate confusion here is the JS file:
https://drive.google.com/file/d/...


just_in_case
Moderator
Quote
2019-01-21 04:07:08

Are you saving and loading coppercube variables, i can't remember correctly if we can load and save variables on android.

Var ResA = ccbGetCoppercubeVariable(this.resourceA)

Am assuming that u are using save and load variable for this.

I didn't checked the code in coppercube, am just answering by reading it.

Currenlty i am on a place on earth where i can't reach out to a computer.

I just have my mobile device and i can't do much help.

In march i will return to my hometown and then only am able to get my hands back on this engine.

These relatives here are really a headache.


xanimalkingx
Registered User
Quote
2019-01-22 19:19:26

wrote:
It was a longer code block than this that's all the same from IfResource5A all the way to IfResource1A. When I cut out the repeating code (i couldn't fit it into the post) i left IfResource5A code not IfResource1A code. I updated the post.

to eliminate confusion here is the JS file:
https://drive.google.com/file/d/...

Have you tried to set a global variable outside your main behavior function then save variables to them rather than coppercube variables? Global variables can hold more than numbers and strings compared to cooppercube variables.
Example:

var global1 = "";
var global2 = 0;
var global3 = [1, 2, 3, 4];
function behavior_doTest() {}

behavior_doTest.prototype.onAnimate(node, timeMs) {
global1 = "hello!";
global2 = global3[0];
}



ishmaru
Registered User
Quote
2019-01-26 16:31:23

thanks for the responses.

I used the coppercube variables as i need to access those values from multiple scripts aside from this one.

Like I said the script works just fine in all but Android target, and it sems like the issue is having several switch cases or if/elseif statements with ccbInvoke Action() method.

This isn't the first time i've had this issue with a script and the common factor was this.


hihisisy
Registered User
Quote
2019-04-04 18:55:07

wrote:
thanks for the responses.

I used the coppercube variables as i need to access those values from multiple scripts aside from this one.

Like I said the script works just fine in all but Android target, and it sems like the issue is having several switch cases or if/elseif statements with ccbInvoke Action() method.

This isn't the first time i've had this issue with a script and the common factor was this.

It was a longer code block than this that's all the same from IfResource5A all the way to IfResource1A. When I cut out the repeating code (i couldn't fit it into the post) i left IfResource5A code not IfResource1A code. I updated the post.


carlosm
Registered User
Quote
2019-12-08 03:54:09

The solution is to use ccb behaviors.
see i made a switch case ... in javascript and it worked fine in windows.
But on android no.

I have to convert the conditions code to the behavior in the editor.

using the behavior "if your variable has a value do it" .... and others is like coding visually.

I hope you understand.

about android read data and sqlva have not tried yet hope it is possible because I am making a game for android with ccb.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Inter?ational" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact