SPECIAL VARIABLES

From AddictHelp
Revision as of 10:55, 20 November 2008 by Kahlan (talk | contribs) (New page: For details on how to use variables, please see the schelp for VARIABLES. Special variables are as follows: ================================= self - the mob, item, or room running the scr...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

For details on how to use variables, please see the schelp for VARIABLES.

Special variables are as follows:

=====================

self - the mob, item, or room running the script. Normal fields may also

      be used.

random - This variable returns a number between 1 and the field value.

      For example, %random.10% would be a value between 1 and 10.
      Also, for random, there is an option for %random.char% that will
      return a random character in the room the script is being run in.

people - this variable returns a random person in a room vnum that you

      specify.  i.e. %people.3001% will return a random person sitting
      in room 3001.

Special Notes on any variable that is a string (not a number). They have 6 special abilities to allow you to efficiently handle strings.

1. First, you can retrieve the length of a string by using:

      %somestring.strlen%

2. You can see if a string contains another string by doing:

      %somestring.contains(searchstring)%

3. If you want to make sure there are no blank spaces at the front or end

   of the string, you can remove them by doing:
      set newstring %somestring.trim%

4. If you want to know if a string is the abbreviation of another string

   you can check by doing:
      if (%somestring.isabbrev(north)%)
        ...
      end

5. If you need just the first word in a sentence, you can retrieve it by

   doing:
      set oneword %somestring.car%

6. And finally, to get a string, without the first word, you would do:

      set setstring %somestring.cdr%