Opinion and info request

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

Status
Not open for further replies.

swaith

Supporter
May 4, 2021
23
1
3
34
Good afternoon,

I am trying to write a skript that will enable an item (for the example I am using quartz ore, but I believe it will end up as a custom item.) to be provided to a player as a reward for playtime.

I want it only to deliver after 24 hours since it was last awarded to the player and further with a requirement to have been playing for at least an hour prior to delivery.

I wrote it with the understanding that skript timers get reset after server restart so periodical was not suitable due to the 24 hours requirement - and based on that I wanted it to record time last used, and then compare it to current date/time and if greater then 24 hours (1 day) it will issue the item again. I understand that the way it is written will log the time into a list of some sort.

My concern is that the parser throws up multiple errors:

""
Line 4: Can't understand this condition: '{_waited.%uuid of player%} is < 1 day' (script.sk, line 4: if {_waited.%uuid of player%} is < 1 day:')

Line 7: Can't understand this condition/effect: if player has enough space for "%arg 1& of quartz ore" (line 7: if player has enough space for "%arg 1& of quartz ore"') (The Parser doesn't support every syntax element.)

Line 8: Can't understand this condition: 'player has not enough space for "%arg 1& of quartze ore"' (script.sk, line 8: else if player has not enough space for "%arg 1& of quartze ore":')""

However, on searching the forums I have found instances of both of these functions recommended to be used for similar projects.

I have yet to run this, and I have more functions I want to write into it, but I thought best to ask the community first if there already was an established way to track/run this type of system that I may have missed in my search, it is my first time trying this so forgive me any mistakes as I am trying to learn as I go.

Any tips would be appreciated.



Script Version (do not put latest): 2.5.3
Script Author: ??? (Me?)
Minecraft Version: 1.16.5
Full Code:

  1. on join:
    if player has permission "{skript.exp}":
    set {_waited.%uuid of player%} to difference between {exp.%player%.lastused} and now
    if {_waited.%uuid of player%} is < 1 day:
    message "You have to wait %difference between a day {_waited}% before you can use this command again!"
    stop
    if player has enough space for "%arg 1& of quartz ore"
    else if player has not enough space for "%arg 1& of quartze ore":
    message "You do not have enough space in your inventory to hold the token!"
    stop
    Wait 1 Hour
    give quartz ore to the player
    set {exp.%player%.lastused} to now


Errors on Reload:
Not yet tested

Console Errors: (if applicable)
Not yet tested


Other Useful Info:
N/A

Addons using (including versions):
N/A (as far as I am aware)

Troubleshooting:

Have you tried searching the docs? yes
Have you tried searching the Forums? Yes (which helped format it as it is above)
What other methods have you tried to fix it?
N/A
[doublepost=1620393008,1620307407][/doublepost]I got it parsing with


options:
cooldown: 24 hours

on join:
if player has permission "{skript.exp}":
set {_waited} to difference between {exp::%uuid of player%} and now
if {_waited} is less than {@cooldown}:
message "You need more training!"
stop
Wait 1 Hour
if player doesn't have enough space for 1 quartz ore:
message "You do not have enough space in your inventory to hold the token!"
stop
else:
message "You have earned an experience token"
stop
give quartz ore to the player
set {exp::%uuid of player%} to now
 
Status
Not open for further replies.