Are you not aware that the
rotate_around_y
tag exists? Cause it'd make this script a bit simpler.
... Also why are you forcing delay input to be ticks, instead of letting users input a duration?
Also, "random" is literally valid effect type input to the PlayEffect command, you don't need to custom-handle it.
Also, that
while
loop with a define inside is just an overcomplicated
repeat
knockoff.
Also, once you make use of rotate_around tags, you start to realize that you don't need a loop command at all and can instead literally just one-line it with a clever tag.
Something like:
<util.list_numbers_to[<element[360].div[<[stepsize]>]>].parse_tag[<location[<[radius]>,0,0].rotate_around_y[<[parse_value].mul[<[stepsize]>].to_radians>]>]>
(a bit long, but could be easily cleaned up by using a few defines).
Also, all of those
- if !<[somedef].exists>: - define somedef somedefault
are just overcomplicated fallbacks.
Also, what's with the
stop
command? That looks like you just need an
else
.
Here's a quick and easy 11 lines that does the same as your 40+ lines.
Code: Select all
CircleGenerator:
type: task
definitions: center|radius|stepsize|effect|delay
script:
- define stepsize <[stepsize]||0.1>
- define loc <location[<[radius]||1>,0,0]>
- define stepmul <[stepsize].to_radians>
- define points <util.list_numbers_to[<element[360].div[<[stepsize]>]>]>
- define points <[points].parse_tag[<[center].add[<[loc].rotate_around_y[<[parse_value].mul[<[stepmul]>]>]>]>]>
- if <[delay]||0> != 0:
- foreach <[points]> as:point:
- playeffect effect:<[effect]||flame> at:<[point]> offset:0 quantity:2
- wait <[delay]>
- else:
- playeffect at:<[points]> effect:<[effect]||flame> offset:0 quantity:2
Denizen lead developer. On Discord as mcmonkey#6666
.