#A command based on a minecraft scoreboard value (/scoreboard)

1 messages · Page 1 of 1 (latest)

spiral yoke
#

have you checked the docs?

#

cause im pretty sure that would be an excellent start

safe ginkgo
#

im extremely new to skript

#

this is what i have so far. i have the objective created and i set one of my friends' "flc" values to 1, and it wont work (it doesnt detect them i believe)

spiral yoke
#

You should always use code blocks to make it easier to read; ```code here```

safe ginkgo
#
    permission: police.permission.node
    trigger:
        if {flc::%arg 1%} is set:
            if {flc::%arg 1%} is 1:
                send "%arg 1% possesses a valid firearms license."
            else:
                send "%arg 1% does NOT possess a valid firearms license."
        else:
            send "Error: Player %arg 1% not found or has not been assigned a firearms license."```
safe ginkgo
#

if it helps im running skript 2.6.4

spiral yoke
#

thats actually a bit outdated

#

2.8+ is out

#

2.8 also brought a bunch of new features

safe ginkgo
#

would updating it mess with the addons or skripts

#

my server is also 1.12.2

#

im pretty sure thats why i hesitated

#

but im unsure

safe ginkgo
#

should i rewrite my skript

#

its so simple but its failing 😭

#
    trigger:
        set {_player} to arg-1
        if {_player} is not online:
            send "&cError: That player is not online."
            stop
        if {_player}'s flc is 1:
            send "&a%{_player}% possesses a valid firearms license."
        else:
            send "&c%{_player}% does NOT possess a valid firearms license."
#

this wont work either bc line 7

#

i feel like its the way im trying to check if they have the scoreboard objective

spiral yoke
#

because the argument type is a string (text), not a player

#

also that local variable is very useless, just use the arg-1 expression

safe ginkgo
#

so remove the third line "set {_player} to arg-1"

#

and replace {_player} with arg-1

spiral yoke
#

yes

safe ginkgo
#

😭

spiral yoke
safe ginkgo
# spiral yoke .
    trigger:
        if arg-1 is not online:
            send "&cError: That player is not online."
            stop
        if arg-1's flc is 1:
            send "&a%arg-1% possesses a valid firearms license."
        else:
            send "&c%arg-1% does NOT possess a valid firearms license."```
#

heres what i have, theres no errors, but it still only responds with "&c%arg-1% does NOT possess a valid firearms license."

spiral yoke
#

can you please turn off reply pings

safe ginkgo
#

wdym

#

i can just not reply if it pings you

#

my apoligies

spiral yoke
safe ginkgo
#

apologies

#

oh wait

#

i see

spiral yoke
safe ginkgo
spiral yoke
safe ginkgo
#

lmao

#

my fault for the ping

safe ginkgo
#

ive done so much tinkering and it still wont work

#

if theres no errors it will only tell me that they dont have a firearms license despite the score being 1

spiral yoke
#

"wont work" doesnt tell many any important information

#

other than you have an issue, which i can deduce by the fact that youre here

safe ginkgo
#

ive rewritten it many times attempting to fix it but nothing

spiral yoke
#

i cant see any of these rewrites though

safe ginkgo
#
    trigger:
        if arg-1 is not online:
            send "&cError: That player is not online."
            stop
        if objective "flc" is 1 for arg-1:
            send "&a%arg-1% possesses a valid firearms license."
        else:
            send "&c%arg-1% does NOT possess a valid firearms license."```
#

the only error is line 6

#

skript fails to understand the condition

#

hope that clarifies

spiral yoke
safe ginkgo
spiral yoke
#

thats a new docs link

safe ginkgo
#

my apologies

safe ginkgo
spiral yoke
#

if that local variable is set to a string

safe ginkgo
#

what would i set it to though

#

thats the question

#

this whole time ive been struggling to target the scoreboard

#
    trigger:
        if arg-1 is not online:
            send "&cError: That player is not online."
            stop
        if score of arg-1 for {_flc} is 1:
            send "&a%arg-1% possesses a valid firearms license."
        else:
            send "&c%arg-1% does NOT possess a valid firearms license."```
#

so i would need to add a line (3) that would set it

#

but what would i set it to

spiral yoke
#

you said its already set

spiral yoke
#

an unset variable, too

#

you want to put a string there

#

look at the syntax in addition to the examples

#

the variable is an example of a potential way to have a string

safe ginkgo
safe ginkgo
#

in game i did /scoreboard players set (my friends user) flc 1

#

which would mean they would have the tag, or in this instance the firearms license, that would say they do

spiral yoke
#

uhuh

safe ginkgo
#

sorry im really confused 😭

spiral yoke
#

now you use thay key, "flc". not the variable

safe ginkgo
#

so if i were to say if score of arg-1 for "flc" is 1:

#

it would directly target the scoreboard objective?

#

i kinda just answered myself with a no bc it still is an error

#
    trigger:
        if arg-1 is not online:
            send "&cError: That player is not online."
            stop
        if score of arg-1 for "flc" is 1:
            send "&a%arg-1% possesses a valid firearms license."
        else:
            send "&c%arg-1% does NOT possess a valid firearms license."```
spiral yoke
#

try broadcast score of player for "flc"

safe ginkgo
#

if broadcast score of player for "flc" is 1:

#

?

#

something i should have done is list my addons too

#
  • Skellett
  • skDragon
  • SkQuery
#

thats all wtf

spiral yoke
#

uh, yeah.

  1. You need skbee installed
  2. remove skquery, its outdated and anything it can do, skript or skbee can do
safe ginkgo
#

so my script probably couldve worked

#

if i just had the correct addons....

safe ginkgo
#

accordingly

safe ginkgo
spiral yoke
#

theres different versions on the skbee github

#

scroll all the way down

safe ginkgo
#

heres what I have again to keep things easier

#
    trigger:
        if arg-1 is not online:
            send "&cError: That player is not online."
            stop
        if broadcast score of player for "flc" is 1:
            send "&a%arg-1% possesses a valid firearms license."
        else:
            send "&c%arg-1% does NOT possess a valid firearms license."```
safe ginkgo
#

(this is a screenshot showing SkBee is installed successfully)

spiral yoke
#

no is 1... you just want the expression, youre not comparing it to anything

safe ginkgo
#

sorry for ping

#

if im not mistaken im testing if their flc scoreboard value in game is 1

#

how else would i test for that?

spiral yoke
#

you are just broadcasting some object

#

like broadcast 1

#

you dont want broadcast 1 < 2, as you arent comparing it in a condition or anything

safe ginkgo
#

im lost

#

can you write a brief example describing your point?

#

once i figure this out, it will solve so many other problems

#

it seems so simple

spiral yoke
#

literally just broadcst it

spiral yoke
safe ginkgo
#

it still shows an error

#

second, its supposed to be conditional

#

considering i want two different type sof messages

#

if i do /scoreboard players list ohrockk

#

and flc = 1

#

i want it to message the person who does the command that i have a valid license

#

and if flc = 0

#

vise versa

#

wouldnt that be considered conditional or am mistaken

#

my skript just probably doesnt show what i want because as i said im new

#

but thats what im aiming for

spiral yoke
#

you just want to broadcast that expression--to see if its valid and set to what you expect it to be

safe ginkgo
#

im attempting to test for the score, and if its one, itll send the message

#

then the else would be if it isnt 0, so it would message that they dont have it

spiral yoke
#

it could also be not set or something

#

this is why you debug by broadcasting it

safe ginkgo
#

i see so were debugging

#

do you want me to just

#

broadcast gi

#

hi

#

or something

#

in that line

safe ginkgo
safe ginkgo
# spiral yoke not just "something"
    trigger:
        if arg-1 is not online:
            send "&cError: That player is not online."
            stop
        if broadcast score of player for "flc"
            send "&a%arg-1% possesses a valid firearms license."
        else:
            send "&c%arg-1% does NOT possess a valid firearms license."```
#

should it look like this?

#

if this is what you want, it gives an indent error on line 7 (because theres no colon on line 6)

and line 6 shows that it doesnt understand the condition

spiral yoke
#

nononono

#

the broadcast and condition are two seperate things

safe ginkgo
#

sorry for the ping again 😭

spiral yoke
#

just forget about the if statement for now.

spiral yoke
safe ginkgo
spiral yoke
#

no

safe ginkgo
#

im extremely confused

#

my apologies

#

tell me what you want where

#

to test

spiral yoke
#

just broadcast the score right after the trigger

safe ginkgo
#

so delete if

spiral yoke
#

you could

#

or just add the broadcast in first

safe ginkgo
#
    trigger:
        if arg-1 is not online:
            send "&cError: That player is not online."
            stop
        broadcast score of player for "flc"
            send "&a%arg-1% possesses a valid firearms license."
        else:
            send "&c%arg-1% does NOT possess a valid firearms license."```
#

i ran that and it still doesnt understand

spiral yoke
#

did you install skbee?

spiral yoke
#

version 1.10??

#

is that the latest that works on your server version?

#

this requires 2.6+

safe ginkgo
#

sorry for ping

#

i keep forgetting

safe ginkgo
#

yes

#

the only reason i use 1.12.2 is because its easy for people to join on newer versions

#

im also fluent with the command system bc 1.20 fucks it up

#

or anything beyond 1.12.2

spiral yoke
#

not much you can do unless you update

safe ginkgo
#

i could try using it

#

its possible it could still work

#

its just not 100%

#

ill try installing it

safe ginkgo
safe ginkgo
#

problem is when i try installing 2.8.4 (cleaned the addons) and i try using the /skript, it just shows an error message

#
org.bukkit.command.CommandException: Cannot execute command 'skript' in plugin Skript v2.8.4 - plugin is disabled.
    at org.bukkit.command.PluginCommand.execute(PluginCommand.java:36) ~[patched_1.12.2.jar:git-Paper-1620]
    at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:152) ~[patched_1.12.2.jar:git-Paper-1620]
    at org.bukkit.craftbukkit.v1_12_R1.CraftServer.dispatchCommand(CraftServer.java:685) ~[patched_1.12.2.jar:git-Paper-1620]
    at net.minecraft.server.v1_12_R1.PlayerConnection.handleCommand(PlayerConnection.java:1492) ~[patched_1.12.2.jar:git-Paper-1620]
    at net.minecraft.server.v1_12_R1.PlayerConnection.a(PlayerConnection.java:1297) ~[patched_1.12.2.jar:git-Paper-1620]
    at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:45) ~[patched_1.12.2.jar:git-Paper-1620]
    at net.minecraft.server.v1_12_R1.PacketPlayInChat.a(PacketPlayInChat.java:5) ~[patched_1.12.2.jar:git-Paper-1620]
    at net.minecraft.server.v1_12_R1.PlayerConnectionUtils.lambda$ensureMainThread$0(PlayerConnectionUtils.java:14) ~[patched_1.12.2.jar:git-Paper-1620]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515) ~[?:?]
    at java.util.concurrent.FutureTask.run(FutureTask.java:264) ~[?:?]
    at net.minecraft.server.v1_12_R1.SystemUtils.a(SourceFile:46) ~[patched_1.12.2.jar:git-Paper-1620]
    at net.minecraft.server.v1_12_R1.MinecraftServer.D(MinecraftServer.java:850) ~[patched_1.12.2.jar:git-Paper-1620]
    at net.minecraft.server.v1_12_R1.DedicatedServer.D(DedicatedServer.java:423) ~[patched_1.12.2.jar:git-Paper-1620]
    at net.minecraft.server.v1_12_R1.MinecraftServer.C(MinecraftServer.java:774) ~[patched_1.12.2.jar:git-Paper-1620]
    at net.minecraft.server.v1_12_R1.MinecraftServer.run(MinecraftServer.java:666) ~[patched_1.12.2.jar:git-Paper-1620]
    at java.lang.Thread.run(Thread.java:829) [?:?]```
spiral yoke