#(JustinS) Feedback on my terrible script

120 messages · Page 1 of 1 (latest)

sullen siren
strong vineBOT
#

(JustinS) Feedback on my terrible script

strong vineBOT
#

Hi I'm AutoThreadBot! Don't mind me, I'll just be adding the helper team to this thread so they can see it. A human will get to you soon.

sullen siren
#

It gets run with - run <[equipped_script]> def.target:<[target]> where target is the same as the later-re-defined target in the script

autumn condorBOT
#
Changed to Discussion

Thread is now a Discussion thread. This indicates that the thread is not requesting help in any way, and is just discussing a broad topic openly. If you need help with something, use </helpthread:1028674284870180883> to switch the thread back to a normal help thread.

sullen siren
#

it is a discussion thread right?

#

or am I asking for help

#

Im asking for feedback is that the same?

pseudo flame
#

so fucking bad i can't even know where to start (i did not click the link)

sullen siren
pseudo flame
#

invert the condition and stop there

#

never nest

#
- if true:
  - whole script 

= bad

- if !true:
  - stop
- whole script

= good

#

you use <script[item_force_choke]> all over the place so you could just define SCRIPT <script[item_force_choke]> once to shorten everything

#

safe for the flags you often use, i.e. <script[item_force_choke].flag[variables.base_duration]>

you can just do

- define SCRIPT <script[item_force_choke]>
- define BASE_DURATION <script[item_force_choke].flag[variables.base_duration]>
- define BASE_STRENGTH <script[item_force_choke].flag[variables.base_strength]>

and then <script[item_force_choke].flag[variables.base_duration].sub[0.25].div[6].add[0.4]> before <[BASE_DURATION].sub[0.25].div[6].add[0.4]> which is arguably more readable

#

(since you're using it 3 times, even <[BASE_DURATION].sub[0.25].div[6].add[0.4]> would make sense to be defined once. you'll thank yourself next time you need to tweak the values)

#

@sullen siren PING ON REPLY FFS

sullen siren
#

give me a moment Im trying to make a gui and it sucks

pseudo flame
#

HA! SKILL ISSUE

#

I JUST MADE A GUI ENGINE THAT'S KILLING IT IN ABOUT AN HOUR

sullen siren
#

show

#

pics or no proof

pseudo flame
#

then you can do

yo_das_ma_gui:
  type: inventory
  debug: false
  gui: true
  inventory: CHEST
  title: Whatever
  size: 27
  subtasks:
    events:
      on open:
        - announce "on open"
      after open:
        - announce "after open"
      on close:
        - announce "on close"
      after close:
        - announce "after close"
      on drag:
        - announce "on drag"
      after drag:
        - announce "after drag"
      on item_flagged:FOO dragged:
        - announce "on item_flagged:FOO dragged"
      after item_flagged:FOO dragged:
        - announce "after item_flagged:FOO dragged"
      on click:
        - announce "on click"
      after click:
        - announce "after click"
      on item_flagged:FOO clicked:
        - announce "on item_flagged:FOO clicked"
      after item clicked:
        - announce "after item clicked"
      on dirt right clicked:
        - announce "on dirt right clicked"
sullen siren
#

I mean a picture

sullen siren
pseudo flame
pseudo flame
sullen siren
#

this is actually pretty great

pseudo flame
#

you don't have to make like on player clicks in gui_my_fucking_gui_name:

sullen siren
#

a .dsc file

pseudo flame
#

just put subtasks.events.on click directly in gui_my_fucking_gui_name

pseudo flame
sullen siren
#

no whats that

pseudo flame
#

the shit you're gonna need to do if you want to use my work

sullen siren
#

Oh wait I can press download this paste

#

thats cool

pseudo flame
#

yes, yes you cna

#

Denizen is everything

#

deniezn is powerful

#

denizen has an ecosystem

sullen siren
#

this shit better not contain a trojan

pseudo flame
#

join our sect

pseudo flame
#

learn to read a script and you'll get your answer

sullen siren
#

we'll just see what happens

#

So all I have to do is drop it in and I can use 'subtags' in the inventory script?

#

and restart first ofc

#

wait no just reload

pseudo flame
pseudo flame
#

i.e. you can't use priority, can't use switches, etc

sullen siren
#

hold on the denizen docs aint doccing
They said I can use stone[display=<&c>Button;lore=<&7>Click me!] directly inside the inventory grid thingy

pseudo flame
#

but you can do fancy things already, i.e. any valid advaned matcher will work
on !air|dirt double_click clicked will work

sullen siren
#

look at my img

pseudo flame
#

ye ?

sullen siren
#

doesnt work

pseudo flame
#

replace <red> by <green>

sullen siren
#

what

#

why

#

I know it's a colour lol

pseudo flame
#

replace red by green

sullen siren
#

but look [15:32:51 INFO]: ERROR in queue 'EXCOMMAND_46054_RecommendedEmperor' while executing command 'INVENTORY' with player 'JustinS_2006' in script 'VARIABLES_GUI_MENU' While reading 'slots' input! Error Message: Invalid slot item: [white_stained_glass_panel[display=Strength;lore=]]... ignoring it and assuming 'AIR' [15:32:51 INFO]: +> [ItemTag] valueOf ItemTag returning null: previous_page_item

pseudo flame
#

and it'll work

sullen siren
#

wait

pseudo flame
#

ah lol

#

thought you were thinking it wasn't working because it was put in red

sullen siren
#

Error Message: Invalid slot item: [white_stained_glass_panel[display=Strength;lore=test]]... ignoring it and assuming 'AIR'

sullen siren
#

the whole item[tags here] isnt working

pseudo flame
#

you get the answer in VS Code

#

white_stained_glass_panel is not an item

#

white_stained_glass_pane is

sullen siren
#

I disagree

#

why does it make the rest red though

pseudo flame
sullen siren
#

looks stupid

pseudo flame
sullen siren
#

yes but why doesnt it only make what comes right after <red> red? So, in this case 'Strength'

pseudo flame
#

it's basic highlighting for your convenience

muted ridge
pseudo flame
#

not a fully functionning thing in each and every edge case

pseudo flame
#

when possible, even use - stop if:foo instead of ```yaml

  • if foo:
    • stop
#

this way you spare even more nesting

#

- foreach next if:foo

muted ridge
#

that just becames more unclear ..?

pseudo flame
#

no it's actually extremely clear and readable

muted ridge
#

i personally disagree

pseudo flame
#

- stop if:!<player.has_flag[foo]>, you can read that as a sentence

#

that's the cleanest you can get

muted ridge
#

everything in one line != cleaner 🤷

pseudo flame
#

1-liners aren't the point

sullen siren
pseudo flame
#

legibility is the point

sullen siren
muted ridge
pseudo flame
#

nah, it's a way of having clean code

#

because clean code is code you can read and edit

pseudo flame
#

you exactly know what to do where to change things

#

vs. a nested structure when adding something new will likely nest even more, increase the current indent's size, whatever, losing legibility in the process

#

i.e. here i could one-line it and go like ```yaml

  • if ( <[HANDLER.CLICK_TYPE].exists> && <context.click> != <[HANDLER.CLICK_TYPE]> ) || ( <[HANDLER.ITEM_MATCHER].exists> && !<context.item.advanced_matches[<[HANDLER.ITEM_MATCHER]>]> ):
    • foreach next
  • inject <[SCRIPT]> path:subtasks.events.<[HANDLER.LINE]>
or even ```yaml
- if ( !<[HANDLER.CLICK_TYPE].exists> || <context.click> == <[HANDLER.CLICK_TYPE]> ) || ( !<[HANDLER.ITEM_MATCHER].exists> || <context.item.advanced_matches[<[HANDLER.ITEM_MATCHER]>]> ):
  - inject <[SCRIPT]> path:subtasks.events.<[HANDLER.LINE]>

but you loose legibility in the context

#

while the current state split in two separate conditions makes it easily understood

sullen siren
#

I prefer nesting certain things because it's easy to see what is linked to what

hearty onyxBOT
sullen siren
#

Because it's all indented

#

if you lose all of those indentations it's way harder to recognize a piece of code

#

imo

pseudo flame
#

It's okay to be wrong sometimes 😁

sullen siren
#

lmao

#

personal preference

#

this is barely about optimization/efficiency

#

If you prefer everything to be flat, thats fine

#

but I like big curves and I cannot lie