Difference between revisions of "Add.to.pic"

From AGI Wiki
Jump to navigationJump to search
Line 1: Line 1:
The '''add.to.pic''' command draws a [[Cel|cel]] from a [[VIEW|view]] to the [[visual picture screen]] in memory. There is an [[indirect]] version of this command called '''add.to.pic.v'''.
+
The '''add.to.pic''' command draws a [[Cel|cel]] from a [[VIEW Resource|view]] to the [[visual picture screen]] in memory. There is an [[indirect]] version of this command called '''add.to.pic.v'''.
  
 
<code>add.to.pic(viewNumber, loopNumber, celNumber, x, y, priority, margin);</code>
 
<code>add.to.pic(viewNumber, loopNumber, celNumber, x, y, priority, margin);</code>
  
Cel <code>celNumber</code> of [[loop]] <code>loopNumber</code> of view viewNumber is drawn on the [[PICTURE Resource|picture]] at position (x, y) with a [[priority]] of <code>priority</code>. 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 <code>margin</code>. Since priority is taken into account, you can use <code>add.to.pic</code> to add cels behind other parts of the picture.
+
Cel <code>celNumber</code> of [[loop]] <code>loopNumber</code> of VIEW viewNumber is drawn on the [[PICTURE Resource|picture]] at position (x, y) with a [[priority]] of <code>priority</code>. 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 <code>margin</code>. Since priority is taken into account, you can use <code>add.to.pic</code> to add cels behind other parts of the picture.
  
Note that the view must be [[loaded]] before you use it with <code>add.to.pic</code>.
+
Note that the VIEW must be [[loaded]] before you use it with <code>add.to.pic</code>.
  
 
==Parameters==
 
==Parameters==
Line 12: Line 12:
  
 
* <code>viewNumber</code>: a number, 0-255, specifying the [[VIEW Resource|view resource]] that contains the cel that should be drawn
 
* <code>viewNumber</code>: a number, 0-255, specifying the [[VIEW Resource|view resource]] that contains the cel that should be drawn
* <code>loopNumber</code>: a number, 0-255, specifying the loop in the view resource that contains the cel that should be drawn
+
* <code>loopNumber</code>: a number, 0-255, specifying the loop in the VIEW resource that contains the cel that should be drawn
 
* <code>celNumber</code>: a number, 0-255, specifying the cel that should be drawn
 
* <code>celNumber</code>: a number, 0-255, specifying the cel that should be drawn
 
* <code>x</code>: a number, 0-255, specifying the x position where the cel should be drawn
 
* <code>x</code>: a number, 0-255, specifying the x position where the cel should be drawn
Line 22: Line 22:
 
===For add.to.pic.v===
 
===For add.to.pic.v===
  
* <code>viewNumber</code>: a [[variable]], v0-v255, whose value specifies the view resource that contains the cel that should be drawn
+
* <code>viewNumber</code>: a [[variable]], v0-v255, whose value specifies the VIEW resource that contains the cel that should be drawn
* <code>loopNumber</code>: a variable, v0-v255, whose value specifies the loop in the view resource that contains the cel that should be drawn
+
* <code>loopNumber</code>: a variable, v0-v255, whose value specifies the loop in the VIEW resource that contains the cel that should be drawn
 
* <code>celNumber</code>: a variable, v0-v255, whose value specifies the cel that should be drawn
 
* <code>celNumber</code>: a variable, v0-v255, whose value specifies the cel that should be drawn
 
* <code>x</code>: a variable, v0-v255, whose value specifies the x position where the cel should be drawn
 
* <code>x</code>: a variable, v0-v255, whose value specifies the x position where the cel should be drawn
Line 33: Line 33:
 
==Possible errors==
 
==Possible errors==
  
* if the specified view has not yet been loaded (see [[load.view]]), then the game will crash with a [[view not loaded error]]
+
* if the specified VIEW has not yet been loaded (see [[load.view]]), then the game will crash with a [[view not loaded error]]
 
* every time the add.to.pic or add.to.pic.v command is issued, it adds to the [[Script Buffer|script buffer]]; this can lead to a [[Script Buffer Overflow Error|script buffer overflow error]]  
 
* every time the add.to.pic or add.to.pic.v command is issued, it adds to the [[Script Buffer|script buffer]]; this can lead to a [[Script Buffer Overflow Error|script buffer overflow error]]  
  
Line 39: Line 39:
 
==Example==
 
==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|unconditional barrier]]).
+
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|unconditional barrier]]).
  
 
<code>load.view(15);
 
<code>load.view(15);
Line 65: Line 65:
  
 
[[Category:Logic Commands]]
 
[[Category:Logic Commands]]
[[Category:Object and View Commands]]
+
[[Category:Object and VIEW Commands]]

Revision as of 00:44, 27 December 2013

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:

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);

Sources

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