Practical script - Server advertisement

Aim of the script

Let's make a script which will send customized broadcasts advertising. This will use the Broadcast and Wait methods to control the timing and content of advertisements.

Let's make a script called ad.txt and get to work!

# broadcast 1: thanking for playing on our server
# broadcast 2: "check out our github" or smth
# broadcast 3: "consider donating" ad for the moneys 🤑
# we also want to have a 2s gap between broadcasts for more ✨ finesse ✨

It's useful to write down what do we want to achieve with a given script.

Styling

First broadcast should look something like this:

Broadcast * 7s "Thank you for playing on Script Mania! Enjoy your stay!"

Which in turn looks something like this:

But we can do better! Using https://docs.unity3d.com/Packages/com.unity.textmeshpro@4.0/manual/RichTextSupportedTags.html, we can use custom tags to spice up our broadcast like so:

Composing the rest

For the sake of this tutorial, we will be using discord.gg/3j54zBnbbD and ko-fi.com/elektrykandrzej as placeholders. You should replace the contents of all broadcasts with what you want instead.

Using the same principles, we can add the 2nd:

And the 3rd broadcast:

Final result

Now you've created a complete advertising script!

Last updated