Difference between revisions of "FURWARE text/Reference"

From Second Life Wiki
Jump to navigation Jump to search
m
m
Line 1: Line 1:
{{KBwarning|This page is currently under construction. Please do not edit this page yet.}}
{{Multi-lang}}




Line 19: Line 19:
Each "'''BoxSpec'''" can have different forms to select different boxes. In the following table, let "BoxOne" and "BoxTwo" be two valid box names in the same display set:
Each "'''BoxSpec'''" can have different forms to select different boxes. In the following table, let "BoxOne" and "BoxTwo" be two valid box names in the same display set:


{| {{KBtable}}
{|{{Prettytable}}
 
|- {{KBtablehead}}
! BoxSpec
! BoxSpec
! Meaning
! Meaning
|-
|-
| (empty)
| (empty)
| All boxes in all sets.
| All boxes in all sets.
|-
|-
| BoxOne
| BoxOne
| Only the box "BoxOne".
| Only the box "BoxOne".
|-
|-
| BoxOne ; BoxTwo
| BoxOne ; BoxTwo
| All Boxes between* (and including) "BoxOne" and "BoxTwo".
| All Boxes between* (and including) "BoxOne" and "BoxTwo".
|-
|-
| BoxOne ;
| BoxOne ;
| "BoxOne" and all following* boxes in the same display set.
| "BoxOne" and all following* boxes in the same display set.
|-
|-
| ; BoxTwo
| ; BoxTwo
Line 151: Line 144:
In the following table: ''Italic'' = Default
In the following table: ''Italic'' = Default


{| {{KBtable}}
{|{{Prettytable}}
|- {{KBtablehead}}
! Setting
! Setting
! Key
! Key
! Values
! Values
! Description
! Description
|-
|-
| Font color
| Font color
Line 163: Line 154:
| R,G,B
| R,G,B
| Font color as red, green, blue (each in range 0.0-1.0)
| Font color as red, green, blue (each in range 0.0-1.0)
|-
|-
|
|
Line 169: Line 159:
| R,G,B,A
| R,G,B,A
| Font color as red, green, blue, alpha (each in range 0.0-1.0)
| Font color as red, green, blue, alpha (each in range 0.0-1.0)
|-
|-
|
|
Line 175: Line 164:
| rand
| rand
| Random color (with alpha = 1)
| Random color (with alpha = 1)
|-
|-
|
|
Line 181: Line 169:
| (predefined)
| (predefined)
| Predefined color, see table below
| Predefined color, see table below
|-
|-
| Alignment
| Alignment
Line 187: Line 174:
| ''left''
| ''left''
| Alignment left
| Alignment left
|-
|-
|
|
Line 193: Line 179:
| center
| center
| Alignment centered
| Alignment centered
|-
|-
|
|
Line 199: Line 184:
| right
| right
| Alignment right
| Alignment right
|-
|-
| Wrapping
| Wrapping
Line 205: Line 189:
| ''word''
| ''word''
| Wrap after words, if possible
| Wrap after words, if possible
|-
|-
|
|
Line 211: Line 194:
| char
| char
| Wrap at any position
| Wrap at any position
|-
|-
|
|
Line 217: Line 199:
| none
| none
| No wrapping; cuts overlong lines
| No wrapping; cuts overlong lines
|-
|-
| Trimming
| Trimming
Line 223: Line 204:
| ''on''
| ''on''
| Trims whitespace from beginning and end of lines
| Trims whitespace from beginning and end of lines
|-
|-
|
|
Line 229: Line 209:
| off
| off
| Keeps whitespace (except with wrap=word)
| Keeps whitespace (except with wrap=word)
|-
|-
| Font
| Font
Line 235: Line 214:
| (UUID/name)
| (UUID/name)
| Sets the font texture to UUID or name
| Sets the font texture to UUID or name
|-
|-
| Borders
| Borders
Line 241: Line 219:
| {trblTRBL12}
| {trblTRBL12}
| Specifies the style of box borders
| Specifies the style of box borders
|-
|-
| Style template
| Style template
Line 247: Line 224:
| (Style name)
| (Style name)
| Uses a style defined using fw_var
| Uses a style defined using fw_var
|-
|-
| Inline styles
| Inline styles
Line 253: Line 229:
| ''on''
| ''on''
| Enables usage of inline styles
| Enables usage of inline styles
|-
|-
|
|
Line 259: Line 234:
| off
| off
| Disables usage of inline styles
| Disables usage of inline styles
|-
|-
| Force refresh
| Force refresh
Line 265: Line 239:
| on
| on
| Enables forced refresh of all faces (disables optimizations!)
| Enables forced refresh of all faces (disables optimizations!)
|-
|-
|
|
Line 271: Line 244:
| ''off''
| ''off''
| Disables forced refresh of all faces (enables optimizations)
| Disables forced refresh of all faces (enables optimizations)
|}
|}



Revision as of 14:06, 8 July 2013


Reference manual

This chapter is meant to be a quick overview of pretty much everything necessary to use FURWARE text, especially which names and parameters go where. It is not meant to replace the tutorial in any way.

Commands

fw_data & fw_conf

Per-box settings for text (fw_data) and style (fw_conf)

<lsl> llMessageLinked(LINK_SET, 0, "Some new text", "fw_data : BoxSpec : BoxSpec : BoxSpec : ..."); llMessageLinked(LINK_SET, 0, "c=red; a=center", "fw_conf : BoxSpec : BoxSpec : BoxSpec : ..."); </lsl>

Each "BoxSpec" can have different forms to select different boxes. In the following table, let "BoxOne" and "BoxTwo" be two valid box names in the same display set:

BoxSpec Meaning
(empty) All boxes in all sets.
BoxOne Only the box "BoxOne".
BoxOne ; BoxTwo All Boxes between* (and including) "BoxOne" and "BoxTwo".
BoxOne ; "BoxOne" and all following* boxes in the same display set.
; BoxTwo "BoxTwo" and all preceding* boxes in the same display set.

(*) Depending on the order in which the boxes were added.

fw_defaultconf

Sets global style preferences

<lsl> llMessageLinked(LINK_SET, 0, "c=red; a=center", "fw_defaultconf"); llMessageLinked(LINK_SET, 0, "c=red; a=center", "fw_defaultconf : root"); llMessageLinked(LINK_SET, 0, "c=red; a=center", "fw_defaultconf : nonroot"); </lsl>

The three variants set the global style preferences for all boxes, all root-boxes and all non-root boxes.

fw_var

Store some string data in a "variable" name. Currently only used for style templates.

<lsl> llMessageLinked(LINK_SET, 0, "Some string", "fw_var : varName"); </lsl>

Sets the contents of variable "varName" to "Some string". You can delete variables by passing the empty string as data.

fw_addbox

Adds a new virtual text box. There can be at most 16 boxes per set (including the root box).

<lsl> llMessageLinked(LINK_SET, 0, "Some initial text", "fw_addbox : boxName : parentName : dx, dy, sx, sy : stylePrefs"); </lsl>

Please see the tutorial for details.

fw_delbox

Deletes one or more text boxes.

<lsl> llMessageLinked(LINK_SET, 0, "", "fw_delbox : boxOne : boxTwo : ..."); </lsl>

Deletes the boxes named "boxOne", "boxTwo", etc.

fw_touchquery

Performs a query which box has been touched where.

<lsl> llMessageLinked(LINK_SET, 0, "userData", "fw_touchquery : linkNumber : faceNumber"); </lsl>

The reply has the form (pseudo code):

<lsl> link_message(..., ..., "boxName:dx:dy:rootName:x:y:userData", "fw_touchreply") {

   ...

} </lsl>

Please see the tutorial for details.

fw_notify

Enable or disable link message notifications when the script has done rendering. Off by default.

<lsl> llMessageLinked(LINK_SET, 0, "on", "fw_notify"); llMessageLinked(LINK_SET, 0, "off", "fw_notify"); </lsl>

When notifications are enabled, the text script will send a link message with "id" set to "fw_done" to the whole linkset to let you know when all pending rendering actions have been completed.

fw_memory

Tells the owner how much memory is available.

<lsl> llMessageLinked(LINK_SET, 0, "", "fw_memory"); </lsl>

fw_reset

Performs a full reset on the text script.

<lsl> llMessageLinked(LINK_SET, 0, "", "fw_reset"); </lsl>

KBtip2.png Tip: When the reset has completed, the script sends a link message with "id" set to "fw_ready" to all prims in the linkset. This tells you when the script is ready to take further commands.


KBcaution.png Important: Only reset the text script if necessary. Initialization is a quite expensive operation and the script will not be available to take commands for a few seconds.

Style settings

Text styles and format settings are specified using special strings. They are used for global and per-box settings ("fw_conf") as well as for specifying styles directly within the text (inline styles).

A single setting is given as a key=value pair, for example c=red.

Multiple settings are separated by ";", for example c=red; a=center; w=none.

In the following table: Italic = Default

Setting Key Values Description
Font color c R,G,B Font color as red, green, blue (each in range 0.0-1.0)
R,G,B,A Font color as red, green, blue, alpha (each in range 0.0-1.0)
rand Random color (with alpha = 1)
(predefined) Predefined color, see table below
Alignment a left Alignment left
center Alignment centered
right Alignment right
Wrapping w word Wrap after words, if possible
char Wrap at any position
none No wrapping; cuts overlong lines
Trimming t on Trims whitespace from beginning and end of lines
off Keeps whitespace (except with wrap=word)
Font f (UUID/name) Sets the font texture to UUID or name
Borders border {trblTRBL12} Specifies the style of box borders
Style template style (Style name) Uses a style defined using fw_var
Inline styles tags on Enables usage of inline styles
off Disables usage of inline styles
Force refresh force on Enables forced refresh of all faces (disables optimizations!)
off Disables forced refresh of all faces (enables optimizations)

Predefined colors

You may use the following names in place of color vectors in styles.


FURWARE text colors.png


Fonts

You can use the fonts listed here with the "f=..." style setting either by using their UUID or by putting the corresponding texture item (included in the FURWARE text package) into your object and then use the texture's name.


FURWARE text fonts.png


Version history

2.0

  • Made the script open source under the MIT license.

2.0-Beta1

  • The functionality of "fw_data" and "fw_conf" has been reworked to (hopefully) make it more intuitive.
  • The commands "fw_data", "fw_conf", and "fw_delbox" are now able to modify multiple boxes at once.
  • Added "fw_defaultconf" command. Currently used to configure global style settings.
  • Touch replies now also contain the name of the root box and the absolute coordinates.
  • Added "force" style attribute to force refresh of all faces (useful for fonts where whitespace is not completely transparent).
  • Optimized handling when multiple "similar" commands (e.g. "fw_delbox") come in quickly.

2.0-Beta0

  • Mesh prims with up to 8 characters per prim, each occupying 0.5 prims
  • Virtual text boxes for aligning text arbitrarily
  • Style templates for saving format settings

1.1

  • The developer version now allows distribution of the script as +copy/-trans or -copy/+trans

1.0.1

  • Improved speed

1.0

  • First released version