PDA

View Full Version : Roll Script: Problem with drawing functions and the T21 error.



beefster09
08-12-2007, 07:06 PM
Every time I've tried to use the Drawing functions, I get the T21: Could not match type signature... error. I believe this happened to me since b15.

Here's the whole code for the roll script that I'm doing:


import "std.zh"

global script roll {

void run() {

int counter;
bool justRolled = false;
int DustTile = 20; //the starting animation tile of the 5-frame dust animation.
int DustCSet = 7; //the CSet of the tile animation.
int xca; int xcb; int xcc; int xcd; int xce;
int yca; int ycb; int ycc; int ycd; int yce;
int DustFrame;

while(true) {

if(Link->InputL && Link->Action == LA_WALKING) {

Link->Jump = 20;
counter = 20;
DustFrame = 1;
xca = -1;
xcb = -1;
xcc = -1;
xcd = -1;
xce = -1;
yca = -1;
ycb = -1;
ycc = -1;
ycd = -1;
yce = -1;
//Game->PlaySound(66); //Change/Enable SFX if needed

while(counter > 0) {

Link->Z = 0;
Link->InputUp = false;
Link->InputDown = false;
Link->InputLeft = false;
Link->InputRight = false;
Link->InputA = false;
Link->InputB = false;
Link->InputR = false;

if(Floor(counter/2) == counter/2) { //trigger animation

xce = xcd;
xcd = xcc;
xcc = xcb;
xcb = xca;

yce = ycd;
ycd = ycc;
ycc = ycb;
ycb = yca;

xca = Link->X;
yca = Link->Y;

if(DustFrame == 5) {

xca = -1;
yca = -1;

}

DustFrame ++;

}

if((xca > -1) && (yca > -1)) {DrawTile(2, xca, yca, DustTile, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if((xcb > -1) && (ycb > -1)) {DrawTile(2, xcb, ycb, DustTile + 1, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if((xcc > -1) && (ycc > -1)) {DrawTile(2, xcc, ycc, DustTile + 2, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if((xcd > -1) && (ycd > -1)) {DrawTile(2, xcd, ycd, DustTile + 3, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if((xce > -1) && (yce > -1)) {DrawTile(2, xce, yce, DustTile + 4, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}

if(Link->Dir == DIR_UP) {

if((Screen->ComboS[ComboAt(Link->X+8, Link->Y+6)] == 0) && (Screen->ComboF[ComboAt(Link->X+8, Link->Y+6)] != 97)) {Link->Y -= 2;}

} //end if

if(Link->Dir == DIR_DOWN) {

if((Screen->ComboS[ComboAt(Link->X+8, Link->Y+18)] == 0) && (Screen->ComboF[ComboAt(Link->X+8, Link->Y+18)] != 97)) {Link->Y += 2;}

} //end if

if(Link->Dir == DIR_LEFT) {

if((Screen->ComboS[ComboAt(Link->X-2, Link->Y+8)] == 0) && (Screen->ComboF[ComboAt(Link->X-2, Link->Y+8)] != 97)) {Link->X -= 2;}

} //end if

if(Link->Dir == DIR_RIGHT) {

if((Screen->ComboS[ComboAt(Link->X+18, Link->Y+8)] == 0) && (Screen->ComboF[ComboAt(Link->X+18, Link->Y+8)] != 97)) {Link->X += 2;}

} //end if

counter --;
justRolled = true;

Waitframe();

} //end while

} //end if

if(justRolled) {

Link->Jump = 0;
justRolled = false;

}

Waitframe();

} //end while

} //end void run

} //end script

And these are the 5 problem lines:


if((xca > -1) && (yca > -1)) {DrawTile(2, xca, yca, DustTile, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if((xcb > -1) && (ycb > -1)) {DrawTile(2, xcb, ycb, DustTile + 1, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if((xcc > -1) && (ycc > -1)) {DrawTile(2, xcc, ycc, DustTile + 2, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if((xcd > -1) && (ycd > -1)) {DrawTile(2, xcd, ycd, DustTile + 3, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if((xce > -1) && (yce > -1)) {DrawTile(2, xce, yce, DustTile + 4, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}

What am I doing wrong?

ShadowMancer
08-12-2007, 07:12 PM
I believe you need to use Screen->DrawTile()
I have not tried it but its how most functions work in Zscript

DarkDragon
08-12-2007, 08:32 PM
Yes. The drawing methods are members of the screen, I believe.

beefster09
08-12-2007, 08:53 PM
Oh crap. I knew that. Now I feel stupid. XD It compiled now. Now I just have to test it before I showcase it.

Mega Link
08-12-2007, 09:11 PM
I can't wait for it to be showcased.