Skript just not working the way its suppossed to?

Discussion in 'Skript' started by SoloGamingYT, Feb 26, 2020.

  1. Code (Java):

    function reward(p: player, t: text):
        if {_t} is "default":
            if {defaultreward:%{_p}%} is false:
                send "FALSEarg1" to {_p}
                if {_DReward:timer/%{_P}%} is not set:
                    send "NOTSET" to {_p}

                    play raw sound "random.levelup" at {_p} with pitch 1 volume 1
                    set {_DReward:timer/%{_P}%} to now
                    send "&5[&d!&5] &fYou have picked up &d&nDefault Delivery" to {_p}
                    make console execute command "crate key %{_p}% common 2"
                    set {defaultreward:%{_p}%} to true
                else:
                    if {_DReward:timer/%{_P}%} is set:
                        send "SET?" to {_p}
                        set {_time} to difference between {_DReward:timer/%{_P}%} and now
                        if {_time} is less than 24 hours:
                            send "LESS24SET" to {_p}

                            set {_sendtime} to difference between {_time} and 24 hours
                            set {_sendtime} to round({_sendtime})
                            play raw sound "mob.wither.shoot" at {_p} with pitch 1 volume 1
                            send "&c&lOops! &fYou have already redeemed this!" to {_p}
                            send "&fcome back in &d&l%{_sendtime}%&f!" to {_p}
                        if {_time} is more than 24 hours:
                            send "MORE24SET" to {_p}

                            set {_DReward:timer/%{_P}%} to now
                            play raw sound "random.levelup" at {_p} with pitch 1 volume 1
                            send "&5[&d!&5] &fYou have picked up &d&nDefault Delivery2" to {_p}
                            make console execute command "crate key %{_p}% common 2"
                            set {defaultreward:%{_p}%} to true
            else:
                if {defaultreward:%{_p}%} is true:
                    send "TRUEARG2" to {_p}
                    if {_DReward:timer/%{_P}%} is set:
                        set {_time} to difference between {_DReward:timer/%{_P}%} and now
                        if {_time} is less than 24 hours:
                            set {_sendtime} to difference between {_time} and 24 hours
                            set {_sendtime} to round({_sendtime})
                            play raw sound "mob.wither.shoot" at {_p} with pitch 1 volume 1
                            send "&c&lOops! &fYou have already redeemed this!" to {_p}
                            send "&fcome back in &d&l%{_sendtime}%&f!" to {_p}
                        if {_time} is more than 24 hours:
                            set {_DReward:timer/%{_P}%} to now
                            play raw sound "random.levelup" at {_p} with pitch 1 volume 1
                            send "&5[&d!&5] &fYou have picked up &d&nDefault Delivery2" to {_p}
                            make console execute command "crate key %{_p}% common 2"
                            set {defaultreward:%{_p}%} to true
                        if {defaultreward:%{_p}%} is not set:
                            set {_DReward:timer/%{_P}%} to now
                            play raw sound "random.levelup" at {_p} with pitch 1 volume 1
                            send "&5[&d!&5] &fYou have picked up &d&nDefault Delivery 1" to {_p}
                            make console execute command "crate key %{_p}% common 2"
                            set {defaultreward:%{_p}%} to true
                    if {_DReward:timer/%{_P}%} is not set:
                        send "NOTSETarg2" to {_p}

                        play raw sound "random.levelup" at {_p} with pitch 1 volume 1
                        set {_DReward:timer/%{_P}%} to now
                        send "&5[&d!&5] &fYou have picked up &d&nDefault Delivery" to {_p}
                        make console execute command "crate key %{_p}% common 2"
                        set {defaultreward:%{_p}%} to true

    command /debugdaily:
        trigger:
            send "%{defaultreward:%player%}%"
            send ""
            send "%{_DReward:timer/%player%}%"

    command /resetdaily:
        trigger:
            set {defaultreward:%player%} to false

    command /daily:
        trigger:
            open chest with 4 rows named "&d&nDaily Rewards" to player

            format slot 10 of player with nether star named "&d&lVote Rewards" with lore "||&fSpend your &d&lVote Stars &fon||&fitems that can progress your||&fexperience! Open the vote||&fshop by typing &d&l/voteshop&r||&for by clicking here!|| ||&d&lClick&f to open " to close then run [make player execute command "voteshop"]
            if player has permission "dailyrewards.silver":
                format slot 12 of player with glowing iron ingot named "&d&lSilver Reward" with lore "&fRequires Rank &5Elite&d$|| ||&fThe better rank you have,||&fthe better the rewards! Buy a||&frank on our &d&l/store&f!" to be unstealable
            else:
                format slot 12 of player with iron ingot named "&d&lSilver Reward" with lore "&fRequires Rank &5Elite&d$|| ||&fThe better rank you have,||&fthe better the rewards! Buy a||&frank on our &d&l/store&f!" to be unstealable

            if player has permission "dailyrewards.gold":
                format slot 13 of player with glowing gold ingot named "&d&lGold Reward" with lore "&fRequires Rank &cLegend|| ||&fThe better rank you have,||&fthe better the rewards! Buy a||&frank on our &d&l/store&f!" to be unstealable
            else:
                format slot 13 of player with gold ingot named "&d&lGold Reward" with lore "&fRequires Rank &cLegend|| ||&fThe better rank you have,||&fthe better the rewards! Buy a||&frank on our &d&l/store&f!" to be unstealable

            if player has permission "dailyrewards.diamond":
                format slot 14 of player with glowing diamond named "&d&lDiamond Reward" with lore "&fRequires Rank &cPheo&4nix|| ||&fThe better rank you have,||&fthe better the rewards! Buy a||&frank on our &d&l/store&f!" to be unstealable
            else:
                format slot 14 of player with diamond named "&d&lDiamond Reward" with lore "&fRequires Rank &cPheo&4nix|| ||&fThe better rank you have,||&fthe better the rewards! Buy a||&frank on our &d&l/store&f!" to be unstealable

            if player has permission "dailyrewards.emerald":
                format slot 15 of player with glowing emerald named "&d&lEmerald Reward" with lore "&fRequires Rank &5Sparky&e⚡|| ||&fThe better rank you have,||&fthe better the rewards! Buy a||&frank on our &d&l/store&f!" to be unstealable
            else:
                format slot 15 of player with emerald named "&d&lEmerald Reward" with lore "&fRequires Rank &5Sparky&e⚡|| ||&fThe better rank you have,||&fthe better the rewards! Buy a||&frank on our &d&l/store&f!" to be unstealable

            if {defaultreward:%player%} is true:
                format slot 19 of player with powered minecart named "&d&lDefault Reward" with lore "&fRequires Rank &7Default|| ||&fDefault daily reward, Upgrade||&fyour rank by fighting bosses||&ffor by donating to the server|| ||&d&nRewards:&r|| &5&l⬦ &72x Common Charms|| ||&c&lOops! &fYou have already redeemed ||&fthis! come back in &d&l%{_sendtime:%player%}%&f to claim!" to close then run [reward(player, "default")]
            else:
                if {defaultreward:%player%} is false:
                    format slot 19 of player with storage minecart named "&d&lDefault Reward" with lore "&fRequires Rank &7Default|| ||&fDefault daily reward, Upgrade||&fyour rank by fighting bosses||&ffor by donating to the server|| ||&d&nRewards:&r|| &5&l⬦ &72x Common Charms|| ||&d&lClick&r&f to claim" to close then run [reward(player, "default")]
    My entire skript, would appericiate if u don't steal the way I've written the lores thanks!

    Well, the variables do not set at all! I can spam dailys over and over again and its VERY Frustrating,
    I've been trying to troubleshoot this from the past 40 minutes and all I've accomplished is wasting my time.
    please help me, identify the problem and if you're willing help fix the skript, thanks!
     
  2. 1) Variables that start with an underscore `{_something}` are called local variables. These variables are only available for use within the trigger they are created in. Ie: if they are created during 1 event, they are deleted at the end of that section and not carried on to other events/triggers

    2) there are 2 types of variables
    {regular.variables}
    and
    {list::variables}

    regular variables use a period and list variables use a double colon, im not exactly sure what you're doing here with the single colon in your variables.
     
    • Informative Informative x 1
  3. I do not recommend use of skquery's format slot, it's buggy, use vanilla GUIs instead. and I do not recommend setting variables to false, just delete them, less memory wasted
     
  4. My dumbass forgot about this, thanks.
    The reason I don't use vanilla GUIS because I'm make multiple same lore and item and name Items, but I want them to do different things
    and also cuz its a bit more work, they've been working fine for a few years now :)
     
  5. you can make them do different things by using "clicked slot" condition and you'll be able to also do much more with vanilla guis (click type checking, updating the gui on the spot) and you can also protect guis from item stealing, with which format slot is buggy (a smart player who knows how it works can duplicate its contents)

    also HOW DO YOU USE SKRIPT FOR FEW YEARS AND NOT KNOW WHAT LOCAL VARIABLES ARE? :eek:
     
    • Funny Funny x 1
  6. my dumbass forgot, I took a break for 3 months, guess I'm still rusty :ROFLMAO::ROFLMAO: