![]() |
|
defstr |
Longname: | def ine str ing | ![]() |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Released: | not available | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Created: | not available | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
See also: | addstr |
Summary |
Defines a new 3B2 string, or copies the contents of one string into a new string |
Example extract |
The example below shows a simple use of the ^wdb variable, along with ? macros, in a stripped down version of the script used in stuk.3ad to define the search/replace dialogue box.
|
Syntax
|
string:s first_line:s extract:n ?
string:s old_string:s
|
string:s |
The new string number to be defined or replaced by the contents of string2. There are cirtain string numbers available to users please refer to the stuk.3ad and Scripts chapter_en and the information below for more detail. |
first_line:s |
The characters to be included in the first line of the string, if any. |
extract:n |
|
string:s |
The (new) string to be defined or replaced by the contents of string2. |
old_string:s |
The (old) string being copied. |
Most readers will be aware of the existence of the 3B2 strings file (stuk.3ad on normal UK systems). This contains all of 3B2's language-dependent strings and other user configurable strings. These strings define such things as 3B2's menus and dialogue boxes. By using defstr and addstr to define your own strings, you can either overwrite existing strings or define new strings, usually in order to describe menus and dialogue boxes from within a script. |
Each string is known to 3B2 by a number. Certain ranges of numbers have been allocated as follows, and you will normally be interested in the range 350..399 (see last section of stuk.3ad for additional user definable string numbers). You can define your own new strings within this range without any danger of clashing with current or future versions of 3B2. |
If you have used a user strings file (usually suser.3ad) to create new strings within the range 350. . .399 you must take care not to overwrite them from scripts within your documents. We suggest that scripts in a user file use strings 350..379 and scripts internal to a document use strings 380. . .389. Strings 390..399 are best reserved for 'temporary' user strings, i.e. those defined within a particular script which can be over-written by other scripts which are run on different occasions. |
You can check if a string is non-empty by using getvar with a code of 31nnn, where nnn is the string number. This will get up to 80 characters from a string into a variable. If the string is empty the variable returned using getvar will be emptied of any contents that it had before getvar was run. |
Example |
This example copies the content of string number 1007 to string number 390.
|
Example |
The simple example below uses getvar to determine the current operating mode and, depending on what it is, defines string no.390 with a macro that could appropriately be assigned to the keystroke +.
|
Document created on 2-Apr-2003 (revision 001)