CAOS-Programmierung: Befehlsgruppen: Compounds

Aus Wikibooks

Compounds

FCUS (command)

Set keyboard focus to the current PART of the targetted agent. The part should be a PAT: TEXT. If you TARG NULL first, then no part will have the  
focus.

FRMT (command) left_margin (integer) top_margin (integer) right_margin (integer) bottom_margin (integer) line_spacing (integer) character_spacing (integer) justification (integer)

Use this command to alter the appearance of the current text part. The line and character spacing values are expressed in number of extra pixels to 
insert between characters. Values for justification are 0 - Left, 1 - Right, 2 - Center, 4 - Bottom, 8 - Middle, 16 - Last Page Scroll (if you add  
extra text to the part and show the last page, it will scroll upwards). You may add mutually compatible numbers. The default format values are 8 8 8 8 0 0 0.

GRPL (command) red (integer) green (integer) blue (integer) min_y (float) max_y (float)

Add a line to a graph (previously created with PAT: GRPH). The first line you add will be line 0.

GRPV (command) line_index (integer) value (float)

Add a value to a line on a graph. after you have added a value to each line on the graph, it will be updated by scrolling the current values to the 
left

NEW: COMP (command) family (integer) genus (integer) species (integer) sprite_file (string) image_count (integer) first_image (integer) plane (integer)

Create a new compound agent. The sprite file is for the first part, which is made automatically. Similarly, image_count and first_image are for that  
first part. The plane is the absolute plane of part 1 - the planes of other parts are relative to the first part.

NPGS (integer)

Returns the number of available pages for current text part.

PAGE (command) page (integer)

Sets current page for text part. The page number should be equal or greater than zero and less than the number returned by NPGS. Use PAT: TEXT or 
PAT: FIXD to make a text part, and PART to set the current part.

PAGE (integer)

Returns the current page for current text part. See the PAGE command for more information.

PART (command) part_id (integer)

Sets the working part number. Future command such as POSE and ANIM, amongst others, act on that part of a compound agent. To find what parts there are 
on an agent use PNXT.

PART (integer) part_id (integer)

Returns 1 if the given part number exists on the TARG agent and 0 if it does not.

PAT: BUTT (command) part_id (integer) sprite_file (string) first_image (integer) image_count (integer) rel_x (decimal) rel_y (decimal) rel_plane (integer) anim_hover (byte-string) message_id (integer) option (integer)

Create a button on a compound agent. anim_hover is an animation, as in the ANIM command, to use when the mouse is over the button - when the mouse is  
moved off, it returns to any previous animation that was going. message_id is sent when the button is clicked. option is 0 for the mouse to hit  
anywhere in the bounding box, 1 to hit only non-transparent pixels.
_P1_ of the message is set to the part number of the buttons allowing you to overload your messages by button group and then switch on input value in  
the script.

PAT: CMRA (command) part_id (integer) overlay_sprite (string) baseimage (integer) relx (decimal) rely (decimal) relplane (integer) viewWidth (integer) viewHeight (integer) cameraWidth (integer) cameraHeight (integer)

Create a camera with possible overlay sprite whose name may be blank. Use SCAM to change the camera's view.

PAT: DULL (command) part_id (integer) sprite_file (string) first_image (integer) rel_x (decimal) rel_y (decimal) rel_plane (integer)

Create a dull part for a compound agent. A dull part does nothing except show an image from the given sprite file. You should number part ids  
starting at 1, as part 0 is automatically made when the agent is made. The dull part's position is relative to part 0, as is its plane. Use PART to   
select it before you change POSE or ANIM, or use various other commands.

PAT: FIXD (command) part_id (integer) sprite_file (string) first_image (integer) rel_x (decimal) rel_y (decimal) rel_plane (integer) font_sprite (string)

Create a fixed text part. The text is wrapped on top of the supplied gallery image. new-line characters may be used. Use PTXT to set the text.

PAT: GRPH (command) part_id (integer) overlay_sprite (string) baseimage (integer) relx (decimal) rely (decimal) relplane (integer) numValues (integer)

Creates a graph part on a compound agent. Use GRPL to add a line to the graph and GRPV to add a value to a graph line.

PAT: KILL (command) part_id (integer)

Destroys the specified part of a compound agent. You can't destroy part 0.

PAT: MOVE (command) part_id (integer) rel_x (decimal) rely (decimal)

Moves a compound part to the new relative position specified.

PAT: TEXT (command) part_id (integer) sprite_file (string) first_image (integer) rel_x (decimal) rel_y (decimal) rel_plane (integer) message_id (integer) font_sprite (string)

Creates a text entry part. Gains the focus when you click on it, or with the FCUS command. Sends the message_id when return is pressed - a good place  
to use PTXT to get the text out, and to set the focus elsewhere. Set message_id to 0 to not call any script, or to -1 to not send any message and  
instead insert a carriage return.

PNXT (integer) previous_part (integer)

Returns the next compound PART on an agent. Start by calling it with -1 to get the first part, and it finishes by returning -1 when it reaches the end.

PTXT (command) text (string)

Set string of current text part. Use PAT: TEXT or PAT: FIXD to make a text part, and PART to set the current part.
In the original display engine, you can use special tags to set TINT colours for characters. Use something like <tint 255 255 0> to begin colouring,  
and <tint> to end. The tint tag takes up to five parameters as the TINT command, they all default to 128 if not specified. Less than and greater than  
symbols are still printed if not within a tint tag. The tags also apply to text entry parts, but only when the text is initially set with PTXT; they  
are obeyed in a character count fashion during editing, but not updated.

PTXT (string)

Returns the string of the current text part. See the PTXT command for more information.