#Function that returns whether it is raining or not

1 messages · Page 1 of 1 (latest)

nocturne ravine
#

I tried many ways and I couldn't do it XD

I use separate files (main.js, isRain.js and races.js), I want to use the function in races.js

I tried with beforeEvent(weatherChange), no success. I also tried with getDimension("overworld").getWeather, but it gives me error(||[Scripting][error]-ReferenceError: Native function [Dimension::getWeather] does not have required privileges. at isRain (functions/isRain.js:4)||).
Help, wise people. (@minecraft/[email protected])

pure lily
#
system.run(() => Dimension.getWeather() );```
nocturne ravine
#

Okay, I had turned off my PC, but I will turn it on.

nocturne ravine
#

I don't understand you

pure lily
nocturne ravine
#

Okay

nocturne ravine
# pure lily Send that part pls.

export function isRain() { 
    const weather = world.getDimension("overworld").getWeather();
    return weather == "Rain" || weather == "Thunder"
}```
pure lily
nocturne ravine
#

I asked DeepSeek and they told me it was because it wasn't in the api I was using. I don't think so

#

The error appears when I try to call the function.

#

I use it as follows:

    const vampires = world.getPlayers({scoreOptions: [{objective: 'rz', minScore: 1, maxScore: 1}]});
    for (const vampire of vampires) {
        if (isRain() == true) { vampire.sendMessage("§sEsta lloviendo...§r") } else { vampire.sendMessage("§qNo esta lloviendo...§r") }
    }
})```
#

HAHHAHAHA wtf

#

I removed the code that used the function, and tested it inside a runInterval that I used, and it works.

shut pebble
#

what is the point of this script

#

it should return nothing

#

the function make no sense

#

console.log(world.getDimension("overworld").getWeather())

#

this does same thing

#

i thought at first it should return boolean as you wrote isRain() in function name

nocturne ravine
shut pebble
shut pebble
nocturne ravine
cursive shadow
#

please read this

nocturne ravine
#

Okay