Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
DONT mix JS with CopperCube true/false

Robo
Guest
Quote
2022-05-11 09:59:55

When setting a CopperCube variable as either true or false in a javascript environment and then reading this back in a javascript environment the values can no longer be tested as either true or false.
I found its because its now been changed to a string instead of a boolean.

so DONT mix the two together or better still dont use true/false at all but just use 1 and 0 instead.


run this and see for yourself:

ccbSetCopperCubeVariable("carryItem",false);
var test = ccbGetCopperCubeVariable("carryItem");
if (test == false) {print("same");}
else {print("not same");}


just_in_case
Moderator
Quote
2022-05-11 14:32:04

well yeah, that happens only with the coppercube variables, CC variables don't take booleans directly, they take them as strings.

with other function like Set and Get property, you can use it like any normal True and False value.

when using CopperCube variables it is always good practice to use string values, even if you are using numeric values like 0 and 1 or whatever so that you won't get mixed result.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internat?onal" (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