#Script API Debugger Playground
1 messages · Page 1 of 1 (latest)
There are errors in this [code](#1078766125057327194 message):
[36m@minecraft/server-gametest.d.ts[0m:[33m120[0m:[33m13[0m - [31merror[0m[30m TS2416: [0mProperty 'setVelocity' in type 'SimulatedPlayer' is not assignable to the same property in base type 'Player'.
Type '(velocity: Vector3) => void' is not assignable to type '(velocity: Vector3) => never'.
Type 'void' is not assignable to type 'never'.
[7m120[0m setVelocity(velocity: minecraftserver.Vector3): void;
[7m [0m [31m ~~~~~~~~~~~[0m
[36m@minecraft/server-gametest.d.ts[0m:[33m331[0m:[33m9[0m - [31merror[0m[30m TS2416: [0mProperty 'setVelocity' in type 'SimulatedPlayer' is not assignable to the same property in base type 'Player'.
Type '(velocity: Vector3) => void' is not assignable to type '(velocity: Vector3) => never'.
Type 'void' is not assignable to type 'never'.
[7m331[0m setVelocity(velocity: minecraftserver.Vector3): void;
[7m [0m [31m ~~~~~~~~~~~[0m
fine..
?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
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m1[0m:[33m20[0m - [31merror[0m[30m TS1127: [0mInvalid character.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m21[0m - [31merror[0m[30m TS2304: [0mCannot find name 'aether'.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~~~~~~[0m
[36m<repl>.js[0m:[33m1[0m:[33m27[0m - [31merror[0m[30m TS1127: [0mInvalid character.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m46[0m - [31merror[0m[30m TS1127: [0mInvalid character.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m47[0m - [31merror[0m[30m TS2304: [0mCannot find name 'give'.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~~~~[0m
[36m<repl>.js[0m:[33m1[0m:[33m52[0m - [31merror[0m[30m TS1005: [0m',' expected.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m54[0m - [31merror[0m[30m TS1146: [0mDeclaration expected.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m [0m
[36m<repl>.js[0m:[33m1[0m:[33m55[0m - [31merror[0m[30m TS2304: [0mCannot find name 'dirt'.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~~~~[0m
[36m<repl>.js[0m:[33m1[0m:[33m59[0m - [31merror[0m[30m TS1127: [0mInvalid character.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m60[0m - [31merror[0m[30m TS1128: [0mDeclaration or statement expected.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m1[0m:[33m20[0m - [31merror[0m[30m TS1127: [0mInvalid character.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m21[0m - [31merror[0m[30m TS2304: [0mCannot find name 'aether'.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~~~~~~[0m
[36m<repl>.js[0m:[33m1[0m:[33m27[0m - [31merror[0m[30m TS1127: [0mInvalid character.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m46[0m - [31merror[0m[30m TS1127: [0mInvalid character.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m47[0m - [31merror[0m[30m TS2304: [0mCannot find name 'give'.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~~~~[0m
[36m<repl>.js[0m:[33m1[0m:[33m52[0m - [31merror[0m[30m TS1005: [0m',' expected.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m54[0m - [31merror[0m[30m TS1146: [0mDeclaration expected.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m [0m
[36m<repl>.js[0m:[33m1[0m:[33m55[0m - [31merror[0m[30m TS2304: [0mCannot find name 'dirt'.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~~~~[0m
[36m<repl>.js[0m:[33m1[0m:[33m59[0m - [31merror[0m[30m TS1127: [0mInvalid character.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m60[0m - [31merror[0m[30m TS1128: [0mDeclaration or statement expected.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
[36m@minecraft/server-gametest.d.ts[0m:[33m120[0m:[33m13[0m - [31merror[0m[30m TS2416: [0mProperty 'setVelocity' in type 'SimulatedPlayer' is not assignable to the same property in base type 'Player'.
Type '(velocity: Vector3) => void' is not assignable to type '(velocity: Vector3) => never'.
Type 'void' is not assignable to type 'never'.
[7m120[0m setVelocity(velocity: minecraftserver.Vector3): void;
[7m [0m [31m ~~~~~~~~~~~[0m
[36m@minecraft/server-gametest.d.ts[0m:[33m331[0m:[33m9[0m - [31merror[0m[30m TS2416: [0mProperty 'setVelocity' in type 'SimulatedPlayer' is not assignable to the same property in base type 'Player'.
Type '(velocity: Vector3) => void' is not assignable to type '(velocity: Vector3) => never'.
Type 'void' is not assignable to type 'never'.
[7m331[0m setVelocity(velocity: minecraftserver.Vector3): void;
[7m [0m [31m ~~~~~~~~~~~[0m
No errors in [code](#1078766125057327194 message)
Reverted setVelocity return type change
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m1[0m:[33m20[0m - [31merror[0m[30m TS1127: [0mInvalid character.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m21[0m - [31merror[0m[30m TS2304: [0mCannot find name 'aether'.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~~~~~~[0m
[36m<repl>.js[0m:[33m1[0m:[33m27[0m - [31merror[0m[30m TS1127: [0mInvalid character.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m46[0m - [31merror[0m[30m TS1127: [0mInvalid character.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m47[0m - [31merror[0m[30m TS2304: [0mCannot find name 'give'.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~~~~[0m
[36m<repl>.js[0m:[33m1[0m:[33m52[0m - [31merror[0m[30m TS1005: [0m',' expected.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m54[0m - [31merror[0m[30m TS1146: [0mDeclaration expected.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m [0m
[36m<repl>.js[0m:[33m1[0m:[33m55[0m - [31merror[0m[30m TS2304: [0mCannot find name 'dirt'.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~~~~[0m
[36m<repl>.js[0m:[33m1[0m:[33m59[0m - [31merror[0m[30m TS1127: [0mInvalid character.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
[36m<repl>.js[0m:[33m1[0m:[33m60[0m - [31merror[0m[30m TS1128: [0mDeclaration or statement expected.
[7m1[0m world.getDimension(„aether“).runCommandAsync(„give @a dirt“)
[7m [0m [31m ~[0m
@lapis lagoon, any way they might be considerate on pinning this so it doesn't get lost or mixed up with the other traffic flow?
I would also suggest maybe restricting the bot here if that is even possible for a forum or better yet, just restrict usage in the general chat while allowing it to be used in this forum and other forums related to questions? To reduce clutter in the general chat which appears to be your main goal.
world.events.tick.subscribe(data => {
})
No errors in [code](#1078766125057327194 message)
let {events: {beforeChat: chat, beforeItemUseOn: itemBlock},say: s} = world
chat.subscribe((evd) => {s(evd.message)})
itemBlock.subscribe((evd) => {s(evd.item.typeId)})
No errors in [code](#1078766125057327194 message)
let {events: {beforeChat: {subscribe: chat}, beforeItemUseOn: {subscribe: itemBlock}},say: s} = world
chat((evd) => {s(evd.message)})
itemBlock((evd) => {s(evd.item.typeId)})
No errors in [code](#1078766125057327194 message)
Discord doesn't have permissions split between posts in forums. Imo the bot is needed in gen chat due to someone in general chat just post a problem with their code not working. This place is mainly for people testing the bot's usage, and sometimes they might send large code blocks in general chat to test the bot and flood the chat because there wasn't any places for that sort of stuff (in this server btw, my discord server already is for bot testing).
Which one is better?
On the first thought 2 but secondly, I think both got their ups and downs. The right one has a little highlighting which is nice, but ONE error takes up a minimum of 5 lines while the first one only takes 2 per error.
btw did u code the debugger itselt all by yourself?
The setup is coded all by myself, the compiler is Microsoft's.
Ah k
Maybe its worth a thought to not use embeds, sure they look really nice but at the cost of (what feels) like 200px width not sure if thats really worth it. Esspecially for the right one; Cuz the red underline always kinda points to nowhere because of the line break it takes up a lot of lines in general as mentioned and theres also just an extra line needed to seperate 2 error blocks. And btw just a quick addition to the right one would maybe be that its you trim the whitespaces before the code line because thats just straight imported from the code.
I always favor syntax highlighting. Additional lines at the cost of readability and simply making it easier on the eyes is always worth the cost imho.
I choose the second one.
world.events.playerJoin.subscribe(data => data.player.addTag('joined') && data.playerId.removeTag('sidebar'));
setTickInterval(() => {
world.getAllPlayers().filter(p => p.hasTag('joined')).forEach(p => {
if (!p.isSneaking || p.velocity.y <= 0.5)
return p.removeTag('joined');
});
}, 10);
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m1[0m:[33m48[0m - [31merror[0m[30m TS2551: [0mProperty 'player' does not exist on type 'PlayerJoinEvent'. Did you mean 'playerId'?
[7m1[0m world.events.playerJoin.subscribe(data => data.player.addTag('joined') && data.playerId.removeTag('sidebar'));
[7m [0m [31m ~~~~~~[0m
[36m@minecraft/server.d.ts[0m:[33m3499[0m:[33m22[0m
[7m3499[0m readonly playerId: string;
[7m [0m [36m ~~~~~~~~[0m
'playerId' is declared here.
[36m<repl>.js[0m:[33m1[0m:[33m89[0m - [31merror[0m[30m TS2339: [0mProperty 'removeTag' does not exist on type 'string'.
[7m1[0m world.events.playerJoin.subscribe(data => data.player.addTag('joined') && data.playerId.removeTag('sidebar'));
[7m [0m [31m ~~~~~~~~~[0m
[36m<repl>.js[0m:[33m2[0m:[33m1[0m - [31merror[0m[30m TS2304: [0mCannot find name 'setTickInterval'.
[7m2[0m setTickInterval(() => {
[7m [0m [31m~~~~~~~~~~~~~~~[0m
cool stuff
good
/**@param {ContainerSlot} contSlot */
function validateItem(contSlot) {
let { typeId, nameTag, amount } = contSlot,
lore = contSlot.getLore(),
itemType = Items.get(typeId)
if (
!itemType ||
/(:boat|:dye|frosted_ice|spawn_egg)/.test(typeId) ||
(/dragon_egg/.test(typeId) && amount > 1) ||
nameTag?.length > 30 ||
lore?.length > 1 ||
amount > 64
) {
if (!/written_book/.test(typeId)) {
contSlot.setItem()
return { typeId, nameTag, amount }
}
}
}```
No errors in [code](#1078766125057327194 message)
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m4[0m:[33m30[0m - [31merror[0m[30m TS2339: [0mProperty 'clearItem' does not exist on type 'ContainerSlot'.
[7m4[0m clearItem = contSlot.clearItem.bind(contSlot),
[7m [0m [31m ~~~~~~~~~[0m
[36m<repl>.js[0m:[33m10[0m:[33m51[0m - [31merror[0m[30m TS2554: [0mExpected 1-2 arguments, but got 3.
[7m10[0m !new ItemStack(Items.get(typeId), amount, data) ||
[7m [0m [31m ~~~~[0m
@warm forge from the long list I had, i made this new anti-illegal item
No need for the long list anymore
Cool sir 🫡
BTW, A question boat and dye are illegal?
If you also add element and compound check in it, it would be more better(just a suggestion)
Items.get already got that cover3d
🤔
Ah Well
I haven't tested them before, but it's in the list somehow XD
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m9[0m:[33m45[0m - [31merror[0m[30m TS2554: [0mExpected 1-2 arguments, but got 3.
[7m9[0m !new ItemStack(itemType.id, amount, data) ||
[7m [0m [31m ~~~~[0m
[36m<repl>.js[0m:[33m17[0m:[33m22[0m - [31merror[0m[30m TS2339: [0mProperty 'clearItem' does not exist on type 'ContainerSlot'.
[7m17[0m contSlot.clearItem()
[7m [0m [31m ~~~~~~~~~[0m
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m17[0m:[33m22[0m - [31merror[0m[30m TS2339: [0mProperty 'clearItem' does not exist on type 'ContainerSlot'.
[7m17[0m contSlot.clearItem()
[7m [0m [31m ~~~~~~~~~[0m
No errors in [code](#1078766125057327194 message)
No errors in [code](#1078766125057327194 message)
W
import { world } from "@minecraft/server"
world.events.tick.subscribe((data) => {
for (let p of world.getPlayers()) {
setScore("health", p, 11)
}
})
function setScore (objectiveId, entity, score) {
const objective = world.scoreboard.getObjective(objectiveId)
entity.scoreboard.setScore(objective, score)
}
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m3[0m:[33m14[0m - [31merror[0m[30m TS2339: [0mProperty 'tick' does not exist on type 'Events'.
[7m3[0m world.events.tick.subscribe((data) => {
[7m [0m [31m ~~~~[0m
sus
import { world, system } from "@minecraft/server"
world.events.tick.subscribe(async () => {
for (let player of world.getAllPlayers()) {
const pos = world.getDimension("overworld").getBlockFromRay(player.location, player.viewDirection, { "maxDistance": 10} )
console.error(pos)
}
});
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m5[0m:[33m69[0m - [31merror[0m[30m TS2345: [0mArgument of type 'Vector3' is not assignable to parameter of type 'Location'.
Type 'Vector3' is missing the following properties from type 'Location': equals, isNear
[7m5[0m const pos = world.getDimension("overworld").getBlockFromRay(player.location, player.viewDirection, { "maxDistance": 10} )
[7m [0m [31m ~~~~~~~~~~~~~~~[0m
Module name does not match the pattern of "^(?:@[a-z-*~][a-z-*.~]*\\/)?[a-z-~][a-z-.~]*$"
Created file in: scripts/test-score/TestScore.js
import {
world,
ScoreboardIdentity,
ScoreboardObjective,
} from "@minecraft/server";
const WILDCARD_INT = {
MIN: -2_147_483_648,
MAX: 2_147_483_647,
};
/**
* Test target's score on specific number range
*
* @param {string|ScoreboardIdentity} player
* Target/score holder
*
* @param {string|ScoreboardObjective} objective
* Scoreboard objective
*
* @param {string|number|null} min
* Minimum value/number (Allowed value: "*" - Wildcard Int)
*
* @param {string|number|null} max
* Maximum value/number (Allowed value: "*" - Wildcard Int)
*
* @return {boolean}
*/
export default function testScore(
player,
objective,
min = WILDCARD_INT.MIN,
max = WILDCARD_INT.MAX
) {
// Score
if (min === "*" || min === null) {
min = WILDCARD_INT.MIN;
}
if (max === "*" || max === null) {
max = WILDCARD_INT.MAX;
}
if (min > max) {
this.min = max;
this.max = min;
} else {
this.min = min;
this.max = max;
}
// Objective
if (typeof objective == "string") {
this.obj = world.scoreboard.getObjective(objective);
} else {
this.obj = objective;
}
// Player
if (typeof player == "string") {
this.plr = this.obj.getParticipants().find((v) => (v.displayName == player));
} else {
this.plr = player;
}
this.scr = this.plr.getScore(this.obj);
if (min < this.scr && this.scr > max) return true;
else return false;
}
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m61[0m:[33m58[0m - [31merror[0m[30m TS2540: [0mCannot assign to 'displayName' because it is a read-only property.
[7m61[0m this.plr = this.obj.getParticipants().find((v) => (v.displayName = player));
[7m [0m [31m ~~~~~~~~~~~[0m
Updated file in: scripts/test-score/TestScore.js
No errors in [code](#1078766125057327194 message)
Nice
/script writefile module_name:test-score attachment:1080353714742759484
@lapis lagoon
bot offline
Oo
Uptime: 1 minutes, 14 seconds
Latency: 97 ms
try again
A pull request already exists for joyloy-bot:script-94225.
Created pull request: #135
Ok it's works
scripts/minecraft-discord-chat/SimpleDiscordChat.js(12,8): error TS2307: Cannot find module 'mojang-net' or its corresponding type declarations. scripts/minecraft-discord-chat/SimpleDiscordChat.js(13,25): error TS2307: Cannot find module '@minecraft/server-server-admin' or its corresponding type declarations.
welp the build failed
Welp, I guess I'll just delete the file, since it's just for testing
Deleted file in: scripts/minecraft-discord-chat/SimpleDiscordChat.js
Hmmm... SimulatedPlayer has soo many issue
const item = player.getComponent("minecraft:inventory").container.getItem(player.selectedSlot) ?? "minecraft:air";
if (item.typeId == "minecraft:diamond_sword") {
let k = getScore("kills", player)
let d = getScore("deaths", player)
let kd = k / d
let kdr = Math.round(100*kd)/100;
let kit = player.getTags().find((tag) => tag.startsWith("kit-"))?.substring(4)?.replaceAll("-", "") ?? `No Kit`
let f = player.getTags().find((tag) => tag.startsWith("tag-"))?.substring(4)?.replaceAll("-", "") ?? `No Faction`
player.runCommandAsync(`title @s title §l§5 Hy§dp§5er§fPvP §r§8| §fFactions\n§8--------------------\n§a§l Kills§r§8: §f${k}\n§c§l Deaths§r§8: §f${d}\n§6§l KDR§r§8: §f${kdr}\n§d§l Faction§r§8: §f${f}\n§b§l Kit§r§8: §f${kit}\n§8--------------------`)
}
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m1[0m:[33m14[0m - [31merror[0m[30m TS2552: [0mCannot find name 'player'. Did you mean 'Player'?
[7m1[0m const item = player.getComponent("minecraft:inventory").container.getItem(player.selectedSlot) ?? "minecraft:air";
[7m [0m [31m ~~~~~~[0m
[36m@minecraft/server.d.ts[0m:[33m13364[0m:[33m15[0m
[7m13364[0m class Player extends Entity {
[7m [0m [36m ~~~~~~[0m
'Player' is declared here.
[36m<repl>.js[0m:[33m1[0m:[33m75[0m - [31merror[0m[30m TS2552: [0mCannot find name 'player'. Did you mean 'Player'?
[7m1[0m const item = player.getComponent("minecraft:inventory").container.getItem(player.selectedSlot) ?? "minecraft:air";
[7m [0m [31m ~~~~~~[0m
[36m@minecraft/server.d.ts[0m:[33m13364[0m:[33m15[0m
[7m13364[0m class Player extends Entity {
[7m [0m [36m ~~~~~~[0m
'Player' is declared here.
[36m<repl>.js[0m:[33m3[0m:[33m15[0m - [31merror[0m[30m TS2304: [0mCannot find name 'getScore'.
[7m3[0m let k = getScore("kills", player)
[7m [0m [31m ~~~~~~~~[0m
[36m<repl>.js[0m:[33m3[0m:[33m33[0m - [31merror[0m[30m TS2552: [0mCannot find name 'player'. Did you mean 'Player'?
[7m3[0m let k = getScore("kills", player)
[7m [0m [31m ~~~~~~[0m
[36m@minecraft/server.d.ts[0m:[33m13364[0m:[33m15[0m
[7m13364[0m class Player extends Entity {
[7m [0m [36m ~~~~~~[0m
'Player' is declared here.
[36m<repl>.js[0m:[33m4[0m:[33m15[0m - [31merror[0m[30m TS2304: [0mCannot find name 'getScore'.
[7m4[0m let d = getScore("deaths", player)
[7m [0m [31m ~~~~~~~~[0m
[36m<repl>.js[0m:[33m4[0m:[33m34[0m - [31merror[0m[30m TS2552: [0mCannot find name 'player'. Did you mean 'Player'?
[7m4[0m let d = getScore("deaths", player)
[7m [0m [31m ~~~~~~[0m
[36m@minecraft/server.d.ts[0m:[33m13364[0m:[33m15[0m
[7m13364[0m class Player extends Entity {
[7m [0m [36m ~~~~~~[0m
'Player' is declared here.
[36m<repl>.js[0m:[33m7[0m:[33m17[0m - [31merror[0m[30m TS2552: [0mCannot find name 'player'. Did you mean 'Player'?
[7m7[0m let kit = player.getTags().find((tag) => tag.startsWith("kit-"))?.substring(4)?.replaceAll("-", "") ?? `No Kit`
[7m [0m [31m ~~~~~~[0m
[36m@minecraft/server.d.ts[0m:[33m13364[0m:[33m15[0m
[7m13364[0m class Player extends Entity {
[7m [0m [36m ~~~~~~[0m
'Player' is declared here.
[36m<repl>.js[0m:[33m8[0m:[33m15[0m - [31merror[0m[30m TS2552: [0mCannot find name 'player'. Did you mean 'Player'?
[7m8[0m let f = player.getTags().find((tag) => tag.startsWith("tag-"))?.substring(4)?.replaceAll("-", "") ?? `No Faction`
[7m [0m [31m ~~~~~~[0m
[36m@minecraft/server.d.ts[0m:[33m13364[0m:[33m15[0m
[7m13364[0m class Player extends Entity {
[7m [0m [36m ~~~~~~[0m
'Player' is declared here.
[36m<repl>.js[0m:[33m9[0m:[33m7[0m - [31merror[0m[30m TS2552: [0mCannot find name 'player'. Did you mean 'Player'?
[7m9[0m player.runCommandAsync(`title @s title §l§5 Hy§dp§5er§fPvP §r§8| §fFactions\n§8--------------------\n§a§l Kills§r§8: §f${k}\n§c§l Deaths§r§8: §f${d}\n§6§l KDR§r§8: §f${kdr}\n§d§l Faction§r§8: §f${f}\n§b§l Kit§r§8: §f${kit}\n§8--------------------`)
[7m [0m [31m ~~~~~~[0m
const players = world.getPlayers()
for (const player of players) {
const item = player.getComponent("minecraft:inventory").container.getItem(player.selectedSlot) ?? "minecraft:air";
if (item.typeId == "minecraft:diamond_sword") {
let k = getScore("kills", player)
let d = getScore("deaths", player)
let kd = k / d
let kdr = Math.round(100*kd)/100;
let kit = player.getTags().find((tag) => tag.startsWith("kit-"))?.substring(4)?.replaceAll("-", "") ?? `No Kit`
let f = player.getTags().find((tag) => tag.startsWith("tag-"))?.substring(4)?.replaceAll("-", "") ?? `No Faction`
player.runCommandAsync(`title @s title §l§5 Hy§dp§5er§fPvP §r§8| §fFactions\n§8--------------------\n§a§l Kills§r§8: §f${k}\n§c§l Deaths§r§8: §f${d}\n§6§l KDR§r§8: §f${kdr}\n§d§l Faction§r§8: §f${f}\n§b§l Kit§r§8: §f${kit}\n§8--------------------`)
}
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m5[0m:[33m14[0m - [31merror[0m[30m TS2339: [0mProperty 'typeId' does not exist on type 'ItemStack | "minecraft:air"'.
Property 'typeId' does not exist on type '"minecraft:air"'.
[7m5[0m if (item.typeId == "minecraft:diamond_sword") {
[7m [0m [31m ~~~~~~[0m
[36m<repl>.js[0m:[33m6[0m:[33m15[0m - [31merror[0m[30m TS2304: [0mCannot find name 'getScore'.
[7m6[0m let k = getScore("kills", player)
[7m [0m [31m ~~~~~~~~[0m
[36m<repl>.js[0m:[33m7[0m:[33m15[0m - [31merror[0m[30m TS2304: [0mCannot find name 'getScore'.
[7m7[0m let d = getScore("deaths", player)
[7m [0m [31m ~~~~~~~~[0m
[36m<repl>.js[0m:[33m14[0m:[33m1[0m - [31merror[0m[30m TS1005: [0m'}' expected.
[7m14[0m
[7m [0m [31m[0m
[36m<repl>.js[0m:[33m2[0m:[33m33[0m
[7m2[0m for (const player of players) {
[7m [0m [36m ~[0m
The parser expected to find a '}' to match the '{' token here.
let someNum = [7,9,10]
let multiples = someNum.map(num => { return num * 2})
console.log(multiples)
[ 14, 18, 20 ]
now try { num * 2}
[ 14, 18, 20 ]
Yup
thnx for some new knowledge
let someNum = [7,9,10]
let ar = []
for (let k in someNum) ar.push(k)
console.log(ar)
console.log(someNum[ar[0]])
[ '0', '1', '2' ]
Are the results string?
[ '0', '1', '2' ]
7
works same when used in array
let someNum = [7,9,10]
let ar = []
for (let k in someNum) ar.push(k)
console.log(ar)
let newAr = []
for (let i in someNum) newAr.push(someNum[i])
console.log(newAr)
let someNum = [7,9,10]
console.log(someNum['0'])
7
I always forget that,"arrays can not be called"
😂
just found out that you can debug code in my bot's DM. Well we can get rid of this channel lol
xd
What about let this channel be the script api bot channel
problem is we cant pin this channel
but that was the idea
but maybe we could suggest separate channel in SCRIPTING category
Thats fine too
import { world } from "@minecraft/server";
let player = world.getPlayers({ name:"Jean majidYT" })
console.warn(getInv(player))
function getInv (entity) {
const items = [];
const inv = entity.getComponent("minecraft:inventory").container;
for (let i = 0; i < inv.lenght ; i++) {
items.push(inv.getItem(i));
}
return items
}
No errors in [code](#1078766125057327194 message)
false
getPlayers is plural so name it like players
lol
i will try but i think i got a different error
wc
while(true) {
console.log("test");
}
ohno
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
test
F
It would crash if there'll no limit on real servers or ide
nah
Yes
servers are meant to be like that but since its for public they gotta put limit
server can run things forever
I mean on websites
also wrong its just freeze
Ah well thats what i meant
Once i tried to print from 1 to infinity
And it just freezed
Click the link above to get code for 'calc-player-view-offset' in ScriptAPI repository.
The package doesn't exist on remote (1.19.60).
I implemented script versioning for scripts
hm
let {events: {beforeChat: {subscribe: chat},beforeItemUseOn: {subscribe: itemOnBlock},beforeItemUse: {subscribe: itemUse}, entityHit: {subscribe: hit}, entityHurt: { subscribe: hurt},blockPlace: {subscribe: place}, blockBreak: {subscribe: blBreak}},say: s} = world
chat(evd => {
let {message: msg,sender:player} = evd
let [cmd,...subcmd] = msg.split(/\s+/g)
if (cmd.startsWith("!")) evd.cancel = true
switch (cmd) {
case "!say":
s(subcmd.join(" "))
break;
case "!tell":
let plr = world.getAllPlayers().find(plrr => plrr.name == subcmd[0]);
subcmd.shift();
plr.tell(subcmd.join(" "));
break;
case "!color":
let clr = subcmd[0];
subcmd.shift()
let index = ["red","yellow"].indexOf(clr)
switch (index) {
case 0:
s("§c" + subcmd.join(" "))
break;
case 1:
s("§e" + subcmd.join(" "))
break;
default:
s(subcmd.join(" "))
}
break;
default:
player.tell("§cUnknown Command")
}
})
//written in discord
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m1[0m:[33m239[0m - [31merror[0m[30m TS2451: [0mCannot redeclare block-scoped variable '(Missing)'.
[7m1[0m let {events: {beforeChat: {subscribe: chat},beforeItemUseOn: {subscribe: itemOnBlock},beforeItemUse: {subscribe: itemUse}, entityHit: {subscribe: hit}, entityHurt: { subscribe: hurt},blockPlace: {subscribe: place}, blockBreak: {subscribe: break}},say: s} = world
[7m [0m [31m [0m
[36m<repl>.js[0m:[33m1[0m:[33m240[0m - [31merror[0m[30m TS1359: [0mIdentifier expected. 'break' is a reserved word that cannot be used here.
[7m1[0m let {events: {beforeChat: {subscribe: chat},beforeItemUseOn: {subscribe: itemOnBlock},beforeItemUse: {subscribe: itemUse}, entityHit: {subscribe: hit}, entityHurt: { subscribe: hurt},blockPlace: {subscribe: place}, blockBreak: {subscribe: break}},say: s} = world
[7m [0m [31m ~~~~~[0m
[36m<repl>.js[0m:[33m1[0m:[33m240[0m - [31merror[0m[30m TS2339: [0mProperty 'break' does not exist on type 'BlockBreakEventSignal'.
[7m1[0m let {events: {beforeChat: {subscribe: chat},beforeItemUseOn: {subscribe: itemOnBlock},beforeItemUse: {subscribe: itemUse}, entityHit: {subscribe: hit}, entityHurt: { subscribe: hurt},blockPlace: {subscribe: place}, blockBreak: {subscribe: break}},say: s} = world
[7m [0m [31m ~~~~~[0m
[36m<repl>.js[0m:[33m1[0m:[33m245[0m - [31merror[0m[30m TS2451: [0mCannot redeclare block-scoped variable '(Missing)'.
[7m1[0m let {events: {beforeChat: {subscribe: chat},beforeItemUseOn: {subscribe: itemOnBlock},beforeItemUse: {subscribe: itemUse}, entityHit: {subscribe: hit}, entityHurt: { subscribe: hurt},blockPlace: {subscribe: place}, blockBreak: {subscribe: break}},say: s} = world
[7m [0m [31m [0m
[36m<repl>.js[0m:[33m1[0m:[33m245[0m - [31merror[0m[30m TS1005: [0m':' expected.
[7m1[0m let {events: {beforeChat: {subscribe: chat},beforeItemUseOn: {subscribe: itemOnBlock},beforeItemUse: {subscribe: itemUse}, entityHit: {subscribe: hit}, entityHurt: { subscribe: hurt},blockPlace: {subscribe: place}, blockBreak: {subscribe: break}},say: s} = world
[7m [0m [31m ~[0m
No errors in [code](#1078766125057327194 message)
Lol break keyword was the cause of these errors
Now replaced them with blBreak and no errors!
const arg = '@e[scores={be=! 9 , aha=! .. 32,"ins v"=!..99,ban=5..,adventure=0}]'
console.log(toQueryScore(arg))
function toQueryScore(text) {
const query = {}
return query
}
{
scoreOptions: [ { objective: 'ins v', exclude: true, maxScore: 99 } ]
}
weo
{
scoreOptions: [
{ objective: 'ins v', exclude: true, maxScore: 99 },
{ objective: 'ban', minScore: 5 },
{ objective: 'adventure', maxScore: 0, minScore: 0 }
]
}
{
"scoreOptions": [
{
"objective": "be",
"exclude": true,
"maxScore": 9,
"minScore": 9
},
{
"objective": "aha",
"exclude": true,
"maxScore": 32
},
{
"objective": "ins v",
"ex
too long, but aigth
{
scoreOptions: [
{ objective: 'be', exclude: true, maxScore: 9, minScore: 9 },
{ objective: 'aha', exclude: true, maxScore: 32 },
{ objective: 'ins v', exclude: true, maxScore: 99 },
{ objective: 'ban', minScore: 5 },
{ objecti
How?
It results something else in ide
Hve u edited that?
function getScore(player, objectiveId, rNull = false) {
try {
return world.scoreboard
.getObjective(objectiveId)
.getScore(player.scoreboard);
} catch (error) {
return rNull ? null : 0;
}
}
const bankacc = getScore( Player, "bank")
const money = getScore( Player, "money")
let existplayers = world
.getAllPlayers()
.map( player => player.name )
function withdrawform(player) {
let withdraw = new ModalFormData();
withdraw.title("Withdraw")
withdraw.slider("Amount", 0, `${bankacc}`, 10, 0)
withdraw.show(player).then(result => {
const money1 = result.formValues[0]
player.runCommandAsync(`scoreboard players remove @s bank ${money1}`)
player.runCommandAsync(`scoreboard players add @s money ${money1}`)
player.tell(`§aSuccessfully withdraw $${money1}`)
}
}
function depositform(player) {
let deposit = new ModalFormData();
deposit.title("Deposit")
deposit.dropdown("Players", existplayers)
deposit.slider("Amount", 0, `${money}`, 10, 0)
deposit.toggle("Announce the transaction")
deposit.show(player).then(result => {
const amount = result.formValues[1]
const toggle = result.formValues[2]
const target = result.formValues[0]
player.runCommandAsync(`scoreboard players remove @s money ${amount}`)
player.runCommandAsync(`scoreboard players add @s bank ${amount}`)
if (toggle == true) {
world.say(`${player.name} sended §a$${amount}§f to ${target}'s bank account`)
}
})
}```
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m20[0m:[33m34[0m - [31merror[0m[30m TS2345: [0mArgument of type 'string' is not assignable to parameter of type 'number'.
[7m20[0m withdraw.slider("Amount", 0, `${bankacc}`, 10, 0)
[7m [0m [31m ~~~~~~~~~~~~[0m
[36m<repl>.js[0m:[33m29[0m:[33m1[0m - [31merror[0m[30m TS1005: [0m',' expected.
[7m29[0m }
[7m [0m [31m~[0m
[36m<repl>.js[0m:[33m35[0m:[33m33[0m - [31merror[0m[30m TS2345: [0mArgument of type 'string' is not assignable to parameter of type 'number'.
[7m35[0m deposit.slider("Amount", 0, `${money}`, 10, 0)
[7m [0m [31m ~~~~~~~~~~[0m
if (!(false && false)) {
console.log ("huh")
}
/home/jail/prog.js:1
if !(true && true) {
^
SyntaxError: Unexpected token '!'
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1032:15)
at Module._compile (node:internal/modules/cjs/loader:1067:
huh
world.events.playerJoin.subscribe(data => data.player.addTag('joined') && data.playerId.removeTag('sidebar'));
setTickInterval(() => {
world.getAllPlayers().filter(p => p.hasTag('joined')).forEach(p => {
if (!p.isSneaking || p.velocity.y <= 0.5)
return p.removeTag('joined');
});
}, 10);
/debug Stable
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m1[0m:[33m48[0m - [31merror[0m[30m TS2551: [0mProperty 'player' does not exist on type 'PlayerJoinEvent'. Did you mean 'playerId'?
[7m1[0m world.events.playerJoin.subscribe(data => data.player.addTag('joined') && data.playerId.removeTag('sidebar'));
[7m [0m [31m ~~~~~~[0m
[36m@minecraft/server.d.ts[0m:[33m13876[0m:[33m22[0m
[7m13876[0m readonly playerId: string;
[7m [0m [36m ~~~~~~~~[0m
'playerId' is declared here.
[36m<repl>.js[0m:[33m1[0m:[33m89[0m - [31merror[0m[30m TS2339: [0mProperty 'removeTag' does not exist on type 'string'.
[7m1[0m world.events.playerJoin.subscribe(data => data.player.addTag('joined') && data.playerId.removeTag('sidebar'));
[7m [0m [31m ~~~~~~~~~[0m
[36m<repl>.js[0m:[33m2[0m:[33m1[0m - [31merror[0m[30m TS2304: [0mCannot find name 'setTickInterval'.
[7m2[0m setTickInterval(() => {
[7m [0m [31m~~~~~~~~~~~~~~~[0m
Like this then just pick stable or preview
oh ok
s
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m1[0m:[33m1[0m - [31merror[0m[30m TS2304: [0mCannot find name 's'.
[7m1[0m s
[7m [0m [31m~[0m
dont drink and code
JavaScript/TypeScript code blocks not detected in [message](#1078766125057327194 message ).
Example:
```js
console.log("Hi mom!")
```
function Use(me) {
console.log("Use " + me)
}
Use("lawnmower")
Use lawnmower
function Use(me) {
console.log("Use " + me)
Use(me)
}
Use("lawnmower")
Use lawnmower
Use lawnmower
Use lawnmower
Use lawnmower
Use lawnmower
Use lawnmower
Use lawnmower
Use lawnmower
Use lawnmower
Use lawnmower
Use lawnmower
Use lawnmower
Use lawnmower
Use lawnmower
Use lawnmower
Use lawnmower
Use lawnmower
Use lawnmowe
It has a max limit
Plan failed
No errors in [code](#1078766125057327194 message)
Use lownmowe 😂
XD
function wth(why) {
let rp
let i = 0
try {
let id = setInterval(() => {
if (i !== 7) {
i++
} else {
rp = why
}
},300)
} finally {
return "wth "+ why
}
}
console.log(wth("bro, why"))
Smbdy compile this
returns "wth bro, why"
😂
I havent compiled yet
function wth(why) {
let rp
let i = 0
try {
let id = setInterval(() => {
if (i !== 7) {
i++
} else {
rp = why
clearInterval(id)
}
},300)
} finally {
return "wth "+ why
}
}
console.log(wth("bro, why"))
The bot is not responding what did you-
wth bro, why
Bot is waiting for when the function gets over/end
Lol
Yea it doesnt seem to support infinite running code 💀
We found a flaw 😂
😂
Lmao
import {
world,
Player
} from "@minecraft/server"
world.events.entityHit.subscribe( eventData => {
const {
entity,
hitEntity
} = eventData
if (! (hitEntity && hitEntity instanceof Player) ) return;
// do stuff on hit
} )
No errors in [code](#1078766125057327194 message)
for (let i = 0; i < 20; i++) {
console.log(i + i)
}
0
2
4
6
8
10
12
14
16
18
20
22
24
26
28
30
32
34
36
38
function a(min, max){
}
console.log(a)```
function a(min, max){
return Math.floor(Math.random() * (max - min)) + min
}
console.log(a(0,100))```
Im just testing stuff but thx tho
52
52
Wth
88
52
Again 52?
97
function getRandomInt(min, max) {
min = Math.ceil(min);
max = Math.floor(max);
return Math.floor(Math.random() * (max - min) + min); // The maximum is exclusive and the minimum is inclusive
}
for (let i = 0; i < 10; i++) {
console.log(getRandomInt(0, 100));
}
20
4
35
94
35
84
1
32
76
48
function a(min, max){
return Math.floor(Math.random() * (max - min)) + min
}
console.log(a(1.4,2.4))```
Its integer not float
Ohh
So that only work with whole number?
!false
console.log(!true == false);
true
console.log(!true)
false
let veges = {
potato: { color: "yellow" },
tomato: { color: "red" }
}
console.log(veges.potato == veges.tomato)
console.log(veges.potato.color)
console.log(veges.tomato.color)
false
yellow
red
let veges = {
potato: { color: "yellow" },
tomato: { color: "red" }
}
console.log(veges.potato == veges.tomato)
console.log("tomatoes are: " + veges.potato.color)
console.log("potatoes are : " + veges.tomato.color)
false
tomatoes are: yellow
potatoes are : red
What?
Potatoes are red and tomatoes yellow
Oh wait
😂
let veges = {
potato: { color: "yellow" },
tomato: { color: "red" }
}
console.log(veges.potato == veges.tomato)
console.log("tomatoes are: " + veges.tomato.color)
console.log("potatoes are : " + veges.potato.color)
false
tomatoes are: red
potatoes are : yellow
const mom = {
urMom: {
color: 'black'
},
urMom1: {
color: 'white'
}
}
console.log(mom.urMom.color == mom.urMom1.color)
console.log(`urMoms color is: ${mom.urMom.color}`)
console.log(`urMoms1 color is: ${mom.urMom1.color}`)```
how tf u run this?
APPS>COMPILE
?
;compile
const mom = {
urMom: {
color: 'black'
},
urMom1: {
color: 'white'
}
}
console.log(mom.urMom.color == mom.urMom1.color)
console.log(`urMoms color is: ${mom.urMom.color}`)
console.log(`urMoms1 color is: ${mom.urMom1.color}`)```
false
urMoms color is: black
urMoms1 color is: white
const arr = []
for(let i=0;i<10;i++) arr.push(random(-60))
console.log(arr)
function random(a, b = 0) {
const { floor: f, random: r } = Math
return f(!b?(r()*a):(r()*(a-b)+b))
}
[
9, 0, 15, 18, 16,
0, 16, 10, 16, 1
]
[
-2, -53, -12, -13,
-1, -47, -7, -3,
-24, -41
]
Cool, wheres the output lol
while(true) {console.error("im f***ing this console")}
YES
im f***ing this console
im f***ing this console
im f***ing this console
im f***ing this console
im f***ing this console
im f***ing this console
im f***ing this console
im f***ing this console
im f***ing this console
im f***ing this console
im f***ing
No errors in [code](#1078766125057327194 message)
while(true) {try{throw "frick this code";} catch {}}
No errors in [code](#1078766125057327194 message)
const ar = [];for (const k in globalThis)ar.push(k);console.log(ar)
[
'global',
'clearInterval',
'clearTimeout',
'setInterval',
'setTimeout',
'queueMicrotask',
'performance',
'clearImmediate',
'setImmediate'
]
async function obj(a){
for (const k in a) {
const v = a[k]
this[[typeof v,k]] = v.toString()
}
return this
};
(async()=>console.log(await obj(globalThis)))()
<ref *1> Object [global] {
global: [Circular *1],
clearInterval: [Function: clearInterval],
clearTimeout: [Function: clearTimeout],
setInterval: [Function: setInterval],
setTimeout: [Function: setTimeout] {
[Symbol(nodejs.util.promisify
system.runSchedule(function isSneak () {
for (const player of world.getPlayers()) {
if (!player.isSneaking) continue;
const objective = world.scoreboard.getObjective("sneak")
objective.setScore(player.scoreboard, objective.getScore(player.scoreboard) + 1)
system.runSchedule(() => {
objective.setScore(player.scoreboard, objective.getScore(player.scoreboard) - 1)
}, 40)
}
}, 1)
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m6[0m:[33m15[0m - [31merror[0m[30m TS2554: [0mExpected 2 arguments, but got 1.
[7m6[0m objective.setScore(objective.getScore(player.scoreboard)++)
[7m [0m [31m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
[36m@minecraft/server.d.ts[0m:[33m14205[0m:[33m55[0m
[7m14205[0m setScore(participant: ScoreboardIdentity, score: number): boolean;
[7m [0m [36m ~~~~~~~~~~~~~[0m
An argument for 'score' was not provided.
[36m<repl>.js[0m:[33m6[0m:[33m24[0m - [31merror[0m[30m TS2357: [0mThe operand of an increment or decrement operator must be a variable or a property access.
[7m6[0m objective.setScore(objective.getScore(player.scoreboard)++)
[7m [0m [31m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
[36m<repl>.js[0m:[33m9[0m:[33m17[0m - [31merror[0m[30m TS2554: [0mExpected 2 arguments, but got 1.
[7m9[0m objective.setScore(objective.getScore(player.scoreboard)--)
[7m [0m [31m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
[36m@minecraft/server.d.ts[0m:[33m14205[0m:[33m55[0m
[7m14205[0m setScore(participant: ScoreboardIdentity, score: number): boolean;
[7m [0m [36m ~~~~~~~~~~~~~[0m
An argument for 'score' was not provided.
[36m<repl>.js[0m:[33m9[0m:[33m26[0m - [31merror[0m[30m TS2357: [0mThe operand of an increment or decrement operator must be a variable or a property access.
[7m9[0m objective.setScore(objective.getScore(player.scoreboard)--)
[7m [0m [31m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m6[0m:[33m43[0m - [31merror[0m[30m TS2357: [0mThe operand of an increment or decrement operator must be a variable or a property access.
[7m6[0m objective.setScore(player.scoreboard, objective.getScore(player.scoreboard)++)
[7m [0m [31m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
[36m<repl>.js[0m:[33m9[0m:[33m45[0m - [31merror[0m[30m TS2357: [0mThe operand of an increment or decrement operator must be a variable or a property access.
[7m9[0m objective.setScore(player.scoreboard, objective.getScore(player.scoreboard)--)
[7m [0m [31m ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[0m
No errors in [code](#1078766125057327194 message)
let aक = "This Character Is Supported Ig";
console.log("yes " + aक)
This Character Is Supported Ig
yes This Character Is Supported Ig
Yup
No errors in [code](#1078766125057327194 message)
let getRandomValue = (length) => {
let chars = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890+=%_|<>{}[]!@#$/^&*()`~-':;,?".split("")
let str = ""
for (var i = 0; i < length; i++) {
str += chars[getRandomInt(0,chars.length)]
}
return str
}
var getRandomInt = (min = 0, max =100000) => Math.floor(Math.random() * (max - min)) + min
let db = {}
let obf = (str) => {
let random = getRandomValue(str.length);
db[random] = str;
return random;
}
let deobf = (str) => db[str];
for (var i = 0; i < 20; i++) {
let obfstr = obf ("just use it")
console.log (obfstr.includes("?")? "Found ? In " + obfstr: obfstr)
}
iGW!*Y!W7vh
Just Use It
Zm7Dmv-9[@|
Just Use It
7PW[>{tOP#5
Just Use It
OR|:C74m_mT
Just Use It
tOP#5
Lol
try to get the ?
there's no need to .split('')
yes
ok
How is it btw?
what
Function
huh....
)FNv+39Ir}A
>-}Al-XF/3>
htlvV;Q`]O9
_ysMov7mFd_
Cx8;*Po#+l%
cNPdq+'h-+b
CBt#d'mK51&
CTA,u/IT0>b
{tsYTQ{tIyE
&{uaJu$h!5!
A;@^!f,*CPN
orPn_-&V0+/
ggnV1'P/h*N
gj_avBFlXB/
s};B$/rWa2}
z7dH12/`i'z
T7!dqr_cXM/
SUO%x8`TK34
wTx_2T[_JHk
!iz18n*)ahT
bR;!5Bs7>^_
K]B5ESP1^}{
EGelzS|dCJO
n2Bf*;r2h9R
Pu<CFLBx/H&
TPmlY!Phb1%
:%UfcRPqA}F
*zvn,h@z]Oo
XGf<ao]`Y2s
TLIh4mc}`,D
upU,[tmVm_M
1B/=GmyqN9,
xdt<kpg+H{6
q7)e0#Z=_2N
ZNVdG{[9uO8
K+bHWjHGg~n
>cvc>}23cC<
oF|}5dpYD^g
_6pZ&IP-h|p
=RpkkZKoN1^
well...
since there's math.floor, there's no need to chars.length - 1
just chars.length
Why this is for "array and strings are 0 based"?
const str = '8yuigwets.[z23,pxuwt4'
console.log(str[4])
console.log(str[Math.floor(str.length)])
g
W8
I thought strings are 0 based
But well that's an array
its like a target thingy
let arr = [1,2,3,4,5]
console.log (arr.length)
console.log (arr [arr.length])
console.log (arr [arr.length -1 ])
5
undefined
5
kFxxo]GpV(O
0m<lo;mMl#;
x;vJ0|+(S:Z
z+6ciY)%,*K
=Tlj8<*%]&v
(+ikMX)=*)L
vj|t*wnI+Vn
Q`KNMtqO/bv
}f~B63QTcjv
OI%PC8KwLbM
t'}=o1;d]y5
ctq2}#hkB<x
,xsqC))Kx%J
GCXe15pUzy<
WGo67k:_*Tp
AjxQ^FFt+l%
Gq[+5'Y/;av
mnVe<{_WmM)
W#,{:-(p#Y=
S{SI#ju6Qc6
DQf/=Jcef
still no ??
remove - 1
well, ur doing randomizer
Yup
mk
Oh in randomizer max is exclusive
because of Math.floor
const rand = (value) => Math.random() * (value + value) - value
let ar = new Array(10)
for(let i=0;i<100;i++) ar.push(Math.floor(rand(i)))
console.log(ar)
[
<10 empty items>, 0, 0, -1,
0, -3, 2, 3,
1, -8, -9, -8,
-4, -1, -1, 11,
-11, 2, 5, 1,
8, 11, -3, -12,
-10, 11, 16, -14,
20,
Found ? In -d_,-v?8YM$
I6]R87K7$qn
(i=$'*:|g+e
Fd[!z],+(1w
K^02v-~PA5G
}f5~7e^{0{G
DBr%rI&=o1/
pH-HZR*wwKL
tBb-~iK:0lj
Found ? In @Sb?&[pbQ~o
Found ? In T'7Yb?Vg>W2
QXiX1}Bnr~<
d79G{/1R{1r
R%+Q(aVF6+l
8:myc]^+!$n
;g4$MSCfGjg
U&>umy`7iL0
u<P-zR'))g!
let getRandomValue = (length) => {
let chars = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890+=%_|<>{}[]!@#$/^&*()`~-':;,?"
let str = ""
for (var i = 0; i < length; i++) {
str += chars[getRandomInt(0,chars.length + 1)]
}
return str
}
var getRandomInt = (min = 0, max =100000) => Math.floor(Math.random() * (max - min)) + min
let db = {}
let obf = (str) => {
let random = getRandomValue(str.length);
db[random] = str;
return random;
}
let deobf = (str) => db[str];
let obfstr = obf({a: "a",b: "b"})
console.log(obfstr)
let deobfstr = deobf(obfstr)
console.log(deobfstr)
IF5Q@xiWehhU)j6OIf(*k[<*emGi]4
Wow Cool
Wait What Will Happen
{ a: 'a', b: 'b' }
let getRandomValue = (length) => {
let chars = "AaBbCcDdEeFfGgHhIiJjKkLlMmNnOoPpQqRrSsTtUuVvWwXxYyZz1234567890+=%_|<>{}[]!@#$/^&*()`~-':;,?"
let str = ""
for (var i = 0; i < length; i++) {
str += chars[getRandomInt(0,chars.length + 1)]
}
return str
}
var getRandomInt = (min = 0, max =100000) => Math.floor(Math.random() * (max - min)) + min
let db = {}
let obf = (prm) => {
if (typeof prm == "string") {
let random = getRandomValue(prm.length);
db[random] = prm;
return random;
} else if (typeof prm == 'object') {
let str = JSON.stringify(prm)
let random = getRandomValue(str.length);
db[random] = prm;
return random;
}
}
let deobf = (str) => db[str];
let obfstr = obf({a: "a",b: "b"})
console.log(obfstr)
let deobfstr = deobf(obfstr)
console.log(deobfstr)
undefined
undefined
console.log(typeof "this")
console.log(typeof {})```
string
object
z1S92g`(e$U&n5*-P
{ a: 'a', b: 'b' }
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m13[0m:[33m19[0m - [31merror[0m[30m TS2339: [0mProperty 'say' does not exist on type 'World'.
[7m13[0m world.say(orelocation[0])
[7m [0m [31m ~~~[0m
[36m<repl>.js[0m:[33m20[0m:[33m8[0m - [31merror[0m[30m TS2339: [0mProperty 'runSchedule' does not exist on type 'System'.
[7m20[0m system.runSchedule(() => {
[7m [0m [31m ~~~~~~~~~~~[0m
[36m<repl>.js[0m:[33m22[0m:[33m30[0m - [31merror[0m[30m TS2304: [0mCannot find name 'BlockLocation'.
[7m22[0m const location = new BlockLocation(orelocation[i].x,orelocation[i].y,orelocation[i].z)
[7m [0m [31m ~~~~~~~~~~~~~[0m
let smthng = ["eg","bg"]
for (let i of smthng) {
eval(`var ${i} = () => console.log(${i})`)
}
eg()
bg()
[Function: eg]
[Function: bg]
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m5[0m:[33m1[0m - [31merror[0m[30m TS2304: [0mCannot find name 'eg'.
[7m5[0m eg()
[7m [0m [31m~~[0m
[36m<repl>.js[0m:[33m6[0m:[33m1[0m - [31merror[0m[30m TS2304: [0mCannot find name 'bg'.
[7m6[0m bg()
[7m [0m [31m~~[0m
What how?
@lapis lagoon
What do you think is this a issue?
why ping him?
also it cant find variables called eg and bg
so u must define them also
.
Code Runner run the code
Jayly's bot only check possible error, not run the code
Ik
So that's not an issue
eval(`world.events.beforeChat.subsctibe((evd) => {
evd.message.cancel.yes.sir
})`)
No errors in [code](#1078766125057327194 message)
world.events.beforeChat.subsctibe((evd) => {
evd.message.cancel.yes.sir
})
There are errors in this [code](#1078766125057327194 message):
[36m<repl>.js[0m:[33m1[0m:[33m25[0m - [31merror[0m[30m TS2551: [0mProperty 'subsctibe' does not exist on type 'BeforeChatEventSignal'. Did you mean 'subscribe'?
[7m1[0m world.events.beforeChat.subsctibe((evd) => {
[7m [0m [31m ~~~~~~~~~[0m
[36m@minecraft/server.d.ts[0m:[33m298[0m:[33m13[0m
[7m298[0m subscribe(callback: (arg: BeforeChatEvent) => void): (arg: BeforeChatEvent) => void;
[7m [0m [36m ~~~~~~~~~[0m
'subscribe' is declared here.
Wow
function ItemConstructor(id) {
let Data = {
["minecraft:item"] : {
component: {},
description: {}
}
}
Data["minecraft:item"].description.identifier = id
this.name = (str) => {
Data["minecraft:item"].component["minecraft:display_name"] = {value: str}
}
this.ver = (context) => {
Data["format_version"] = context
}
this.comp = (d,v) => {
Data["minecraft:item"].component[d] = v
}
this.create = () => {
return JSON.stringify(Data,0,5);
}
this.category = (v) => {
Data["minecraft:item"].description.category = v
}
this.specificComponent = {
category: (str) => {
Data["minecraft:item"].component["minecraft:creative_category"] = {parent: str}
}
}
}
let item = new ItemConstructor("item:id")
item.name("My Item")
item.category("Equipment")
item.ver("1.16.100")
item.comp("minecraft:durablity",550)
item.specificComponent.category("itemGroup.name.tools")
console.log(item.create())
{
"minecraft:item": {
"component": {
"minecraft:display_name": {
"value": "My Item"
},
"minecraft:durablity": 550,
"minecraft:creative_category": {
function ItemConstructor(id) {
let Data = {
["minecraft:item"] : {
component: {},
description: {}
}
}
Data["minecraft:item"].description.identifier = id
this.name = (str) => {
Data["minecraft:item"].component["minecraft:display_name"] = {value: str}
}
this.ver = (context) => {
Data["format_version"] = context
}
this.comp = (d,v) => {
Data["minecraft:item"].component[d] = v
}
this.create = () => {
return JSON.stringify(Data);
}
this.category = (v) => {
Data["minecraft:item"].description.category = v
}
this.specificComponent = {
category: (str) => {
Data["minecraft:item"].component["minecraft:creative_category"] = {parent: str}
}
}
}
let item = new ItemConstructor("item:id")
item.name("My Item")
item.category("Equipment")
item.ver("1.16.100")
item.comp("minecraft:durablity",550)
item.specificComponent.category("itemGroup.name.tools")
console.log(item.create())
{"minecraft:item":{"component":{"minecraft:display_name":{"value":"My Item"},"minecraft:durablity":550,"minecraft:creative_category":{"parent":"itemGroup.name.tools"}},"description":{"identifier":"item:id","category":"Equipment"}},"format_version":"1
function ItemConstructor(id) {
let Data = {
["minecraft:item"] : {
component: {},
description: {}
}
}
Data["minecraft:item"].description.identifier = id
this.name = (str) => {
Data["minecraft:item"].component["minecraft:display_name"] = {value: str}
}
this.ver = (context) => {
Data["format_version"] = context
}
this.comp = (d,v) => {
Data["minecraft:item"].component[d] = v
}
this.create = () => {
return JSON.stringify(Data);
}
this.category = (v) => {
Data["minecraft:item"].description.category = v
}
this.specificComponent = {
category: (str) => {
Data["minecraft:item"].component["minecraft:creative_category"] = {parent: str}
}
}
}
let item = new ItemConstructor("item:id")
item.name("My Item")
item.category("Equipment")
item.ver("1.16.100")
item.specificComponent.category("itemGroup.name.tools")
console.log(item.create())
{"minecraft:item":{"component":{"minecraft:display_name":{"value":"My Item"},"minecraft:creative_category":{"parent":"itemGroup.name.tools"}},"description":{"identifier":"item:id","category":"Equipment"}},"format_version":"1.16.100"}
{"minecraft:item":{"component":{"minecraft:display_name":{"value":"My Item"},"minecraft:creative_category":{"parent":"itemGroup.name.tools"}},"description":{"identifier":"item:id","category":"Equipment"}},"format_version":"1.16.100"}
const cooldowns
world.events.beforeItemUse.subscribe(data => {
if (data.source.typeId !== 'minecraft:player') return
const player = data.source
if (data.item.typeId === '"bridge:wizard_ability_3') cooldown(player)
})
function cooldown(player)
player.runCommandAsync('tag @s add cool1')
}
if (player.hasTag ('cool1')) {
player.tell('wait 1 second');
player.runCommandAsync('tag @s remove cool1')
}
Please move ur testing and JS running to #debug-playground