Add.to.pic

From AGI Wiki
Revision as of 14:23, 28 December 2013 by Andrew Branscom (talk | contribs)
Jump to navigationJump to search

The add.to.pic command draws a cel from a view to the visual picture screen in memory. There is an indirect version of this command called add.to.pic.v.

add.to.pic(viewNumber, loopNumber, celNumber, x, y, priority, margin);

Cel celNumber of loop loopNumber of VIEW viewNumber is drawn on the picture at position (x, y) with a priority of priority. If margin is 0, 1, 2, or 3, the base line of the object (the bottom row of pixels of the cel) is given a priority of margin. Since priority is taken into account, you can use add.to.pic to add cels behind other parts of the picture.

Note that the VIEW must be loaded before you use it with add.to.pic.

Parameters

For add.to.pic

  • viewNumber: a number, 0-255, specifying the view resource that contains the cel that should be drawn
  • loopNumber: a number, 0-255, specifying the loop in the VIEW resource that contains the cel that should be drawn
  • celNumber: a number, 0-255, specifying the cel that should be drawn
  • x: a number, 0-255, specifying the x position where the cel should be drawn
  • y: a number, 0-255, specifying the y position where the cel should be drawn
  • priority: a number, 0-15, specifying the priority that should be assigned to the cel when it is drawn; note: after the cel is drawn, the priority cannot be changed
  • margin: a number, 0-3, specifying the priority of the base line of the object (the bottom row of pixels of the cel); this parameter can be used, for example, to prevent ego from walking through the cel, making it appear to be a solid object on the screen


For add.to.pic.v

  • viewNumber: a variable, v0-v255, whose value specifies the VIEW resource that contains the cel that should be drawn
  • loopNumber: a variable, v0-v255, whose value specifies the loop in the VIEW resource that contains the cel that should be drawn
  • celNumber: a variable, v0-v255, whose value specifies the cel that should be drawn
  • x: a variable, v0-v255, whose value specifies the x position where the cel should be drawn
  • y: a variable, v0-v255, whose value specifies the y position where the cel should be drawn
  • priority: a variable, v0-v255, whose value specifies the priority that should be assigned to the cel when it is drawn; note: after the cel is drawn, the priority cannot be changed
  • margin: a variable, v0-v255, whose value specifies the priority of the base line of the object (the bottom row of pixels of the cel); this parameter can be used, for example, to prevent ego from walking through the cel, making it appear to be a solid object on the screen


Possible errors


Example

The following example uses add.to.pic to draw cel 3 from loop 2 of VIEW 15 at position (40, 120) with a priority of 9 and a margin of 0 (unconditional barrier).

load.view(15); add.to.pic(15, 2, 3, 40, 120, 9, 0);

The next example uses the indirect command add.to.pic.v to accomplish the same thing:

Code:

<syntaxhighlight lang="agi"> load.view(15);

v200 = 15; v201 = 2; v202 = 3; v203 = 40; v204 = 120; v210 = 9; v215 = 0;

add.to.pic.v(v200, v201, v202, v203, v204, v210, v215); </syntaxhighlight>

Sources

Some of the content of this page was taken from the AGI Studio help file.