#running functions as the server

1 messages · Page 1 of 1 (latest)

twilit chasm
#

So this is my 3rd post in a small amount of time but I invited one of my friends to my vanilla server and the functions have tellraw command in meaning that the player has to be op to be able to use these functions, so is it possible to run these functions as the server

execute if entity @s[scores={warps_cooldown=..0}] run tellraw @s [{"text":"WARPS\n","color":"gold","bold":true},{"text":"[SPAWN] ","color":"aqua","bold":true,"hoverEvent":{"action":"show_text","value":{"text":"Left click","color":"dark_purple"}},"clickEvent":{"action":"run_command","value":"/tp @s -6.5 111.00 15 270 5"}},{"text":"[SHOP] ","color":"yellow","bold":true,"hoverEvent":{"action":"show_text","value":{"text":"left click","color":"dark_purple"}},"clickEvent":{"action":"run_command","value":"/tp @s 80.99 275.00 -5.50"}}]
scoreboard players set @s warps_cooldown 2
advancement revoke @a only vanillagames:click_food
reef ingotBOT
#

<@&1201956957406109788>

Someone will come and help soon!

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

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

simple ether
#

nope not possible

twilit chasm
#

so the player HAS to be op?

simple ether
#

but you can use a trigger command to trigger a scoreboard

twilit chasm
#

ooh

simple ether
#

and then tp them

twilit chasm
#

yeah ill try that

#

nonono

#

the tellraw command isnt appearing

#

lemme try using triggers

oblique ravine
twilit chasm
#

ik

#

@simple ether just said that

oblique ravine
#

Oh, you've already been answered

twilit chasm
#

yeah

#

im not resolving it yet tho

#

need help if this dont work

#

@simple ether

#

execute if entity @a[scores={warps_compass_trigger=1}] if entity @s[scores={warps_cooldown=..0}] run tellraw @s [{"text":"WARPS\n","color":"gold","bold":true},{"text":"[SPAWN] ","color":"aqua","bold":true,"hoverEvent":{"action":"show_text","value":{"text":"Left click","color":"dark_purple"}},"clickEvent":{"action":"run_command","value":"/tp @s -6.5 111.00 15 270 5"}},{"text":"[SHOP] ","color":"yellow","bold":true,"hoverEvent":{"action":"show_text","value":{"text":"left click","color":"dark_purple"}},"clickEvent":{"action":"run_command","value":"/tp @s 80.99 275.00 -5.50"}}]

#

my command

#

and

#

scoreboard players set @a warps_compass_trigger 0

#

the trigger doesnt appear

#

when i run /trigger

simple ether
#

you need to enable it

twilit chasm
#

kk

simple ether
#

scoreboard enable @s warps_compass_trigger

#

i think

twilit chasm
#

yeah

#

ill do @a

oblique ravine
#

you also need to transfer tp commands to the trigger

twilit chasm
#

yeah

#

so

#

execute as @a[scores={spawn_warp=1}] run tp @s -6.5 111.00 15 270 5

#

iin repeat always active

simple ether
#

yea

#

and than reset the score

twilit chasm
#

but it dont do nuthin

#

scoreboard players set @a spawn_warp 0

#

scoreboard players enable @a spawn_warp

#

in two others

simple ether
#

make sure the reset runs after the tp command

#

using chain command blocks

#

1 repeating commandblock

twilit chasm
#

kk

simple ether
#

and one chain

twilit chasm
#

repeat always active:
execute as @a[scores={spawn_warp=1}] run tp @s -6.5 111.00 15 270 5

#

chain always acive:
scoreboard players set @a spawn_warp 0

#

chain alwways active:
scoreboard players enable @a spawn_warp

simple ether
#

ok

#

looks fine

twilit chasm
#

but it dont work

simple ether
#

now /trigger spawn_warp

twilit chasm
#

it works 😄

simple ether
#

yay

twilit chasm
#

but wait

#

the compass has stopped working

#

the trigger works

#

for the tellraw

#

but

#
trigger warps_compass_trigger
scoreboard players set @s warps_cooldown 2
advancement revoke @a only vanillagames:click_food
#

it dont send it in chat

simple ether
#

now replace the tp command with the trigger

twilit chasm
#

yeah that works

#

but the compass has stopped sending the tellraw

#

execute as @a if entity @s[scores={warps_compass_trigger=1}] if entity @s[scores={warps_cooldown=..0}] run tellraw @s [{"text":"WARPS\n","color":"gold","bold":true},{"text":"[SPAWN] ","color":"aqua","bold":true,"hoverEvent":{"action":"show_text","value":{"text":"Left click","color":"dark_purple"}},"clickEvent":{"action":"run_command","value":"/trigger spawn_warp"}},{"text":"[SHOP] ","color":"yellow","bold":true,"hoverEvent":{"action":"show_text","value":{"text":"left click","color":"dark_purple"}},"clickEvent":{"action":"run_command","value":"/tp @s 80.99 275.00 -5.50"}}]

#

this command

simple ether
#

yea idk your code so it very difficult

oblique pivotBOT
#
execute as @a if entity @s[scores={warps_compass_trigger=1}] if entity @s[scores={warps_cooldown=..0}] run tellraw @s [{"text":"WARPS\n","color":"gold","bold":true},{"text":"[SPAWN] ","color":"aqua","bold":true,"hoverEvent":{"action":"show_text","value":{"text":"Left click","color":"dark_purple"}},"clickEvent":{"action":"run_command","value":"/trigger spawn_warp"}},{"text":"[SHOP] ","color":"yellow","bold":true,"hoverEvent":{"action":"show_text","value":{"text":"left click","color":"dark_purple"}},"clickEvent":{"action":"run_command","value":"/tp @s 80.99 275.00 -5.50"}}]
simple ether
#

oooh good wth

#

<@&935560587113541633> your bot is broken :((

simple ether
#

um I tried to syntax higlight your command so I could see it better

twilit chasm
#

oh kk

simple ether
#

doesn't look like a command problem, it works fine if i test it

twilit chasm
#

yeah but when i click on the compass it doesnt send the command

simple ether
#

yea idk

twilit chasm
#

so it works when i /trigger

#

but not when the function calls it

twilit chasm
#

im back

#

execute as @a if entity @s[scores={warps_compass_trigger=1}] if entity @s[scores={warps_cooldown=..0}] run tellraw @s [{"text":"WARPS\n","color":"gold","bold":true},{"text":"[SPAWN] ","color":"aqua","bold":true,"hoverEvent":{"action":"show_text","value":{"text":"Left click","color":"dark_purple"}},"clickEvent":{"action":"run_command","value":"/trigger spawn_warp"}},{"text":"[SHOP] ","color":"yellow","bold":true,"hoverEvent":{"action":"show_text","value":{"text":"left click","color":"dark_purple"}},"clickEvent":{"action":"run_command","value":"/tp @s 80.99 275.00 -5.50"}}] im still wondering whats wrong with it

#

@simple ether were not getting anywhere can i dm u the ip to the server so u can join and have a look at some of the commands

simple ether
#

We helpers are not here to go fix something for you, we're here to learn you how to fix it yourself

twilit chasm
#

yeah but if u could join and see everything

#

u dont have to fix it

#

cuz none of us know why its ot working

simple ether
#

yea sorry I'm not able to go on my pc

#

rn

twilit chasm
#

kk

#

so

#

in the function

#

it calls the trigger

#

but the trigger doesnt appear for the player

simple ether
#

are you enabling it?

harsh heron
twilit chasm
#

yeah

simple ether
#

where in a standalone repeating commandblock?

twilit chasm
#

scoreboard players enable @a warps_compass_trigger

#

these 3 do it

simple ether
#

but /trigger spawn_warp is a different trigger

twilit chasm
#

yeah

#

its a trigger

#

those 3 command blocks do the trigger

harsh heron
#

CBimpulse scoreboard objectives add <trigger> trigger

CBrepeat scoreboard players enable @a <trigger>
chain execute as @a[scores = {<trigger> = 1..}] run say i used the trigger
CBchain scoreboard players reset @a[scores = {<trigger = 1..}] <trigger>

-# tellraw example
tellraw @a {"text": "hello", "clickEvent": {"action": "run_command", "value": "/trigger <trigger>"}}

#

this would be the basis of what you need

twilit chasm
#

oka

#

1 se

harsh heron
twilit chasm
#

nope

harsh heron
#

did you enable the repeating command block?

twilit chasm
#

yeah

harsh heron
#

and made sure all <triggers have the same name

twilit chasm
#

yeah

harsh heron
#

hold on, im gonna test it

twilit chasm
#

idk if it should be reset

harsh heron
#

you can also make it "set ... 0"

twilit chasm
#

yeah i will

#

it does work when i use /trigger

harsh heron
#

@twilit chasm it works for me, are you working on a server with different software

twilit chasm
#

but not when i right click the compass

#
trigger warps_compass_trigger
scoreboard players set @s warps_cooldown 2
advancement revoke @a only vanillagames:click_food
#

im calling it like this

harsh heron
#

can i see your compass data

twilit chasm
#

yeah

#

minecraft:compass[minecraft:item_name='{"text":"Warps","color":"gold","bold":true}',minecraft:custom_data={warps_compass:1,undropable:1},minecraft:food={nutrition:0, saturation:0, can_always_eat:true, eat_seconds:999999999}]

harsh heron
#

what version are you on

twilit chasm
#

1.21

harsh heron
#

do you see an eating animation?

twilit chasm
#

it goes down

#

and i slow down

harsh heron
#

can i see your advancement

twilit chasm
#
{
  "criteria": {
    "requirement": {
      "trigger": "minecraft:using_item",
      "conditions": {
        "item": {
          "items": [
            "minecraft:compass"
          ],
          "predicates": {
            "minecraft:custom_data":"{\"warps_compass\":1}"
          }
        }
      }
    }
  },
  "rewards": {
    "function": "vanillagames:warps_click"
  }
}
harsh heron
twilit chasm
#

no it works

harsh heron
#

oh alright

twilit chasm
harsh heron
#

trigger warps_compass_trigger

#

is this the same name that you used in the example i gave

twilit chasm
#

1 sec

#

yeah thats it

harsh heron
#

it works now?

twilit chasm
#

it does everything

#

normally

#

but

#

call the trigger

#
scoreboard players set @s warps_cooldown 2
advancement revoke @a only vanillagames:click_food
#

it does this

#

but not the trigger

#

for some reason

#

it doesnt show up

harsh heron
#
scoreboard players enable @s warps_compass_trigger
trigger warps_compass_trigger
scoreboard players set @s warps_cooldown 2
advancement revoke @a only vanillagames:click_food
#

try this

#

oh i know now, you cant have command blocks with a data pack

#

the order of commands is completely ruined

#

@twilit chasm you said theres a tellraw, whats that for again

twilit chasm
#

heres a video of whats going on

#

@harsh heron

harsh heron
#

yuh i saw

harsh heron
twilit chasm
#

no

harsh heron
#

im lost then

twilit chasm
#

same

#

idk whats going on

harsh heron
#

@twilit chasm you can summon the helpers if you want to now

reef ingotBOT
# reef ingot <@&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)

twilit chasm
#

Helprrrrrrr

agile crag
#

are you trying to use trigger in a tellraw click thing so non-op players can run a function?

twilit chasm
#

yeah

agile crag
#

wheres the difficulty rn?

twilit chasm
#

?

#

easy

agile crag
#

like what problems are you encountering

harsh heron
twilit chasm
#

oh lol

harsh heron
#

it triggers it but

#

nothing happens

#

running it manually works

twilit chasm
#

@agile crag in this code:

trigger warps_compass_trigger
scoreboard players set @s warps_cooldown 2
advancement revoke @a only vanillagames:click_food
#

the trigger wont trigger

#

but everything else works

agile crag
#

wait so

twilit chasm
#

trigger warps_compass_trigger

#

this line

agile crag
#

the issue is that it won’t trigger?

twilit chasm
#

does nothing

#

yeaqh

twilit chasm
agile crag
#

the tellraw?

twilit chasm
#

1 sec

agile crag
#

lemme hop on my pc cause the vid wont load on my phone

twilit chasm
#

these 3 command bloks

#

bottom:
scoreboard players enable @a warps_compass_trigger
middle:
execute as @a if entity @s[scores={warps_compass_trigger=1..}] if entity @s[scores={warps_cooldown=..0}] run tellraw @s [{"text":"WARPS\n","color":"gold","bold":true},{"text":"[SPAWN] ","color":"aqua","bold":true,"hoverEvent":{"action":"show_text","value":{"text":"Left click","color":"dark_purple"}},"clickEvent":{"action":"run_command","value":"/trigger spawn_warp"}},{"text":"[SHOP] ","color":"yellow","bold":true,"hoverEvent":{"action":"show_text","value":{"text":"left click","color":"dark_purple"}},"clickEvent":{"action":"run_command","value":"/tp @s 80.99 275.00 -5.50"}}]
top:
scoreboard players set @a warps_compass_trigger 0

#

theyre all always active

#

@agile crag

agile crag
#

seems like an odd issue from the video, yeah

twilit chasm
#

idk whats going on

agile crag
#

thats what it seems like to me rn

twilit chasm
#

thats comfusing 😭

agile crag
#

lol

twilit chasm
#

so how do i fix it

agile crag
#

so wait

agile crag
#

like the chat message sending to them

twilit chasm
#

when i use /trigger yeah

agile crag
#

and then delete the cooldown setting line from the other function

#

you just need to set the cooldown after the fact

twilit chasm
#

which line???

agile crag
#

sorry, the long one

twilit chasm
#

ok

#

hold up

#

idk

agile crag
#

the point of trigger is that it would let a player run commands youd normally need op for via tellraw, but advancement rewards can run commands either way, trigger just kind of complicates things...

#

and then, you're not using a trigger in the tellraw itself

#

if im correctly understanding what your goals are and what people were saying earlier in the thread you might be able to simplify the process of sending the message to the player by doing it pretty much entirely within the advancement reward, then repurpose the trigger so that clicking the teleport option on the tellraw activates the trigger command, which would then set off a function that does the teleport and cooldown mojo

#

i do have to go to bed now as i unfortunately have to wake up in 5.5 hours...

#

but feel free to ask me when im awake or other helpers, i can try to clarify any questions you still have rn

twilit chasm
#

wait

#

wdym

#

is advancements easior?

#

easier?

#

@agile crag

agile crag
#

am i correct in that assumption?

twilit chasm
#

yeah

#

advancement

agile crag
#

alright

twilit chasm
#

then it runs the function

agile crag
#

im fairly sure people were telling you to use trigger functions in the tellraw or use the advancement as a trigger instead of the tellraw, rather than using a trigger inside the advancement, as it adds an extra step without solving the issue of the tellraw not working without op

twilit chasm
#

this is so confusing

agile crag
#

essentially rn what you have is

right click compass > trigger > tellraw command > teleport

the issue is that the underlined arrow requires operator from the person clicking the tellraw... however, if you use the trigger as a bridge in between tellraw and teleport, it wouldn't require op anymore, so you could do

right click compass > tellraw command > trigger > teleport

twilit chasm
#

sorta

#

sk

#

so

#

right click compass > trigger > tellraw command > teleport

#

with this

#

the player has to be op to see the tellraw command

agile crag
# twilit chasm <@720770065611358309> in this code: ``` trigger warps_compass_trigger scoreboar...

so the order of things you could do is

  1. change up this function so that instead of triggering and setting a cooldown, it does the tellraw command
  2. then, in the tellraw command, the command that's activated on click event should be changed to the trigger command
  3. finally, you can change the command blocks which detect the trigger to teleport the player and set the cooldown instead of sending them a tellraw. when i said "change it to a function" i was thinking in terms of datapacking instead of command blocks, sorry! what i essentially mean is to add another chain command block that sets the cooldown past where it teleports them, because if the logic is

trigger > set cooldown > check cooldown > teleport if cooldown is off

then it will always be on cooldown before it attempts to teleport rather than after it teleports you

agile crag
twilit chasm
#

nonono

agile crag
#

thats not how it should be......

twilit chasm
#

it WAS that

#

before

#

then i changed it to trigger

agile crag
#

huhhhh

twilit chasm
#

because only op players could run the tellraw

agile crag
#

wait so

twilit chasm
#

which is why i changed it to trigger

agile crag
#

you had the tellraw in the advancement rewards and it didn't show up?

twilit chasm
#

yes

#

because when i wasnlt op

#

i couldnt run tellraw

#

it runs the commands with the players permissions

agile crag
#

are you sure it was a permissions issue? im not like calling you stupid or anything, i just want to be certain because you're still running commands that require op there in the current version, and ik that advancement reward functions should be able to run any command as the player without operator...

twilit chasm
#

yeah

#

cuz when i deoped

#

it didnt work

#

and also with tp

#

it didnt work

agile crag
#

😵‍💫

twilit chasm
#

i gtg now ill be back soon

#

either soon or in a week

#

idk

agile crag
#

alright i should probably get off, sorry i cant stay to untangle this sooner rather than later

#

if you come back in like 6 hours hopefully ill be here lol

twilit chasm
#

i wont be here in 6 hours

#

camping

#

ill be back in a week

trim monolith