#function macros

1 messages · Page 1 of 1 (latest)

weak gale
#

what should I be doing?

// tick.mcfunction:
function clan:border with entity Ferrarex

// border.mcfunction
$execute as @a at @e[tag=Base] positioned ~ $(Pos[1]) ~ run particle dust{color:[1,0,0],scale:2} ^ ^ ^100 0 0 0 0 100 force @s

the problem is at $(Pos[1]), but what should I be doing?

fading gateBOT
#

<@&1201956957406109788>

Someone will come and help soon!

💬 While you wait, take this time to provide more context and details.

                        🙇 After a while, hit the Summon Helpers button to ping the helper team. They'll be happy to help you


                        
                        ✅ Once your question has been resolved (or you no longer need it), please click Resolve Question or run /resolve
young musk
#

you can't target arrays in the passed data

#

you can only target primitive values

#

int/float/... /string

weak gale
#

how could I do it then?

#

could I do:

// tick.mcfunction:
function clan:border with entity Ferrarex Pos[1]

// border.mcfunction
$execute as @a at @e[tag=Base] positioned ~ $() ~ run particle dust{color:[1,0,0],scale:2} ^ ^ ^100 0 0 0 0 100 force @s

#

but what would I place at $()?

young musk
#

store the y value in a data store in advance, then pass in that data storage

#

you could simply name the key Y

weak gale
#

how do i do such?

calm wraithBOT
#
data modify storage clan:temp Y set from entity @s Pos[1]
function clan:border with storage clan:temp
$execute as @a at @e[tag=Base] positioned ~ $(Y) ~ run particle dust{color:[1,0,0],scale:2} ^ ^ ^100 0 0 0 0 100 force @s
young musk
#

There might be better ways to do this maybe. Running a macro every tick is horrible for performance. It can only cache the last 5 times you passed data

young musk
#

idk what you're trying to do. I need a little bit more info on what this is for and what it's supposed to do.

weak gale
weak gale
#

I was gonna do:
execute as @a run function clan:border with entity @s

young musk
#

I see now it's not like it's in the command and I didn't notice

weak gale
#

you're fine

#

I'm pretty sure it will need two functions just for that :/

young musk
#

In this case there is really no better way without some crazy complex hacky trickery

weak gale
#

// tick
execute as @a run function clan:border with entity @s

// border
data modify storage clan:temp Y set from entity @s Pos[1]
function clan:drawborder with storage clan:temp

// drawborder
$execute as @e[tag=Base] at @s positioned ~ $(Y) ~ run particle dust{color:[1,0,0],scale:2} ^ ^ ^100 0 0 0 0 10 force @a

#

got to this, but instead of force @a, i would need the player in "execute as @a" on tick

#

know how I could do it?

fading gateBOT
# fading gate <@&1201956957406109788>

<@&1166082198152159386> <@&1202694677766348840>

**🙇 Helpers Arise!**

Please note that you still might not immediately get a response since all helpers are human beings and volunteers (and also might be sleeping right now)

young musk
young musk
#

I'm testing rq

#

I don't want to tell wrong things

#

ok, it did not work as I imagined.
But this will do what you want if you use it instead of the current command:
$execute at @e[tag=Base] ~ $(Y) ~ run particle dust{color:[1,0,0],scale:2} ^ ^ ^100 0 0 0 0 10 force @s

weak gale
#

at @s at @e?

young musk
#

fixed

weak gale
#

ok, get it now

#

thanks