#Script utility file to help(Beginners) with scripting hope this helps

1 messages · Page 1 of 1 (latest)

tardy spindle
#

This utility file contains methods which are in my opinion commonly used inside of the API but sometimes take a little bit of work to actually use for example the get entity from view direction or get block from view direction and so on hope this helps you guys I'm still updating it
Here is the link: https://www.mediafire.com/file/4p40zhn32csefmr/utility.js/file
Here is a small example video in the video I was using my laptop that is why I type slowly

MediaFire
#

Also forgot to add that the enchantment method currently only works for the armour I will add in the ability to target and item in the inventory via the ID also not all the methods have examples but they have descriptions on how to use them and all of the methods have identification for each of the parameters

#

So you know which parameter uses what

hollow palm
#

You should look into making prototypes of the core classes if you haven't already, it would probably this idea to a much more polished state

#

very nice by itself though

tardy spindle
# hollow palm You should look into making prototypes of the core classes if you haven't alread...

The thing is this isn't just about the core classes it allows you to do things like get the block IDs get states and even switch states of blocks with one of the methods and also I know what prototypes but I like using static functions inside of me class because of the fact that you don't need to go looking into for example the entity class to find certain methods or the block class to find others They're all just in one class called utility it means they're all combined together rather than spread amongst other classes

hollow palm
#

very true honestly, prototypes usually end up being a giant mess of file orgnaiztion (in my experience at least)

median fractal
#

what's the extencion u're using for minecraft api??

#

i wanna move to vsc but cant find an extension to write scripts with

tardy spindle
# median fractal i wanna move to vsc but cant find an extension to write scripts with

It's not an extension you need to get node.js and then you need to go to NPM and then you need to install the @Minecraft/server package and server UI package then you need to go into your vsc and using the terminal you need to paste the link that it'll give you to download it and press enter and it will download it once it's done that you'll have auto fills for the API in vsc you will need to keep up to date on the various APIs depending on if you want to use stable API or experimental API

formal plaza
#

Why would you need an extension to write scripts lol

tardy spindle
tawdry edge
formal plaza
#

intellisense is very nice to have

tardy spindle
#

Update

Ver 1.0.3

  • added itemInInventory(inventoryType, itemtype) Searches the inventory for the item.
  • added getEntityHealth(Entitytype) Get the Entities Health.
  • added setEntityHealth(Entitytype, value) Set The Entities Health
  • added GetPlayer() GetPlayer in the world without the need for a for loop
  • added GetQueryPlayer(options) Allows for filtered player searches without the use of a for loop
  • added getQueryEntity(dimension, options) Gets filtered entity in specified dimension without the use of a for loop
  • added setItemInInventory(inventoryType, item, slot, amount) Sets item in a specified inventory and slot
    link in the first message
tardy spindle
# light jolt What is this?

It is a utility class Which can be imported into your scripts and contains methods that make it easier to write scripts without having to use things like for loops and also allows for your code to be cleaner and easier to read

jagged rune
#

bruh

#

To be honest,

#

You can just do world.getPlayers() instead of importing a function and its the same as typing your function GetPlayer() its just PascalCase

#

That's stupid and scripting is not that hard how does it make easier to write

tardy spindle
# jagged rune You can just do `world.getPlayers()` instead of importing a function and its the...

yes but you still need to use a for loop in the code for it return the player methods and with the method in the utility class you don't have to do that and besides it is not meant to be for everyone anyways i created this for those who want to avoid using for loops and made there code cleaner if you don't like it then you don't have to use it have a look at this video and you will see why created this.

light jolt
#

Also you can do world.getplayers().find()
Or foreach()

tardy spindle
# light jolt World.getPlayer()[0] returns the first player

Yeah well in my opinion using those functions whilst useful can make the code messy if you use it too much and I understand what you mean by using index 0 but you need to remember that people who are new to the scripting aren't going to know to do that they aren't even going to know what a for loop is let alone how to use find or for each that is the reason why I created that method for those people and as I said to the previous person you don't have to use it if you don't want to it's there for those who want it

jagged rune
#

bruh

#

you still used for loop inside your function

#

just typing a for loop won't hurt

#

the people who would use your utility atleast had to learn scripting in order to do anything with that player

#

Ik you mean beginners

#

but well who the fuck is the begginer who don't know how to loop players

tawdry edge
jagged rune
#

well if only that GetPlayer() make a code look ✨ clean ✨ .. okay....

tawdry edge
tardy spindle
# jagged rune well if only that `GetPlayer()` make a code look ✨ *clean* ✨ .. okay....

ok bro seriously what is your problem if you don't want to use it then don't simple as that i understand criticism but at this point your criticism is not providing anything to either me or or others if you think you can do better by all means do but there is no need for this attitude and if this continues i will report you also if you goanna reply to someone sarcastically you might as well not bother even touching a key on your keyboard act like an adult not a child have a good day. @jagged rune

calm valve
tardy spindle
calm valve
#

they should learn javascript before even going into scripting api dev

#

but in reality they do not, so they struggle

tardy spindle
calm valve
#

thats what I did for the most part

tardy spindle
calm valve
#

you know that though, if you paid attention to me in GLM lol

calm valve
tardy spindle
calm valve
#

I forgot what I specifically helped you with though

jagged rune
#

I really was not wanting to critisize you ;-;

tardy spindle
# jagged rune okay bro calm down 😭 yea ok my bad dude I'm a very chill person you don't have...

Let me make this clear it is not about you criticising me that I'm upset I'm okay with you criticising you have the right to do so but the way you responded to the person who was just simply letting their opinion be known that's what upset me because you in your response did not make it an adult response you made it a childishly sarcastic response that is what upset me I'm ok with you criticising me because criticism helps me improve not only my coding but the utility file itself

light jolt
#

if i was you i would use a custom script api npm and use .prototype to create the methods and also to simplify long things not to shortner alredy small things

#

a good example would be

player.inventory.container

instead of getComponent

nova dust
#

the idea of the "project"(i think i can call that so) is good, but It'd be better if the functions did something really complex than
function GetPlayers(){return world.getPlayers()[0];}

#

or wrappers for the minecraft api itself

#

you could try to make caching via weakmaps for example to dont call the api's so much

tardy spindle
# nova dust the idea of the "project"(i think i can call that so) is good, but It'd be bette...

The whole point of this project wasn't to do some complex things it was make it simpler for beginners to use because I know many beginners who don't know things such as for loops or try catch or error handling or even don't know how to begin a script that was the point of this project and yet people seem to be missing the point entirely perhaps I didn't make it clear enough Which is my bad but to put it simply I wanted to make something that makes the scripting API more friendly to new people with simple functions such as the get player function

#

Script utility file to help(Beginners) with scripting hope this helps

#

Script utility file to help(Beginners) with scripting hope this helps

nova dust
tardy spindle
# nova dust well, now that makes sense the purpose of the project, even tho i dont think it ...

Well it does make sense for the project to exist because with the amount of people I have helped to don't know even the difference between a const and a let variable it makes sense for me but I appreciate that it may not make sense to you but thanks for your feedback I may try and make another utility file that doesn't actually use the API per se but uses more of the raw JavaScript capability

nova dust
tardy spindle
# nova dust i mean, thats a javascript issue, not scripting. When i say it doesnt make sense...

The problem is partially with JavaScript as you saybut it is also with people wanting to jump into add-on development but either not having the time or the patience to learn a scripting language beforehand before jumping into the deep end as I like to call it but if they use this utility file they can use it to write scripts and also learn from it by looking at the actual code in the description of the code that is provided along with the examples because the examples I tried to provide include snippets of code like how to use the item use after event and stuff like that. And since you require the API to do most of the interactions such as abilities with items and so on you really can't go without using scripts

#

An example would be me prior to the scripting API being released we had the event-based triggers and I had learnt a lot with those event-based triggers and when they were taken away I had almost quit add-on development entirely as a result but then I decided to learn off of other people's scripts and eventually got proficient enough to do it on my own

light jolt
tardy spindle
# light jolt The point is that beginners that dont know for loops, cant know anything about s...

Well that's why you're wrong because even though the method itself it doesn't use a loop the explanation and even the example is there so those people can actually see how a loop is used and even if they don't know how to import the file just yet they can also go into the utility file and see how imports are done and with things like vs code all they need to do is have the file within their file structure and type utility and then it's imported for them or did you forget that

light jolt
#

If you don’t have the patience to learn, you don’t learn. There’s no shortcut other than using your brain

tardy spindle
# light jolt If you don’t have the patience to learn, you don’t learn. There’s no shortcut ot...

This is not about having impatience to learn though this is also about the fact that a lot of people learn by doing not by reading or things like that a lot of people are not the type of people to just sit there and read documentation for hours they want to try things and work out by trial and error I know because I did this very same thing when learning scripts myself I couldn't bring myself to sit there for hours reading documentation because I would have literally fallen asleep at my desk

#

Impatience is part of it yes but not the entire whole of the problem

#

And as I have said many times if people want to use it it's there if they don't they don't simple as that

#

So I don't know why people are still arguing over the usefulness of this file there are better things to do with life

light jolt
#

You re right I’m just wasting my time

tawdry edge
nova dust
# tawdry edge Why are you so passive aggressive??

am i? actually English is not my native language and its been a while since i talked in English, so im practicing, i might sound like that but it's not what i meant, it's just the way i can think on a phrase

jagged rune