Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Programming and Scripting
write numbers to variable.

54newstar
Registered User
Quote
2016-05-01 14:56:19

Okay I had a question from a viewer on my YT channel, about locks for doors. I have made a few but this is what he wanted. A number lock, and while I do have a way to do this, I thought (like in Construct 2) we could have a write to variable.

If click on set >if variable has a value do something> action> write number to variable ( if you click on button (1) then it will write a 1 in the variable.

Then if you click on the number (2) button then it will write a 2 next to the one.

if variable X is + to viable y then do something.

🔎︎



jaimezegpi
Registered User
Quote
2016-05-02 04:05:35

i think you can do using javascipt

I.- Number to string

var number = 10;
var string_var = number.toString();

II.- String to a int or float (number)

var number = "10";
var int_var = parseInt(number);
var float_var = parseFloat(number);

In Ccb only for experiment.

var value = parseInt( ccbGetCopperCubeVariable('my_Ccb_var') );

if ( value > 10 ){
var action = This.Space_Is_For_Niko;
ccbInvokeAction(action);
ccbSetCopperCubeVariable('my_Ccb_var',0)
}


Create reply:


Posted by: (you are not logged in)


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