Closed TomLewis closed 1 year ago
Love it! Got to do after holidays (Monday)
Super, Im going to pre-make a ton of message early in anticipation haha
You could even include a bunch of pre-made timed messages/MOTD messages in your configs to explain how to use it for things like holidays!
I also thought it would be great to combine this with permissions! Another use case:
Love it! It's done, just make sure to stick with this syntax:
Could you be so nice and provide back some of the messages you create to give back to the community? I feel it would be an awesome addition and I of course will give you full credit! :)
Brilliant thanks! Will do!
Thought of something for the example I was making, there is no way to do "recurring" dates! So same time every year for example, because if I make an example for Christmas 2023, it wont work for christmas 2024! how did I not think of that until I was making the configs! haha
I guess at this point, its cron!
Im not sure the best way to do it, either, for begins and expires, if the user does not include a year, its a reoccuring date, or have a variable to say its reoccuring, but then if they set a year, that wont work, but what if people want it every tuesday at 1am?
You could follow the crontab system https://crontab.guru/#
Theres bound to be a standard for this.
I also thought, that if you had a date/time conditon you could use in-side formats, you could have 1 format you could use for many differnt dates! But its odd to mix Visuals formats with logic in the MVC logic.
Heres an example of the first set I am setting up:
Best thing to do here imo (and also probably the easiest one for both Kangarko and the users) is to use *
if you want to repeat an event every hour/day/month, just like cron expressions.
So either players would specify a date, or repeat using *
. If they somehow don't specify a year, just make it so it won't work. Simply add a note to wiki that says: stick with this syntax as kangarko did when he pushed this feature.
Btw @kangarko I just noticed you are using java.text.SimpleDateFormat
instead of java.time
, may I ask why? iirc java.time
is better for pretty much everything ^^
I can just add {CURRENT_X} where X can be MINUTE, HOUR, DAY, WEEK, MONTH, YEAR etc.
Would that work?
begins 22 Dec {CURRENT_YEAR}, 00:00 expires 24 Dec {CURRENT_YEAR}, 00:00
so it would work every year
Tbf, later today I can test these JavaScript variables I have made and make them public by making a pull request to add them by default
I will post examples of how these variables could be used to make a rule execute only during a specific day of the week, hour, month etc.
Right now I'm working on a university assignment but in a few hours I'll see if I can do some quick tests to make sure I haven't missed any errors (but there shouldn't be any errors)
The JavaScript variables I made for my own servers would work perfectly for reoccurring events etc. Give me a few hours and today sometime I'll make a pull request
begins 22 Dec {CURRENT_YEAR}, 00:00 expires 24 Dec {CURRENT_YEAR}, 00:00
so it would work every year
A placeholder would work, this should work for doing selections between months too, so I could target say summer holidays when the players are not at school.
Using {CURRENT_YEAR}
or whatever doesn't really seem intuitive for people, does it?
Using
{CURRENT_YEAR}
or whatever doesn't really seem intuitive for people, does it?
Yeah but its easy to program and add LOL and that gets it working at least for now?
I do always have to stop and think about Cron, as its in such a weird order.
I would personally suggest {EVERY_X} instead of {CURRENT_X}
As {EVERY_YEAR} makes more sense to me at least than {CURRENT_YEAR}
I'll make a pull request to add these variables I made | Variable Name | Description |
---|---|---|
{time_minutes} | Shows the minutes of the current time | |
{time_hours} | Shows the hours of the current time | |
{time_day} | Shows the calendar day | |
{time_month} | Shows the calendar month | |
{time_year} | Shows the calendar year | |
{time_weekday} | Shows the day of the week (monday, tuesday etc.) |
That way you could also do things like etc
# You can also run messages which are only shown during a specific time period
# In this example, the message is only shown on the 1st - 3rd of January
group new_years
delay 900 seconds
require receiver script {time_day} < 4 && {time_month} == 1
message:
- &aHappy New Years &fEveryone!
To start uses these variables just download them here and drop them into /plugins/ChatControlRed/variables
BUT using these variables in the script operators can be difficult for longer time periods!
So I would still strongly encourage the additional placeholder {EVERY_x} as it would definitely be a worthwhile addition!!
I have simplified this and added the following: https://github.com/kangarko/ChatControl-Red/wiki/Rules#begins-and-expires
Thanks to everyone for input!
I have simplified this and added the following: https://github.com/kangarko/ChatControl-Red/wiki/Rules#begins-and-expires
Thanks to everyone for input!
Thanks, this will work well, sorry I didnt think of it in the initial request! Its funny you only think of things when you go to implement them and be like, whoops forgot about this! haha
Variables will work great.
Yep, same happens to me! Thanks for the input!
Summary
You have an expire https://github.com/kangarko/ChatControl-Red/wiki/Messages#expires But there is no "begin" so we cant pre-make messages for the future!
So then we can set a start and end time for a timed message, not just when it expires.
What would happen if we didn't implement this feature? Why not having this feature is a problem?
Cant tell messages when to dispaly from, only expire.