#Optimization Issue

1 messages · Page 1 of 1 (latest)

subtle citrus
#
while {_stop} is not set:
        clear {_lsr::*}
        clear {_lsl::*}
        clear {_lsf::*}
        clear {_lsb::*}
        set {_lr} to location 40 meters at the right of {_e}
        loop 50 times:
            set {_llr} to {_lr}
            set y-location of {_llr} to (y-location of {_lr}-11.5+loop-number)
            add {_llr} to {_lsr::*}
        set {_ll} to location 40 meters at the left of {_e}
        loop 50 times:
            set {_lll} to {_ll}
            set y-location of {_lll} to (y-location of {_ll}-11.5+loop-number)
            add {_lll} to {_lsl::*}
        set {_lf} to location 40 meters in front of {_e}
        loop 50 times:
            set {_llf} to {_lf}
            set y-location of {_llf} to (y-location of {_lf}-11.5+loop-number)
            add {_llf} to {_lsf::*}
        set {_lb} to location 40 meters behind {_e}
        loop 50 times:
            set {_llb} to {_lb}
            set y-location of {_llb} to (y-location of {_lb}-11.5+loop-number)
            add {_llb} to {_lsl::*}
        if tag "custom;AttackSwitch" of nbt compound of event-entity isn't 20:
            set {_stop} to true
        loop {_lsr::*}:
            draw 1 of dust using dustOption(rgb(47, 168, 47), 10) at line(loop-value, ({lsl::%loop-number%})) with extra 0
        loop {_lsf::*}:
            draw 1 of dust using dustOption(rgb(47, 168, 47), 10) at line(loop-value, ({lsb::%loop-number%})) with extra 0
        wait 5 ticks

ay i need help optimizing this, it looks extremely laggy

past iron
#

look for repetition and condense it

subtle citrus
#

it will still be laggy

subtle citrus
#

like a local function

past iron
#

no

subtle citrus
#

a

subtle citrus
#

i want to make some kind of big laser wall

#

depending on the rotation of an entity

#

so when the entity's head will turn, the lasers will turn too

past iron
#

so then step back and think of how you can efficiently create a wall of lines while also keeping the code concise

subtle citrus
#

(and later i will have to detect the player in the lasers)