#Can someone fix this?

1 messages · Page 1 of 1 (latest)

stable roost
#

I have this skript and i want that a player can claim a pressent once a day (reset at midnight) but this one does not work..

options:
    present_item: 10 diamond, 20 iron ingot, 15 gold ingot, 5 emerald, 30 coal, cake, 16 cookie, pumpkin pie, mushroom stew, rabbit stew, beetroot stew

on right click on villager:
    if display name of event-entity is not "Test":
        stop
    if display name of event-entity is "Test":
        cancel event
        set {_current_day} to "%now expanded to ""D""%"
        set {_current_year} to "%now expanded to ""yyyy""%"
        set {_unique_day_key} to "%{_current_year}%%{_current_day}%"
    if {villager_present.%player%.%{_unique_day_key}%} is set:
        send "&cYou've already claimed your present for today. Try again tomorrow" to player
        stop
    else:
        set {_random_item} to a random element out of {@present_item}
        give 1 of {_random_item} to the player
        send "&aYou have received your daily present!" to player
        set {villager_present.%player%.%{_unique_day_key} to true
main turtle
#

also use list variables

stable roost
#

what do you mean? this is the error that i get..

main turtle
#

okay so yes, that help. You need to provide context. instead of just saying 'my code no workie', which could mean a whole lot of things

main turtle
#

the other 2 errors are just made-up syntax

stable roost
#

i fixed 1 of the errors only line 9 and 10 are the problem now

#

so how can i fix it that every player can claim once a day and that it resets every midnight

brittle plaza
#

now formatted as "dd" would be the day in number format

#

now formatted as "yyyy" is the four-digit year

stable roost
#

do i have to change to "%now..." to "to dd"?

brittle plaza
#

no. what i sent is already text, so no need to put it in quotes

#

set {_d} to now formatted as "dd"