Fairy script combined with rolling script.
Started by
Xenix
, Apr 19 2010 06:38 PM
6 replies to this topic
#1
Posted 19 April 2010 - 06:38 PM
i am a total noob to combining global scripts and i am in need of some help. if anyone has a this script i would appreciate it if you could post it here. oh and just in case this info is needed my zc build is 2.5 beta1204. oh and i'll definitely add whoever is able to help me out to the credits list. thanks everyone.
#2
Posted 20 April 2010 - 07:40 AM
It would help if you posted the complete global script and error message.
#3
Posted 20 April 2010 - 11:53 PM
Okay, here's the rolling script. i was able to get a different one to work but it doesn't work quite like I need it.
The error is about the drawtile(float,float,float,..) part.
I've read about how the ZScript code was changed and the drawtile function was changed around.
any suggestions?
QUOTE
bool isSolid(int x, int y) {
// x=23, y=130
// Obviously in range...
if(x<0 || x>255 || y<0 || y>175)
return false;
int mask=1111b;
// x % 16 = 7, so
// mask = 1111 & 0011 = 0011
if(x%16<
mask&=0011b;
else
mask&=1100b;
// y % 16 = 2, so
// mask = 0011 & 0101 = 0001
if(y%16<
mask&=0101b;
else
mask&=1010b;
// All but the top-right quarter of the combo is solid,
so ComboS = 1011
// mask & ComboS = 0001 & 1011 = 0001
// The result wasn't 0, so return false
return (!(Screen->ComboS[ComboAt(x, y)]&mask)==0);
}
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 = 2;
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(63); //Change/Disable 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;
Link->InputL = false;
if(Floor(counter/2) == counter/2) {
//trigger animation every other frame
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))
{Screen->DrawTile(2, xca, yca, DustTile, 1, 1, DustCSet, 1,
0, 0, 0, 0, true, 128);}
if(!(xcb == -1) && !(ycb == -1))
{Screen->DrawTile(2, xcb, ycb, DustTile + 1, 1, 1,
DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(!(xcc == -1) && !(ycc == -1))
{Screen->DrawTile(2, xcc, ycc, DustTile + 2, 1, 1,
DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(!(xcd == -1) && !(ycd == -1))
{Screen->DrawTile(2, xcd, ycd, DustTile + 3, 1, 1,
DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(!(xce == -1) && !(yce == -1))
{Screen->DrawTile(2, xce, yce, DustTile + 4, 1, 1,
DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(Link->Dir == DIR_UP) {
if(!isSolid(Link->X+4, Link->Y+6)
&& !isSolid(Link->X+12, Link->Y+6) && (Screen->ComboF
[ComboAt(Link->X+8, Link->Y+6)] != 98)) {Link->Y -= 2;}
} else if(Link->Dir == DIR_DOWN) {
if(!isSolid(Link->X+4, Link->Y+18)
&& !isSolid(Link->X+12, Link->Y+18) && (Screen->ComboF
[ComboAt(Link->X+8, Link->Y+18)] != 98)) {Link->Y += 2;}
} else if(Link->Dir == DIR_LEFT) {
if(!isSolid(Link->X-2, Link->Y+12)
&& (Screen->ComboF[ComboAt(Link->X-2, Link->Y+4)] != 98))
{Link->X -= 2;}
} else if (Link->Dir == DIR_RIGHT) {
if(!isSolid(Link->X+18, Link->Y+12)
&& (Screen->ComboF[ComboAt(Link->X+18, Link->Y+4)] != 98))
{Link->X += 2;}
} //end if
counter --;
justRolled = true;
Waitframe();
} //end while
} //end if
if(justRolled) {
Link->Jump = 0;
justRolled = false;
}
Link->InputL = false;
Waitframe();
} //end while
} //end void run
} //end script
// x=23, y=130
// Obviously in range...
if(x<0 || x>255 || y<0 || y>175)
return false;
int mask=1111b;
// x % 16 = 7, so
// mask = 1111 & 0011 = 0011
if(x%16<
mask&=0011b;
else
mask&=1100b;
// y % 16 = 2, so
// mask = 0011 & 0101 = 0001
if(y%16<
mask&=0101b;
else
mask&=1010b;
// All but the top-right quarter of the combo is solid,
so ComboS = 1011
// mask & ComboS = 0001 & 1011 = 0001
// The result wasn't 0, so return false
return (!(Screen->ComboS[ComboAt(x, y)]&mask)==0);
}
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 = 2;
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(63); //Change/Disable 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;
Link->InputL = false;
if(Floor(counter/2) == counter/2) {
//trigger animation every other frame
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))
{Screen->DrawTile(2, xca, yca, DustTile, 1, 1, DustCSet, 1,
0, 0, 0, 0, true, 128);}
if(!(xcb == -1) && !(ycb == -1))
{Screen->DrawTile(2, xcb, ycb, DustTile + 1, 1, 1,
DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(!(xcc == -1) && !(ycc == -1))
{Screen->DrawTile(2, xcc, ycc, DustTile + 2, 1, 1,
DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(!(xcd == -1) && !(ycd == -1))
{Screen->DrawTile(2, xcd, ycd, DustTile + 3, 1, 1,
DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(!(xce == -1) && !(yce == -1))
{Screen->DrawTile(2, xce, yce, DustTile + 4, 1, 1,
DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(Link->Dir == DIR_UP) {
if(!isSolid(Link->X+4, Link->Y+6)
&& !isSolid(Link->X+12, Link->Y+6) && (Screen->ComboF
[ComboAt(Link->X+8, Link->Y+6)] != 98)) {Link->Y -= 2;}
} else if(Link->Dir == DIR_DOWN) {
if(!isSolid(Link->X+4, Link->Y+18)
&& !isSolid(Link->X+12, Link->Y+18) && (Screen->ComboF
[ComboAt(Link->X+8, Link->Y+18)] != 98)) {Link->Y += 2;}
} else if(Link->Dir == DIR_LEFT) {
if(!isSolid(Link->X-2, Link->Y+12)
&& (Screen->ComboF[ComboAt(Link->X-2, Link->Y+4)] != 98))
{Link->X -= 2;}
} else if (Link->Dir == DIR_RIGHT) {
if(!isSolid(Link->X+18, Link->Y+12)
&& (Screen->ComboF[ComboAt(Link->X+18, Link->Y+4)] != 98))
{Link->X += 2;}
} //end if
counter --;
justRolled = true;
Waitframe();
} //end while
} //end if
if(justRolled) {
Link->Jump = 0;
justRolled = false;
}
Link->InputL = false;
Waitframe();
} //end while
} //end void run
} //end script
The error is about the drawtile(float,float,float,..) part.
I've read about how the ZScript code was changed and the drawtile function was changed around.
any suggestions?
Edited by OOTFan, 20 April 2010 - 11:53 PM.
#4
Posted 21 April 2010 - 07:14 AM
Somewhere in the forum there is a guide to updating drawtile. You'll want to check it out.
I have a copy that just might work - just combine it with the fairy script or copy over the differences.
I have a copy that just might work - just combine it with the fairy script or copy over the differences.
CODE
import "std.zh"
bool Screen->isSolid(int x, int y) {
// x=23, y=130
// Obviously in range...
if(x<0 || x>255 || y<0 || y>175)
return false;
int mask=1111b;
// x % 16 = 7, so
// mask = 1111 & 0011 = 0011
if(x%16<8)
mask&=0011b;
else
mask&=1100b;
// y % 16 = 2, so
// mask = 0011 & 0101 = 0001
if(y%16<8)
mask&=0101b;
else
mask&=1010b;
// All but the top-right quarter of the combo is solid, so ComboS = 1011
// mask & ComboS = 0001 & 1011 = 0001
// The result wasn't 0, so return false
return (!(Screen->ComboS[ComboAt(x, y)]&mask)==0);
}
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 = 2;
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/Disable 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;
Link->InputL = false;
if(Floor(counter/2) == counter/2) { //trigger animation every other frame
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)) {Screen->DrawTile(2, xca, yca, DustTile, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(!(xcb == -1) && !(ycb == -1)) {Screen->DrawTile(2, xcb, ycb, DustTile + 1, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(!(xcc == -1) && !(ycc == -1)) {Screen->DrawTile(2, xcc, ycc, DustTile + 2, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(!(xcd == -1) && !(ycd == -1)) {Screen->DrawTile(2, xcd, ycd, DustTile + 3, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(!(xce == -1) && !(yce == -1)) {Screen->DrawTile(2, xce, yce, DustTile + 4, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(Link->Dir == DIR_UP) {
if(!Screen->Screen->Screen->Screen->isSolid(Link->X+4, Link->Y+6) && !Screen->Screen->Screen->Screen->isSolid(Link->X+12, Link->Y+6) && (Screen->ComboF[ComboAt(Link->X+8, Link->Y+6)] != 98)) {Link->Y -= 2;}
} else if(Link->Dir == DIR_DOWN) {
if(!Screen->Screen->Screen->Screen->isSolid(Link->X+4, Link->Y+18) && !Screen->Screen->Screen->Screen->isSolid(Link->X+12, Link->Y+18) && (Screen->ComboF[ComboAt(Link->X+8, Link->Y+18)] != 98)) {Link->Y += 2;}
} else if(Link->Dir == DIR_LEFT) {
if(!Screen->Screen->Screen->Screen->isSolid(Link->X-2, Link->Y+12) && (Screen->ComboF[ComboAt(Link->X-2, Link->Y+4)] != 98)) {Link->X -= 2;}
} else if (Link->Dir == DIR_RIGHT) {
if(!Screen->Screen->Screen->Screen->isSolid(Link->X+18, Link->Y+12) && (Screen->ComboF[ComboAt(Link->X+18, Link->Y+4)] != 98)) {Link->X += 2;}
} //end if
counter --;
justRolled = true;
Waitframe();
} //end while
} //end if
if(justRolled) {
Link->Jump = 0;
justRolled = false;
}
Link->InputL = false;
Waitframe();
} //end while
} //end void run
} //end script
bool Screen->isSolid(int x, int y) {
// x=23, y=130
// Obviously in range...
if(x<0 || x>255 || y<0 || y>175)
return false;
int mask=1111b;
// x % 16 = 7, so
// mask = 1111 & 0011 = 0011
if(x%16<8)
mask&=0011b;
else
mask&=1100b;
// y % 16 = 2, so
// mask = 0011 & 0101 = 0001
if(y%16<8)
mask&=0101b;
else
mask&=1010b;
// All but the top-right quarter of the combo is solid, so ComboS = 1011
// mask & ComboS = 0001 & 1011 = 0001
// The result wasn't 0, so return false
return (!(Screen->ComboS[ComboAt(x, y)]&mask)==0);
}
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 = 2;
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/Disable 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;
Link->InputL = false;
if(Floor(counter/2) == counter/2) { //trigger animation every other frame
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)) {Screen->DrawTile(2, xca, yca, DustTile, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(!(xcb == -1) && !(ycb == -1)) {Screen->DrawTile(2, xcb, ycb, DustTile + 1, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(!(xcc == -1) && !(ycc == -1)) {Screen->DrawTile(2, xcc, ycc, DustTile + 2, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(!(xcd == -1) && !(ycd == -1)) {Screen->DrawTile(2, xcd, ycd, DustTile + 3, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(!(xce == -1) && !(yce == -1)) {Screen->DrawTile(2, xce, yce, DustTile + 4, 1, 1, DustCSet, 1, 0, 0, 0, 0, true, 128);}
if(Link->Dir == DIR_UP) {
if(!Screen->Screen->Screen->Screen->isSolid(Link->X+4, Link->Y+6) && !Screen->Screen->Screen->Screen->isSolid(Link->X+12, Link->Y+6) && (Screen->ComboF[ComboAt(Link->X+8, Link->Y+6)] != 98)) {Link->Y -= 2;}
} else if(Link->Dir == DIR_DOWN) {
if(!Screen->Screen->Screen->Screen->isSolid(Link->X+4, Link->Y+18) && !Screen->Screen->Screen->Screen->isSolid(Link->X+12, Link->Y+18) && (Screen->ComboF[ComboAt(Link->X+8, Link->Y+18)] != 98)) {Link->Y += 2;}
} else if(Link->Dir == DIR_LEFT) {
if(!Screen->Screen->Screen->Screen->isSolid(Link->X-2, Link->Y+12) && (Screen->ComboF[ComboAt(Link->X-2, Link->Y+4)] != 98)) {Link->X -= 2;}
} else if (Link->Dir == DIR_RIGHT) {
if(!Screen->Screen->Screen->Screen->isSolid(Link->X+18, Link->Y+12) && (Screen->ComboF[ComboAt(Link->X+18, Link->Y+4)] != 98)) {Link->X += 2;}
} //end if
counter --;
justRolled = true;
Waitframe();
} //end while
} //end if
if(justRolled) {
Link->Jump = 0;
justRolled = false;
}
Link->InputL = false;
Waitframe();
} //end while
} //end void run
} //end script
#5
Posted 21 April 2010 - 03:35 PM
okay, now it's giving me this "Line 3: syntax error, unexpected arrow, expected assign or semicolon, on token ->". this is annoying.
#6
Posted 22 April 2010 - 07:41 AM
Try taking your old script file and copying all instances of drawtile with the ones from the updated script. I'm not sure what's on your line 3 so I can't help with that unless you put up your latest script.
#7
Posted 22 April 2010 - 02:19 PM
hey thanks for all the help. I got tired of the dang errors so i just downloaded an older version of zelda classic 2.5 (it was build 1057) now it's working. i'm sorry for asking this cause i really feel like i'm wasting your time but if you don't mind and can find the time can you please combine these scripts for me. i'm sorry for taking up your time, but i would really appreciate this. oh and you are definitely going on the credits for your awesome help. i'm going to repay you somehow for your help, i greatly appreciate what you have done to help me.
EDIT: i have a scripter on my team who did it.
EDIT: i have a scripter on my team who did it.
Edited by OOTFan, 28 April 2010 - 05:03 PM.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users