Ways to use $ with dynamic text

You can also use $ to substitute the names of the elements with a variable, a string or a special text replacement string. This way you can capture lots of moving information and match it with your Dream's database! Check out the following tutorials to see this in depth.

Tutorial 5: Partial substitution example

There are many valid reasons to use substitution in DS, as it can be useful for many things. For starters, you could do something as simple as giving an item number a description in your Dream through PS. The description could post to a player when they bump into it (The PS entry may look like this {%item_bumped description} = 'This is my description!').

You can also use substitution for something like when NPCs change locations. You could, in this situation, add coordinate prefixes to the NPC's PS info (for example {%npc_location.x %npc_location.y Health}).

In the NPC example, we're using %npc_location as a variable to dynamically grab data from PS info (this is partial substitution), based on the coordinate of the map. This is done instead of checking all the locations of the map by hard coding each possible tile in the Dream. (And in any case, this wouldn't be possible anyway, as a 200x200 map has ~40k tiles alone, which is way beyond DS line limitation).

Imagine if you had to write DS to detect all possible coordinates and items in your Dream! The example below will show you how to use partial substitution in a similar manner as the examples above.


We will take a look back at the trigger for finding the nickname of the player named Joey:

(0:31) When someone says {Joey's Nickname},

(5:200) emit message {Joey's nickname is: $character.Joey.nickname} to the triggering furre.

This is pretty good in and of itself, we are saving an entire 2 DragonSpeak lines as well as a string by choosing this method, but this trigger only really works for finding Joey’s nickname. What if we wanted to make a command that allowed us to find the nickname of any player, just by saying their name?

We can do this by replacing the rowname element of the $ address with the [PARAM1] special text replacement string:

(0:32) When someone says something with {@Nickname } in it,

(5:200) emit message {[PARAM1]'s nickname is: $character.[PARAM1].nickname} to the triggering furre.

If we were to use this command:

@Nickname Joey

The trigger would emit the following text:

Joey’s nickname is: Sneaky One

For another example, let's say we have stored the names of the 5 most contributive or helpful players that have visited our Dream since its inception. We have stored them within the Dream PS entries called SpecialFurre1, SpecialFurre2, SpecialFurre3, SpecialFurre4 and, SpecialFurre5.

All of the names of those PS entries share the SpecialFurre text in common, however, the number at the end of each one is different for every one of them. We could create a different trigger for accessing each of them (but this is not very efficient).. or we could instead use total substitution like we did for the @Nickname command above. But, even better, using partial text substitution is ideal for this situation.

We can achieve this by replacing the entryname parameter partially to SpecialFurre, but appending a variable at the end. This is what we will actually capture with our command, and it will point to a different SpecialFurre entry depending on the number we use with the command. In total, the trigger would look like the following:

(0:32) When someone says something with {@SpecialFurre } in it,

(5:314) set variable %SF to the number the triggering furre just said or emoted.

(5:200) emit message {The name of the Number %SF Special Furre is: $dream.SpecialFurre%SF} to the triggering furre.

Thus, if the name of the special furre #3 is Joey, and if we were to use the this command in the following manner:

@SpecialFurre 3

The trigger would emit the following text:

The name of the Number 3 Special Furre is: Joey

Account E-Mail

Password