Difference between revisions of "Add.to.pic"
Line 68: | Line 68: | ||
[[Category:Logic Commands]] | [[Category:Logic Commands]] | ||
− | |||
[[Category:Object and View Commands]] | [[Category:Object and View Commands]] |
Revision as of 16:54, 28 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 drawnloopNumber
: a number, 0-255, specifying the loop in the View resource that contains the cel that should be drawncelNumber
: a number, 0-255, specifying the cel that should be drawnx
: a number, 0-255, specifying the x position where the cel should be drawny
: a number, 0-255, specifying the y position where the cel should be drawnpriority
: 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 changedmargin
: 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 drawnloopNumber
: a variable, v0-v255, whose value specifies the loop in the View resource that contains the cel that should be drawncelNumber
: a variable, v0-v255, whose value specifies the cel that should be drawnx
: a variable, v0-v255, whose value specifies the x position where the cel should be drawny
: a variable, v0-v255, whose value specifies the y position where the cel should be drawnpriority
: 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 changedmargin
: 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
- 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; this can lead to a script buffer overflow error
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:
<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.