Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
Sign in to follow this  
Apothem

This is driving me NUTS!!!

Recommended Posts

Okay all my for loops are being ignored!! Blargh! And i'm positive i've got these damn things right.
What's really funny is that all the debug prints i put in there execute perfectly and in the right order, but for some reason the engine just doesnt wanna acknowlege i have for loops in there.... Go figure



#include "zcommon.acs"
int a;
int b;
int c;
int e;
int g;
int h;
int j;

Script 1 ENTER
{
if (j == 0)
{
Thing_ChangeTID (0, 1338);
b = GetActorProperty(1338, APROP_Health);
acs_execute(101,0,0,0,0);
j = 1;
}

if (g == 1)
{
g = 0;
print(s:"Recharging Health");
b = GetActorProperty(1338, APROP_Health);
a = 0;
for (a = 1; a > 100; a++)
{
if(GetActorProperty(1338, APROP_Health) < b)
{
b = GetActorProperty(1338, APROP_Health);
acs_execute(102,0,0,0,0);
break;
}
print(i:a);
delay(5);
Healthing(1,1338);
b = GetActorProperty(1338, APROP_Health);
}
print(s:"Recharge Successful!");
delay(35);
acs_execute(101,0,0,0,0);
}
delay(5);
restart;
}

Script 2 (void)
{
Damagething(20);
}

Script 101 (void)
{
Print(s:"Checking health");
if(GetActorProperty(1338, APROP_Health) < b)
{
b = GetActorProperty(1338, APROP_Health);
acs_execute(102,0,0,0,0);
acs_terminate(101,0);
}
delay(3);
restart;
}

Script 102 (void)
{
print(s:"Attempting recharge");
for(e = 1; e > 1000; e++)
{
delay(35);
if (GetActorProperty(1338, APROP_Health) < b)
{
b = GetActorProperty(1338, APROP_Health);
e = 1;
}
}
print(s:"Attempt successful!");
delay(35);
g = 1;
}

Share this post


Link to post
Graf Zahl said:

Of course they are ignored. You have to change all the comparisons in them from '>' to '<'.


-_-; O M F G This is the last time i stay up all night to try and code anything ever again.... I feel really really retarded now.

Share this post


Link to post

Learn to comment your code, approx. one line comment for every line of code (not counting closing brackets like } ) in your comments, write in plain english what you intend to do. Helps a lot to see what is supposed to be happening so you can compare it with the code your wrote.

Share this post


Link to post

Yeah, i really should, but instead of that, i usually use print(); because it lets me know how it's runnin in game. But you're still right, and that's the way it is with ALL my projects, i didnt start using indentation untill recently but i really should start commenting, it'd help a lot with readablity

Share this post


Link to post

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  
×