variables

  • Variables: Debugging

    Debugging

    If you useDragonSpeak Constructor, you can review all your variables through theVariable Information dialog, available under theTools menu. ClickingRefresh will scan the lines of DS in the active section and summarize how many variables and strings that are in use, and where.

    This can help you know if you are over the limit for variables, or if you are using different variables across sections of your DS (remember, case sensitive)! You may find that you can consolidate variables that represent the same thing.

  • Variables: DragonSpeak Lines

    DragonSpeak Lines

    All of the DragonSpeak lines related to variables are listed here:

  • Variables: Intro


    Variables

    If you're not sure what variables are, there's a great overview and tutorial about them called Introduction to Variables. The following has more detailed information about them as a reference for you!

    Broadly speaking, variables are integer values that are represented by a string of text beginning with thesymbol %. For instance,%JoesHotdogs is a variable, and so is%amountofbones. Variables like these can be used almost anywhere in DS where a number is expected.

    Variables open up new possibilities in DS manipulation because they'redynamic. They can be used for multiple DS triggers as they are able to keep their values, or they could be used for grabbing data from the map or from a string or PhoenixSpeak entry (more on that later) without having to use DS triggers that scan for every possible range of values.

    Naming

    Variables are able to contain characters A-z (upper and lower case), 0-9, and underscores. They are case sensitive. For instance:

    %Test is not the same as %test

    %Test_variable is a valid name

  • Variables: Summary

    Summary

    To summarize, variables:

    • can replace numbers in almost all instances of DragonSpeak where a number is required in a line
    • are capable of storing integers (no decimal points) ranging from -32768 to +32767
    • are named by adding the % symbol before a string of text
      • Names are case sensitive, and can consist of letters A-z, 0-9, and underscores
    • can be reviewed from the Variable Information dialog
      • Dreams are limited to 500 unique variables
    • are capable of storing two integers each by appending .x or .y to the end of a variable name. This means in essence, a total of 1000 integers
  • Variables: The (5:301) DragonSpeak Line

    The (5:301) DragonSpeak Line

    There is a variable-related DS line that works a bit differently than one might expect, and it has a limitation that prevents it from working in certain circumstances:

      (5:301) copy the value of variable % into variable %.

    By default, this lets you copy both of a variable's values, including even unused .y values (it sets the receiving variable’s .y value to 0) into another variable, like this:

      (5:301) copy the value of variable %var1 into variable %var2.

    Using.x and.y in the first space works, but if you use it in the second space, it will cause unexpected behavior to occur. Here's how it works correctly:

      (5:301) copy the value of variable %var1.x into variable %var2.
      (5:301) copy the value of variable %var1.y into variable %var2.

    But what if you need to copy .y of the first variable into .x of the second variable? Though it won't work with (5:301), you can work around this with (5:300). Here's an example:

      (5:300) set variable %var2.y to the value %var1.x.
    (5:300) set variable %var2.x to the value %var1.y.

    The line(5:384) may also be useful here. Here’s an example:

      (5:384) set variable %var2 to the x,y position (%var1.y, %var1.x).

Account E-Mail

Password