#Idek how i add a script man

1 messages · Page 1 of 1 (latest)

next schooner
#

is it like just a text document or something. ive read the example stuff and it made my head hurt and i had to reread it a few time and think i know what it means so then i go to get started and try to make one simple recipe for the barricades in the horror elements mod cause it doesnt normally have one and id like to craft them but unlike alot of the config files im messing with to mess with other stuff in my modpack this isnt just a text file. its a different type of file. a script even something i realized i cant just right click and add. i tried going back to the introduction but im just an idiot and it assumes everyone knows how to do that atleast or im overloooking where it said how. do i need special software? can i just venmo someone 12 bucks to do this for me? do i need to up my anxiety meds dosage before attempting this?

royal dewBOT
#

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

frigid jay
#

based on this im assuming youre trying to script without having any experience scripting before

#

to create a script you need to create a .js file

#

recipes are created under the server_scripts folder

reef rockBOT
#

You can add, remove, and modify recipes with KubeJS. The wiki has a page on that!
If you want to learn how to add recipes to any mod, click the Custom button.

frigid jay
#

the wiki has a page on how to add recipe scripts

reef rockBOT
#

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.

analog phoenix
#

I think it's worth mentioning that you can just edit the files with notepad

#

It's pretty bad long term but it might be easier at the start so you won't get overwhelmed with a new software

frigid jay
#

then we have to debug why scripts arent working when they forget to add a bracket or something

analog phoenix
#

If they never made a script before then vscode won't help them realize that something is missing

frigid jay
#

i mean vscode literally spells out a lot of errors for you, notepad doesnt even highlight them

#

:|

analog phoenix
#

Ye for anyone familiar with that stuff is very clear

#

But they don't know how to edit the example file

next schooner
# frigid jay to create a script you need to create a `.js` file

how do i do this. would adding a text file with the correct stuff and then change it from .txt to .js work. like how do i add a file to a folder that isnt in the right clikc and add menu. i get the scripting language going on in the example on the wiki. i feel decently confident if i could overcome this i could write something that works i just dunno how to add strange file types lmao]

next schooner
#

ig my wording was weird?

#

people arent seeming to get where i am in this process

frigid jay
#

well you either add a txt file and rename it, or you add it from VSCode directly

next schooner
#

if youd liek ill let you know if this chaotic scattreebrained plan of mine works

#

but for now ig resolved

next schooner
#

wait do i need brackets around this shit like in alot of config json files

#

and spaces in front of lines

frigid jay
#

uh.. no thats only json hmmm

#
ServerEvents.recipes(event => {
  event.shaped(...)
})
next schooner
#

cool

#

i have put this into a txt doc

#

ServerEvents.recipes(event => {event.shaped( Item.of('horror_element_mod;barricadeoak', 5), // arg 1: output
[
'A A',
' A ', // arg 2: the shape (array of strings)
'A A'
],
{
A: 'minecraft: oak_planks',
}
)
})

#

cross your fingers as i rename it to .js

#

im a failure

#

maybe its that bit ok arg text that someone became part of the stuff

frigid jay
#

You have a space before oak planks

next schooner
#

i copied and pasted that fromthe file so no

frigid jay
#

And you have a ; instead of : before that

next schooner
#

do i need a space

frigid jay
#

No

#

Spaces are not allowed in IDs

next schooner
#

okay so a ; before oak planks?

frigid jay
#

im gonna bite you

#
ServerEvents.recipes(event => {
  event.shaped( Item.of('horror_element_mod:barricadeoak', 5), [
    'A A',
    ' A ',
    'A A'
  ], { A: 'minecraft:oak_planks'})
})
#

:bite

#

emote fail

next schooner
#

sorry had to take a sec and check you bio to see if you were the age i can make that joke at. lucky me i saw grad

frigid jay
#

lol

next schooner
#

anyway time to try it

#

the recipe that is

frigid jay
#

im not sure if thats more awkward with or without the clarification XD

next schooner
#

less chance of the mods taking my kneecaps with it so worth

#

ommgggg it workssss

frigid jay
#

x3

royal dewBOT
next schooner
#

this shit works with jei too

#

thank so m,uch

frigid jay
#

jei automatically picks up registered recipes

next schooner
#

lovely.