-
-
Save lassemt/7b6833cfa2dc0bb0e643c52cb7d6b5a2 to your computer and use it in GitHub Desktop.
| const Scene = require('Scene'); | |
| // | |
| // Old way | |
| // | |
| const obj = Scene.root.find('2dText0'); | |
| // Do stuff to the object in global scope | |
| // | |
| // New way | |
| // | |
| Scene.root.findFirst('2dText0').then(obj => { | |
| // Object is ready | |
| // you can update the object signals etc here. | |
| }); |
| const D = require('Diagnostics'); | |
| const Patches = require('Patches'); | |
| // | |
| // RECVIEVING SIGNALS FROM PATCHES | |
| // | |
| // | |
| // Old way | |
| // | |
| const onTap = Patches.getPulseValue('tap'); | |
| onTap.subscribe(evt => { | |
| D.log('tap') | |
| }); | |
| // | |
| // New way | |
| // | |
| Patches.outputs.getPulse('tap').then(signal => { | |
| signal.subscribe(evt => { | |
| D.log('tap'); | |
| }); | |
| }); | |
| // | |
| // SENDING SIGNALS TO PATCHES | |
| // | |
| // | |
| // Old way | |
| // | |
| Patches.setStringValue('timeNow', new Date().toString()); | |
| // | |
| // New way | |
| // | |
| // Note how the new method returns a promise. Not sure what | |
| // it can be used for though, | |
| Patches.inputs.setString('timeNow', new Date().toString()).then(() => { | |
| D.log('Signal is set?'); | |
| }); | |
| // So this could be enough for this | |
| Patches.inputs.setString('timeNow', new Date().toString()); |
please help me .. i have problem with my score script ..
score dont wanna show up ???? : (
( This API is deprecated, please upgrade to the newest SDK version. Message: Please use
findFirstorfindAllinstead
@ )
i use this scriptconst number = Scene.root.find("number");
var score = Patches.getScalarValue("score");
number.text = score.toString();how to cange to new SDK ..
thank u sir
// Put everything that needs to be loaded
// into 1 promise.
Promise.all([
Scene.root.findFirst('directionalLight01'),
Scene.root.findFirst('number'),
Patches.outputs.getScalar('score'),
]).then( (loadedItems) => {
// When everything is loaded
// this function will trigger
// Note how the loacded items are stored in the
// loadedItems and in the orderd the was added
// to the array above. Arrays always starts on 0;
const directionalLight = loadedItems[0];
// Get the loaded items from Scene.root.findFirst('number');
const counterNumber = loadedItems[1];
// And the last added to the list
const scoreNumber = loadedItems[2];
// Do your thing as normal
counterNumber.text = scoreNumber.toString();
});
thank u so much bro
i wanna ask more about increase speed with script when score more than 10 .. help me bro
please help me .. i have problem with my score script ..
score dont wanna show up ???? : (
( This API is deprecated, please upgrade to the newest SDK version. Message: Please use
findFirstorfindAllinstead
@ )
i use this scriptconst number = Scene.root.find("number");
var score = Patches.getScalarValue("score");
number.text = score.toString();how to cange to new SDK ..
thank u sir
This worked for me!
const Scene = require('Scene');
const Patches = require('Patches');
Scene.root.findFirst('BlinkCountText').then(BlinkCountText => {
Patches.outputs.getScalar('BlinkCountValue').then(BlinkCountValue => {
BlinkCountText.text = BlinkCountValue.toString();
});
});
Scene.root.findFirst('TimerCountText').then(TimerCountText => {
Patches.outputs.getScalar('TimerCountValue').then(TimerCountValue => {
TimerCountText.text = "10";
TimerCountText.text = TimerCountValue.toString();
});
});
Hi,How can I update the new code of my filter?
Now I've solved it with a tap but I'd like to change the text for each picker again.
I had linked a different dynamic text for each picker of the native ui with code old.
I have problems with canvas and rectangles.
Do you have any feedback?
please help me .. i have problem with my score script ..
score dont wanna show up ???? : (
( This API is deprecated, please upgrade to the newest SDK version. Message: Please use
findFirstorfindAllinstead@ )
i use this script
const number = Scene.root.find("number");
var score = Patches.getScalarValue("score");
number.text = score.toString();
how to cange to new SDK ..
thank u sir