Templates
Overview
Channels can be created for different types of in-game events and activities. By default, channels can only be managed by the developer. To enable players to manage a channel, it is necessary for each channel to create a template. For example, a group can have a group channel template of 4 people, a guild can have a group channel template of 20 people, and so on.
The player cannot create a channel without a pre-made template. This is necessary for the developer to control the rights of the player
Templates make it easy to create channels of the same type. Based on channels, you can implement an extremely wide functionality of chats, guilds, a list of friends, activity feeds, gifts, turn-based battles, lobbies, rooms, groups, and so on. For each type of such a channel, it is convenient to have a pre-configured standard template.
Create templates of channels for the main game events and activities
Create a Template
To create a template, select Channels - Add Template in the control panel:
When creating a channel template, you can edit the following fields:
Leaving the default settings will create a template for player chat
Field name | Comments |
---|---|
📝 Channel template tag | The tag is used to make it easier for the player to find the in-game event for which the template has been created |
📝 Channel tags | For example, a dungeon party might have a template with the dungeon tag. For details, see Channel and Message Tags |
📝 Messages tags | Message tags allow you to display logs or specified types of messages in a chat. For example, all messages with log tags can return information about completing a level. For details, see Channel and Message Tags |
📝 Name | Clicking on the Edit translations button opens the entire list of languages available for translation |
📝 Description | Clicking on the Edit translations button opens the entire list of languages available for translation |
📝 Maximum number of channel members | Integer, maximum number of channel members is unlimited |
📝 Password | By default, the channel is created without a password |
🔘 Private | Allows you to join the channel only through a request or invite |
🔘 Keep history | Allows you to store your message history (only available on subscription plans). By default, messages are stored for 24 hours |
🔘 Visible in search | Shows the channel in the search results |
🔘 Visible only in test version 💡 | The channel is not visible to players in the production version |
🔘 Leave the channel when he leaves the game | |
🔘 Delete channel when last member leaves | |
🔘 Permissions for the player - owner to edit channel options | By default, channel owner can edit: title, description, tags, change owner, channel capacity, privacy, visibility, owner ACL, guest ACL |
🔘 Owner, member, guest access | For a complete list of permissions and their default values, see table |
💡 The purpose of the Visible in Test Only property is to hide new channels that are in development from players. For example, a developer adds a new location to the game, and so that it does not appear in the list of players, he marks it as visible only in the test version. While development is underway, this channel can be viewed on behalf of a test player
Template Usage Example
Often developers implement a joint battle of players in groups. Consider an example of creating and using a template for a group of players.
Creating templates for groups, raids or guilds is done according to the same principle
As an example, let's create a channel template for a group of five players. To do this, in the SpellSync control panel, go to Channels - Add template. On the template editing page, fill in the basic information about the template:
- Channel template tag:
party5
- Channel tags:
members
,party
- Message tags:
log
- Name:
party_5
- Description:
group for hikes and raids
- Maximum number of channel members:
5
- Other settings leave the default:
The created template can be edited at any time
Below is an example of creating a channel on behalf of a player using the template template: 'party_5'
. Potential members are invited to the channel ss.channels.sendInvite
:
- JavaScript
- Unity
const channel = await ss.channels.createChannel({ template: 'party_5' })
ss.channels.sendInvite({ channelId: channel.id, playerId: 123456 })
ss.channels.sendInvite({ channelId: channel.id, playerId: 123457 })
ss.channels.sendInvite({ channelId: channel.id, playerId: 123458 })
ss.channels.sendInvite({ channelId: channel.id, playerId: 123459 })
ss.channels.sendMessage({ channelId: channel.id, text: 'Waiting 5 min and go' })
// subscribe to event
private void OnEnable()
{
SS_Channels.OnCreateChannel += OnCreateChannel;
}
// unsubscribe from event
private void OnDisable()
{
SS_Channels.OnCreateChannel -= OnCreateChannel;
}
public void Create()
{
var filter = new CreateChannelFilter(5);
filter.name = "party_5";
filter.visible = true;
SS_Channels.CreateChannel(filter);
}
private void OnCreateChannel(CreateChannelData data)
{
SS_Channels.SendInvite(channel_ID: data.id, player_ID: 123456);
SS_Channels.SendInvite(channel_ID: data.id, player_ID: 123457);
SS_Channels.SendInvite(channel_ID: data.id, player_ID: 123458);
SS_Channels.SendInvite(channel_ID: data.id, player_ID: 123459);
SS_Channels.SendMessage(channel_ID: data.id, text: "Waiting 5 min and go");
}
To get player IDs, see the Members section
Stay in Touch
Other documents of this chapter available Here. To get started, welcome to the Tutorials chapter.
SpellSync Community Telegram
: @spellsync.
For your suggestions e-mail
: [email protected]
We Wish you Success!