0

I'm trying to change the score from Patch editor, but when I use the Patches.Get(data)value, always get an error.

[Spark AR editor] (http://prntscr.com/p9b77g)

Still getting this error

JavaScript error: Exception in native code while calling a function: Trying to get signal to Script with name (text). Please make sure to define a ToScript patch with that name in the patch editor

My code script.js opened using Visual studio code.

// Load in the patches module
const Patches = require('Patches');

// Get the 'myText' string from the Patch Editor
const myString = Patches.getStringValue('text');

It should be fine since I've tried the exact name, but I'm still getting that error.

Soroush Chehresa
  • 5,490
  • 1
  • 14
  • 29
Fahmi
  • 1
  • 1

2 Answers2

0

Please make sure to define a ToScript patch with that name in the patch editor

This makes it seem like you don't have a patch called 'text'. For this to work you'll need to select your script in assets, in the 'To Script'-section click the plus icon, select text, rename that from 'EditorToScriptVar(x)' to 'text' and then click the arrow to add it to your patch editor.

Wilrick B
  • 135
  • 8
0

I ran into a similar problem once I added more definitions added. Even though the ToScript patch was already defined, the script failed to find it.

To solve this, I delete the producer patch and created a new one. The error should go away and the simulator should resume. Connect your wires and it should continue to work.

I will be following this thread for a few days.