#TypeError (Apparently)
1 messages · Page 1 of 1 (latest)
There are errors in this [code](#1073676701999059024 message):
[36m<repl>.js[0m:[33m18[0m:[33m14[0m - [31merror[0m[30m TS2304: [0mCannot find name 'random'.
[7m18[0m if(random > 0.08) caveArray[x][y][z] = "stone"
[7m [0m [31m ~~~~~~[0m
[36m<repl>.js[0m:[33m29[0m:[33m25[0m - [31merror[0m[30m TS2304: [0mCannot find name 'API'.
[7m29[0m const block = API.overworld.getBlock(new BlockLocation(x,-63 + y,z))
[7m [0m [31m ~~~[0m
There are errors in this [code](#1073676701999059024 message):
[36m<repl>.js[0m:[33m1[0m:[33m3[0m - [31merror[0m[30m TS1128: [0mDeclaration or statement expected.
[7m1[0m static createCave(x,y,z){
[7m [0m [31m ~~~~~~[0m
[36m<repl>.js[0m:[33m1[0m:[33m10[0m - [31merror[0m[30m TS2304: [0mCannot find name 'createCave'.
[7m1[0m static createCave(x,y,z){
[7m [0m [31m ~~~~~~~~~~[0m
[36m<repl>.js[0m:[33m1[0m:[33m21[0m - [31merror[0m[30m TS2304: [0mCannot find name 'x'.
[7m1[0m static createCave(x,y,z){
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m23[0m - [31merror[0m[30m TS2304: [0mCannot find name 'y'.
[7m1[0m static createCave(x,y,z){
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m25[0m - [31merror[0m[30m TS2304: [0mCannot find name 'z'.
[7m1[0m static createCave(x,y,z){
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m27[0m - [31merror[0m[30m TS1005: [0m';' expected.
[7m1[0m static createCave(x,y,z){
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m33[0m:[33m25[0m - [31merror[0m[30m TS2304: [0mCannot find name 'API'.
[7m33[0m const block = API.overworld.getBlock(new BlockLocation(x,-63 + y,z))
[7m [0m [31m ~~~[0m
perhaps send the whole file, the debugger can debug files
whats the error in content log
full log
JavaScript/TypeScript code blocks not detected in [message](#1073676701999059024 message ).
Example:
```js
console.log("Hi mom!")
```
what does the caveArray thing return
print the value to content log to see what comes
print MinecraftBlockTypes[caveArray[x][y][z]] to see what comes out
How does one use that debugger?
?script debug
Here have a test bot dedicated towards debuging script-api code blocks within discord by yourself.
Usage
1. Make sure to use JS Code Block formating
`
console.warn("like this")
2. ` Long press Code Block message
3. Click Apps from the menu
4. Select Debug (Preview) for beta and Debug (Stable) for stable
5. Pog! you should be seeing all the issues, if any
What is the "like this" section?
its just code
Where do I add that to my code?
console.log("Like this")
@ripe knoll
thx
np
but what is question here
xd
ok
so stone is defined on MinecraftBlockTypes
but maybe is not what are u sending in
try
if(str in MiencraftBlockTypes)
test
test if string is in MinecraftBlockTypes
so then it didnt returns undefined
? JS
As the Script API is a framework built on JavaScript code, having an understanding of JavaScript is key.
If you are being shown this, then you most likely are a beginner with JS and could use a little guidance.
📺 Videos on Learning JavaScript
Javascript in 1 hour
Javascript Classes in 1 hour
Web Guide:
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide
Reference Sites:
https://www.w3schools.com/jsref/default.asp
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference
https://javascript.info