Solved error when drawing particles with argument

  • Welcome to skUnity!

    Welcome to skUnity! This is a forum where members of the Skript community can communicate and interact. Skript Resource Creators can post their Resources for all to see and use.

    If you haven't done so already, feel free to join our official Discord server to expand your level of interaction with the comminuty!

    Now, what are you waiting for? Join the community now!

  • LOOKING FOR A VERSION OF SKRIPT?

    You can always check out skUnity Downloads for downloads and any other information about Skript!

ZLatKo

Member
Aug 19, 2023
4
0
1
24
hello everyone!
Please help me to find a workaround to solve my problem.
If you use "50, 80 and 120" instead of a variable, everything works.
i need to use rgb variable in particle drawing but ran into this problem:

Code:
command /test72 [<text>]:
    trigger:
        if arg 1 is "attackbullet":
            set {_ell} to location 1.3 blocks above location of player
            set {_ell2} to location 0.7 blocks above location of target mob
            set {_v} to vector from {_ell} to {_ell2}
            set vector length of {_v} to 0.1
            set {_loc} to location of {_ell}
            loop (distance between {_loc} and target entities) / 0.1 times:
                draw 1 of dust_color_transition using dustTransition(rgb({rgb::%player%}), white, 0.8) at {_loc} with force
                set {_loc} to {_loc} ~ {_v}
            set {_damage} to random integer between 2 and 4
            damage target entity by {_damage}

on join:
    set {name::%player%::MD5} to name of player hashed with MD5
    set {name::%player%::color} to "##%first 6 characters of {name::%player%::MD5}%"
    set {_hex} to {name::%player%::color}
    replace all "##" with "" in {_hex}
    set {_s::*} to split "0123456789abcdefklmnor" at ""
    loop 3 times:
        set {_n} to subtext of {_hex} from characters (loop-value -1)*2+1 to loop-value*2 in lower case
        add (index of first element out of (split {_n} at "") in "0123456789abcdefklmnor" -1)* 16 to {_rgb::%loop-value-1%}
        add index of 2nd element out of (split {_n} at "") in "0123456789abcdefklmnor"-1  to {_rgb::%loop-value-1%}
        set {rgb::%player%} to "%{_rgb::*}%"

console:
Line 10: (test.sk)
Functions cannot be used here (or there is a problem with your arguments).
Line: draw 1 of dust_color_transition using dustTransition(rgb({rgb::%player%}), white, 0.8) at {_loc} with force
 
hello everyone!
Please help me to find a workaround to solve my problem.
If you use "50, 80 and 120" instead of a variable, everything works.
i need to use rgb variable in particle drawing but ran into this problem:

Code:
command /test72 [<text>]:
    trigger:
        if arg 1 is "attackbullet":
            set {_ell} to location 1.3 blocks above location of player
            set {_ell2} to location 0.7 blocks above location of target mob
            set {_v} to vector from {_ell} to {_ell2}
            set vector length of {_v} to 0.1
            set {_loc} to location of {_ell}
            loop (distance between {_loc} and target entities) / 0.1 times:
                draw 1 of dust_color_transition using dustTransition(rgb({rgb::%player%}), white, 0.8) at {_loc} with force
                set {_loc} to {_loc} ~ {_v}
            set {_damage} to random integer between 2 and 4
            damage target entity by {_damage}

on join:
    set {name::%player%::MD5} to name of player hashed with MD5
    set {name::%player%::color} to "##%first 6 characters of {name::%player%::MD5}%"
    set {_hex} to {name::%player%::color}
    replace all "##" with "" in {_hex}
    set {_s::*} to split "0123456789abcdefklmnor" at ""
    loop 3 times:
        set {_n} to subtext of {_hex} from characters (loop-value -1)*2+1 to loop-value*2 in lower case
        add (index of first element out of (split {_n} at "") in "0123456789abcdefklmnor" -1)* 16 to {_rgb::%loop-value-1%}
        add index of 2nd element out of (split {_n} at "") in "0123456789abcdefklmnor"-1  to {_rgb::%loop-value-1%}
        set {rgb::%player%} to "%{_rgb::*}%"

console:
Line 10: (test.sk)
Functions cannot be used here (or there is a problem with your arguments).
Line: draw 1 of dust_color_transition using dustTransition(rgb({rgb::%player%}), white, 0.8) at {_loc} with force
Dunno bro i think that there is a problem with ur arguments (probably missplaced the ) after {rgb::%player%} also use %player’s uuid% not %player%
 
Dunno bro i think that there is a problem with ur arguments (probably missplaced the ) after {rgb::%player%} also use %player’s uuid% not %player%
I figured out how to do what I want. but there was another problem, I need to split the received values in {_rgb::*} into 3 separate ones. for example {r::%player%} {g::%player%} and {b::%player%}. however I don't know how to do it :emoji_frowning:

draw 1 of dust_color_transition using dustTransition(rgb({r::%player%}, {g::%player%}, {b::%player%}), white, 0.8) at {_loc} with force

need to change this piece of code:

Code:
on join:
    set {name::%player%::MD5} to name of player hashed with MD5
    set {name::%player%::color} to "##%first 6 characters of {name::%player%::MD5}%"
    set {_hex} to {name::%player%::color}
    replace all "##" with "" in {_hex}
    loop 3 times:
        set {_n} to subtext of {_hex} from characters (loop-value -1)*2+1 to loop-value*2 in lower case
        add (index of first element out of (split {_n} at "") in "0123456789abcdefklmnor" -1)* 16 to {_rgb::%loop-value-1%}
        add index of 2nd element out of (split {_n} at "") in "0123456789abcdefklmnor"-1  to {_rgb::%loop-value-1%}
        set {rgb::%player%} to "%{_rgb::*}%"
 
I figured out how to do what I want. but there was another problem, I need to split the received values in {_rgb::*} into 3 separate ones. for example {r::%player%} {g::%player%} and {b::%player%}. however I don't know how to do it :emoji_frowning:

draw 1 of dust_color_transition using dustTransition(rgb({r::%player%}, {g::%player%}, {b::%player%}), white, 0.8) at {_loc} with force

need to change this piece of code:

Code:
on join:
    set {name::%player%::MD5} to name of player hashed with MD5
    set {name::%player%::color} to "##%first 6 characters of {name::%player%::MD5}%"
    set {_hex} to {name::%player%::color}
    replace all "##" with "" in {_hex}
    loop 3 times:
        set {_n} to subtext of {_hex} from characters (loop-value -1)*2+1 to loop-value*2 in lower case
        add (index of first element out of (split {_n} at "") in "0123456789abcdefklmnor" -1)* 16 to {_rgb::%loop-value-1%}
        add index of 2nd element out of (split {_n} at "") in "0123456789abcdefklmnor"-1  to {_rgb::%loop-value-1%}
        set {rgb::%player%} to "%{_rgb::*}%"
Set {r} to first element out of {_rgb::*}
 
  • Love
Reactions: ZLatKo
Set {r} to first element out of {_rgb::*}
thanks a lot! it work!
Code:
    set {r::%player%} to first element out of {_rgb::*}
    set {g::%player%} to 2rd element out of {_rgb::*}
    set {b::%player%} to 3rd element out of {_rgb::*}
1692538209328.png

It turns out it's that simple. Even ashamed.