Solved math with variables?

  • 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 community!

    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!

Status
Not open for further replies.

teemuz

New Member
Apr 2, 2022
6
2
3
Any ideas how i can make this work so that {total.bj.%player%} is both {chosen.bj.%player%.1} and {chosen.bj.%player%.2}

basically variable3 = variable1 + variable2


Code:
command /playgame [<number>] [<text>] [<text>]:
    trigger:
        if arg-1 and arg-2 and arg-3 is set:
            if arg-2 is "bj":
                if arg-3 is "first":
                    send "%{prfx}% &fPicking up cards" to player
                    wait 12 ticks

                    set {chosen.bj.%player%.1} to a random element out of {cards.bj::*}
                    set {chosen.bj.%player%.2} to a random element out of {cards.bj::*}
                    send "%{prfx}% &fCard:&d %{chosen.bj.%player%.1}%" to player
                    send "%{prfx}% &fCard:&d %{chosen.bj.%player%.2}%" to player

                    wait 1 tick
                    set {total.bj.%player%} to {chosen.bj.%player%.1} + {chosen.bj.%player%.2}

                    wait 10 ticks
                    send "%{prfx}% &fTotal Amount: &d%{total.bj.%player%}%" to player
 
Any ideas how i can make this work so that {total.bj.%player%} is both {chosen.bj.%player%.1} and {chosen.bj.%player%.2}

basically variable3 = variable1 + variable2


Code:
command /playgame [<number>] [<text>] [<text>]:
    trigger:
        if arg-1 and arg-2 and arg-3 is set:
            if arg-2 is "bj":
                if arg-3 is "first":
                    send "%{prfx}% &fPicking up cards" to player
                    wait 12 ticks

                    set {chosen.bj.%player%.1} to a random element out of {cards.bj::*}
                    set {chosen.bj.%player%.2} to a random element out of {cards.bj::*}
                    send "%{prfx}% &fCard:&d %{chosen.bj.%player%.1}%" to player
                    send "%{prfx}% &fCard:&d %{chosen.bj.%player%.2}%" to player

                    wait 1 tick
                    set {total.bj.%player%} to {chosen.bj.%player%.1} + {chosen.bj.%player%.2}

                    wait 10 ticks
                    send "%{prfx}% &fTotal Amount: &d%{total.bj.%player%}%" to player
Code:
command /test:
    trigger:
        set {_x} to random integer between 1 and 100
        set {_y} to random integer between 1 and 100
        set {_result} to ({_x} + {_y})
        message "%{_x}% + %{_y}% = %{_result}%"
 
  • Like
Reactions: teemuz
Status
Not open for further replies.