String DS

Introduction

Strings are a powerful dreamweaving tool that allows for the capture and manipulation of text in your dream. Some of the most common uses for this would be to allow you to construct a message board for your Dream, or easily add names to a high score list, all without having to reupload your dream!

Strings enable you to set up:

  • on the fly sign editing
  • word games like Mad Libs
  • suggestion or comment boxes
  • chat amplification for stages or RP so that off-screen players can hear
  • chat logging to preserve RP or meeting logs for offline players
  • forms for commissions, job applications, wanted ads, etc.
  • dynamic character sheets for RP
  • verbal passwords for quests or locks
  • dynamic Dream announcements
  • player lists for Dream share, access permissions, etc.

So how does String DS work? String DS manipulates text in a similar fashion to the way variables manipulate numbers. If you're not familiar with variables, you might want to read over the Introduction to Variables tutorial before broaching the following Strings tutorials, as it teaches a lot of the basic theory.

So, how do we make some text represent a string in DragonSpeak? You can make a string out of any text or numbers (except for underscores) by beginning the text with the tilde symbol ~. For instance, ~message is a string and so is ~sharedPlayers or ~dooDadsaboogle.

Table of Contents


Tutorial 1: A message board

To begin, we'll create a special spellbook for our Dream allowing us to attach a message onto it. Other players can then read the message by using the "Read Message" magical word!

(0:30) When someone says anything,
(1:18) and the triggering player (moved from/is standing at) item 358,
(5:255) set message ~MagicMessage to what the triggering player just said or emoted.

(0:31) When someone says {Read Message},
(5:200) emit message {~MagicMessage} to the triggering player.

In the first trigger the cause will happen as long as the player has said (but not emoted) anything. Meanwhile, the (1:18) line ensures that the player in question is standing on top of the Magical Spellbook item (Item 158).

And finally we get to our first encounter with a string with the (5:255) effect! As we discussed before, strings are similar to variables in that they capture data. The main difference, though is that they can also capture text rather than just numbers! So in this line, we are capturing the all of what the player just said, and then repeating that message out loud by mentioning the string's name: ~MagicMessage.

So, for example, if a player said:

You say: I hope everyone has a spellbindingly good day!

while standing on the Magical Spellbook item, the string called ~MagicMessage would then match that text: I hope everyone has a spellbindingly good day!

Now that we know what the first trigger does, we can take a look at the second trigger, particularly at the (5:200) line. When someone says the magic word (Read Message), the contents of the ~MagicMessage string will be repeated to them!

Tutorial 2: Playing with text

For the second tutorial, we'll create a fun script to translate anything that a player says into backwards text, as long as they are holding the mysteriously haunted Pookie (Item 53).

(0:30) When someone says anything,
(1:1002) and they are holding item 53,
(5:255) set message ~BackwardsPookie to what the triggering player just said or emoted.
(5:256) reverse message ~BackwardsPookie from forwards to backwards.
(5:200) emit message {Pookie says: ~BackwardsPookie} to the triggering player.

This all works similar to the previous tutorial! Where it changed up a bit is the (5:256) line. So, what would happen here if we are holding a Pookie (Item 53) and we just said:

You say: This is a fine day to speak backwards!

First, (5:255) would set the ~BackwardsPookie string to: This is a fine day to speak backwards!

But then, the next effect, (5:256) will make our the ~BackwardsPookie string backwards: !sdrawkcab kaeps ot yad enif a si sihT

And then, after all these changes, the (5:200) line would emit the following:

[♦] Pookie says: !sdrawkcab kaeps ot yad enif a si sihT

Tutorial 3: Dynamically control who has share in your Dream

For the last tutorial, we'll use strings to first make a list of furres, and then give them share in our Dream:

(0:0) When everything is starting up,
(5:250) set message ~ShareList to { JaneKitten Joe|Foxypaws Jake }.

(0:9) When someone arrives in the Dream,
(1:75) and message ~ShareList contains { [FURRE] } somewhere within it,
(5:102) share Dream control with the triggering player.

First we have the (0:0) line, which is a cause that only happens one time: the moment that a Dream is first uploaded, followed by the effect which has our first mention of a string in (5:250).


Currently the ~ShareList string is being set manually in our DS to contain the following:

JaneKitten Joe|Foxypaws Jake

So our staff members are JaneKitten, Joe Foxypaws, and Jake. If you look at the original DS line, notice that a space was intentionally included at both the beginning and the end of the ~ShareList string, and around [FURRE] in the next trigger. Furcadia technically always swaps out spaces to be the pipe symbol (this one | is a pipe symbol). Since spaces can't be truly part of a character's name, this makes sure we're giving share to the right person.

In other words: if we looked only for [FURRE] without the spaces at the beginning at the end, a furre named JakeFoxypaws or a furre named 01Jake would both be able to receive share, since Jake is part of both of those names.

Even though currently the ~ShareList string contains the names of only three staff members, we can add more any time we wish in our Dream! For example, if we wanted to add John to our share list, it would look like this:

  (5:250) set message ~ShareList to { JaneKitten Joe|Foxypaws Jake John }.

Finally, the share-giving part occurs within the second trigger. When someone arrives in the Dream, we add a condition with the (1:75) line. This condition uses a special text replacement keyword called [FURRE] which reflects whoever set off the trigger. So if a player named Jake arrived into the Dream, [FURRE] would be equivalent to Jake. If this arriving player's name is found in the ~ShareList string, then they get share!


Hopefully now that you've been through some of these tutorials you have a better grasp on how to use String DS in your own Dream! If you'd like to see advanced uses and a full spec about String DS, you can read over the Advanced DragonSpeak Reference page for more.

DragonSpeak is a wonderful way to add magic and life to your Dreams, so feel free to explore and try new things with your own ideas. If you have any further questions about it, feel free to contact the Beekins in game by saying help I need a mason!

Account E-Mail

Password