#World.say is no working for me (i'm begginer on this)
1 messages ยท Page 1 of 1 (latest)
world.say world.sendMessage
src/main.ts:2:20 - error TS2345: Argument of type 'void' is not assignable to parameter of type '() => void'.
2 system.runInterval((world.sendMessage('say Hello starter!')), 20); ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Found 1 error in src/main.ts:2
import { system, world } from '@minecraft/server';
system.runInterval( () => {
world.say('say Hello starter!')
}, 20);
src/main.ts:5:9 - error TS2339: Property 'say' does not exist on type 'World'.
5 world.say('say Hello starter!') ~~~
Found 1 error in src/main.ts:5
^
It compiled, i'll test.
One questions, what's the meaning of "() => {}" structure?
Minecraft says:
[Scripting][error]-Plugin [Invisible Armors - 0.0.1] - [main.js] ran with error: [TypeError: not a function at <anonymous> (main.js:5)
]
whats u game version
1.19.63.01
well you are using preview version api on stable version
you need preview version
or use old version types
Where can i find the old types?
what u used now?
For what thing?
to install types
The command prompt. (?)
which command i mean
i mean the npm command
I don't used any npm command, except for installing Typescript
And the "world.sendMessage" things are the same?
Now it says that "RunInterval" does not exist on "system"
JavaScript/TypeScript code blocks not detected in [message](#1083044630595108865 message ).
Example:
```js
console.log("Hi mom!")
```
since 1.19.50, we recieved two new methods that can be used for delaying function execution
// next tick
system.run(func);
// like setInterval
system.runSchedule( func, tickDelay );
// like cancel run
system.clearRun( runId );
// like clearInterval
system.clearRunSchedule( intervalId );
Example
for running code every 20ticks (1sec)
const TICKS_IN_SEC = 20;
const runSchedule = system.runSchedule( () => {
console.warn( "show this message every " + TICKS_IN_SEC + " ticks");
}, TICKS_IN_SEC );
system.clearRunSchedule( runSchedule ); //stop execution loop
system.runSchedule
You were not supposed to be wrong
๐
Where can i find all the properties for stable Minecraft?
shes using diff ver ๐
Np,it was just a jk
xd
Docs
Which docs? RunInterval exist in where i'm using.. Or how i can know if it's a preview/stable?
Vsc or bridge
Idk