ShadowMancer
06-05-2007, 04:13 PM
I've been wracking my brain all day trying to figure out what is wrong with this code, I'm stumped so lets see if anyone else can tell me what i am doing wrong.
It compiles fine, but it does nothing, i put in a Trace(); to test the results of the varible but all i get is 0's
ffc script pathTest{
void run(int this_ffc_num)
{
while (true){
//declare vars
int best_dir = 0;
// "this_ffc->" bug workaround
ffc this_ffc = Screen->LoadFFC(this_ffc_num);
int rnum = Floor(Rand(4)+1);
if (rnum==1) { best_dir = 1; }
if (rnum==2) { best_dir = 2; }
if (rnum==3) { best_dir = 3; }
if (rnum==4) { best_dir = 4; }
//routine to move FFC in chosen direction
Trace(best_dir);
if (best_dir==1)
{
for (int n=1 ; n<16 ; n+=4)
{
this_ffc->Y-=4;
Waitframe();
}
}
if (best_dir==2)
{
for (int n=1 ; n<16 ; n+=4)
{
this_ffc->X-=4;
Waitframe();
}
}
if (best_dir==3)
{
for (int n=1 ; n<16 ; n+=4)
{
this_ffc->Y+=4;
Waitframe();
}
}
if (best_dir==4)
{
for (int n=1 ; n<16 ; n+=4)
{
this_ffc->X+=4;
Waitframe();
}
}
Waitframe();
}//ends while true
}//ends void run
}//ends pathTest
This is not my original script, but a simplified version, still the problem remains the same. it SHOULD move the FFC one grid space in a random direction every 4 tics
EDIT: okay i figured out the Rand problem (i forgrot to floor it) but now it looks like that was not the problem in the original script, (i did not use a random number) so mabye i can figure it out now...
Also, this time when i ran a Trace(rnum); i thought it would have given me the output of the random number but it just gave me a bunch of Zasm (which i only partialy understand) how can i just get the output of a var??
It compiles fine, but it does nothing, i put in a Trace(); to test the results of the varible but all i get is 0's
ffc script pathTest{
void run(int this_ffc_num)
{
while (true){
//declare vars
int best_dir = 0;
// "this_ffc->" bug workaround
ffc this_ffc = Screen->LoadFFC(this_ffc_num);
int rnum = Floor(Rand(4)+1);
if (rnum==1) { best_dir = 1; }
if (rnum==2) { best_dir = 2; }
if (rnum==3) { best_dir = 3; }
if (rnum==4) { best_dir = 4; }
//routine to move FFC in chosen direction
Trace(best_dir);
if (best_dir==1)
{
for (int n=1 ; n<16 ; n+=4)
{
this_ffc->Y-=4;
Waitframe();
}
}
if (best_dir==2)
{
for (int n=1 ; n<16 ; n+=4)
{
this_ffc->X-=4;
Waitframe();
}
}
if (best_dir==3)
{
for (int n=1 ; n<16 ; n+=4)
{
this_ffc->Y+=4;
Waitframe();
}
}
if (best_dir==4)
{
for (int n=1 ; n<16 ; n+=4)
{
this_ffc->X+=4;
Waitframe();
}
}
Waitframe();
}//ends while true
}//ends void run
}//ends pathTest
This is not my original script, but a simplified version, still the problem remains the same. it SHOULD move the FFC one grid space in a random direction every 4 tics
EDIT: okay i figured out the Rand problem (i forgrot to floor it) but now it looks like that was not the problem in the original script, (i did not use a random number) so mabye i can figure it out now...
Also, this time when i ran a Trace(rnum); i thought it would have given me the output of the random number but it just gave me a bunch of Zasm (which i only partialy understand) how can i just get the output of a var??