AnnouncementSystem:
type: task
script:
- define prefix "&#FF0000[Minecraft Server] "
- define messages <list[
"&#FF5555Join our discord for help, giveaways, and so much more!",
"7FF55Do /menu to see our custom features!",
"ᖳFFFound a bug? Have a suggestion? Contact a staff member.",
"&#FFFF55Purchase something from our store to help support us!",
"&#FF55FFSign up for our forums to get support, appeal a punishment, and more!"
]>
- define index 1
- while true:
- foreach <server.online_players> as:player:
- if <player.flag[announcement_<[index]>].as_boolean> || <player.flag[all_announcements].as_boolean||false>:
- narrate "<[prefix]><[messages.get[<[index]>]>]" targets:<[player]> per_player
- if <[index]> >= <[messages].size>:
- define index 1
- else:
- define index <[index].add[1]>
- wait 1m
ToggleAnnouncementCommand:
type: command
name: toggleannouncement
script:
- if <context.args.is_empty>:
- narrate "Usage: /toggleannouncement [all/message_number]" color:red
- stop
- if <context.args.get[1]> == "all":
- if <player.flag[all_announcements]>:
- flag player all_announcements:!
- narrate "All announcements have been disabled." color:green
- else:
- flag player all_announcements:true
- narrate "All announcements have been enabled." color:green
- else:
- try:
- if <player.flag[announcement_<context.args.get[1]>]>:
- flag player announcement_<context.args.get[1]>:!
- narrate "Announcement #<context.args.get[1]> has been disabled." color:green
- else:
- flag player announcement_<context.args.get[1]>:true
- narrate "Announcement #<context.args.get[1]> has been enabled." color:green
catch:
- narrate "Invalid announcement number." color:red
[16:51:12 INFO]: +> [Static Tag Processing] Pre-Filled tag <&ns> with '#', and cached result.
[16:51:12 INFO]: +> [Static Tag Processing] Pre-Filled tag <list[ "&#FF5555Join our discord for help, giveaways, and so much more!", "7FF55Do /menu to see our custom features!", "ᖳFFFound a bug? Have a suggestion? Contact a staff member.", "&#FFFF55Purchase something from our store to help support us!",
"&#FF55FFSign up for our forums to get support, appeal a punishment, and more!" ]> with 'li@ "&#FF5555Join our discord for help, giveaways, and so much more!", "&#55FF55Do /menu to see our custom features!", "&#5555FFFound a bug? Have a suggestion? Contact a staff member.",
"&#FFFF55Purchase something from our store to help support us!", "&#FF55FFSign up for our forums to get support, appeal a punishment, and more!" |', and cached result.
[16:51:12 INFO]: +> [Static Tag Processing] Pre-Filled partial tag '<server...' with '(Base-Object)', and cached result.
[16:51:12 INFO]: ERROR in script 'announcementsystem' while executing command 'NARRATE' in file 'scripts/annoucements.dsc' on line '16'!
Error Message: (Initial detection) Tag processing failed: The tag '[messages.get<[index]>' is invalid due to misplaced [square brackets]. Did you forget to close some brackets?