#not sure how to fix my script

36 messages · Page 1 of 1 (latest)

deep dragon
#
StartupEvents.registry('item', event => { 
    Platform.mods.kubejs.name = 'Shattered Realms'
    event.create('realm_carver', 'sword')
        .displayName('Realm Carver'),
        .attackDamageBaseline(30.0),
        .nbt({unbreakable:1, affix_data:{rarity:"apotheosis:ancient"}, sockets:5, weapon_attributes:{"parent":"bettercombat:sickle"})});
}
sullen auroraBOT
#

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

deep dragon
#

minecraft gives me an error when i launch saying "missing } after property list but im not sure where

untold micaBOT
#

If you're working with KubeJS scripts, config files, or similar things, we generally recommend using an actual IDE rather than just Notepad++ and its various siblings.
In a lot of cases, it can help you find errors in your code faster and also gives you neat features like syntax highlighting, automatic formatting, etc!
We recommend Visual Studio Code, since it's lightweight(-ish) and works very well with JavaScript files out-of-the-box.

ripe knot
#

In fact, the issue is different and VS Code would catch it immediately.

deep dragon
#

im using vs code

#

i got the syntax right i think

#

but apparently .nbt isnt a valid function

#
StartupEvents.registry('item', event => { 
    Platform.mods.kubejs.name = 'Shattered Realms'
    event.create('realm_carver', 'sword')
        .displayName('Realm Carver')
        .attackDamageBaseline(30.0)
        .nbt({unbreakable:1, affix_data:{rarity:"apotheosis:ancient"}, sockets:5, weapon_attributes:{"parent":"bettercombat:sickle"}})});
ripe knot
#
StartupEvents.registry("item", (event) => {
  Platform.mods.kubejs.name = "Shattered Realms";
  event
    .create("realm_carver", "sword")
    .displayName("Realm Carver")
    .attackDamageBaseline(30)
    .nbt({
      unbreakable: 1,
      affix_data: { rarity: "apotheosis:ancient" },
      sockets: 5,
      weapon_attributes: { parent: "bettercombat:sickle" },
    });
});
deep dragon
#

also how do you have it so it highlights and says what's wrong with your code

ripe knot
#

It should be built-in

deep dragon
#

hmm

ripe knot
#

But I also use an extension called "Error Lens" which puts the errors directly into code

deep dragon
#

just shows at the bottom

#

also will try this

#

oh bet

#

thank you

ripe knot
#

Also, 30.0 does nothing different than 30 in JS

#

There's only one type of number: number, which is equivalent to a double in strongly typed languages

#

This would be different if this were Java

deep dragon
#

thats true, i was just following a tutorial

#

so in java you want 30.0?

ripe knot
#

Yes, in Java, 30.0 will become a double and 30 will become an int

deep dragon
#

double is just the term right

ripe knot
#

Double precision float

deep dragon
#

i did a little java in the past but ive forgotten alot

#

i see

ripe knot
#

With ProbeJS type checking:

deep dragon
ripe knot
#

I don't think you can even set NBT during item creation

deep dragon
#

ah u gotta do it during crafting?

#

i feel like nbt during creation should make sense

#

commented them off for now

#

till i set up the recipe