#Debugging, Am I doing this right?

49 messages · Page 1 of 1 (latest)

ornate spoke
#

no errors, but it doesn't seem to change the value of the gold ingot.
Maybe it just can't do it on runtime?

let value = 3000;

ServerEvents.tick(event => {
    if (event.server.ticks % 100 === 0) {

        let randomChange = Math.random() < 0.5 ? -1 : 1;
        
        value += randomChange;

        value = Math.max(1, value);

        ATEvents.mapping(mappingEvent => {
            mappingEvent.setRP("gold_ingot", value);
        });
    }
});
remote quiverBOT
#

Once your ticket has been resolved, please close it with </ticket close:1054771505520717835> command!

ornate spoke
#

I got some help from chatgpt for the events since I couldn't figure it out myself

#

so it might aswell be really wrong.

tardy sundialBOT
#

NEVER use any AI to generate KubeJS code. They currently know very little about it, and what they do know is often outdated or false. You can instead look at the KubeJS wiki or ask for help in #1047320998199955458.

ornate spoke
#

how else would I know

#

doesn't say much about server tick

#

on the wiki

#

from what I'm seeing

violet notch
#

i mean what do you want it to say confuseddoggo

#

its an event that happens every server tick

ornate spoke
#

I'm new 😔

violet notch
#

thats literally it

#

thats all it does

ornate spoke
#

yeah I thought so

#

do I have to set up a counter or something

#

so when it reaches 100 it just runs the rest and resets

violet notch
#

where does this come from?

ornate spoke
#

modrinth link

violet notch
#

i need you to be way more specific

ornate spoke
#

to set it thru KubeJS

#

it's in the description

rose vapor
#

going by how I assume this mod works you can't change the value during runtime

ornate spoke
#

yeah that's what I thought

#

but if I did anything wrong what would that be

violet notch
#

you cannot call an event inside another event

ornate spoke
violet notch
#

thats correct, they go in the server.log file

tardy sundialBOT
#

You can find your KubeJS server log in /minecraft/logs/kubejs/server.log.
If you are on 1.18 or 1.16 it will be called server.txt.
Please send it if asked, as it contains helpful information.

violet notch
#

thats where you can find it ^

ornate spoke
violet notch
#

not if Mund is correct

ornate spoke
violet notch
#

well use the event alone, debug it, and see how often its being called, we assume its only called once

ATEvents.mapping(e => {
  console.log('mapping stuff')
})
ornate spoke
#
[20:04:39] [INFO] Scripts loaded
[20:04:42] [INFO] worthchanger.js#6: Test
[20:04:42] [INFO] Server resource reload complete!
[20:04:42] [INFO] worthchanger.js#6: Test
#

runs twice?

#

what are the chances of the RP value thing being a value within the item that I can change

#

NBT or whatever

violet notch
#

considering what you were doing had an item ID, the chances of it being on the item itself (as nbt or anything else) is low to zero

ornate spoke
ornate spoke
violet notch
#

you mean nbt?

ornate spoke
#

yes

violet notch
#

theres mods that add the nbt to the tooltip, i cant remember if kjs has that config or not

#

if not, just write a quick script to write it out to the console or something