I have to have a while loop for my sort of turn-based combat. I have it set up in the "repeatedly execute" portion of the global script.
Every time I try to have a while loop it says undefined token. I looked up token, but I'm still confused. From what the manuel said it sounds like I have to define it, but why would I have to define a while loop statement?
It should have said "undefined token xxx" where xxx is the word it doesn't recognize.
Please post your actual code so we can help you better.
It says that 'While' is undefined.
While ((HP>0) && (HP1>0))
{
DisplayAt(200,200,100, "(f)ight/(w)eapon/(i)tem/(e)scape");
if ((IsKeyPressed(70)==1) && (IsKeyPressed(87)==0) && (IsKeyPressed(73)==0) && (IsKeyPressed(69)==0)) {
if (player_s > e1s) {
int hit=Random(1);
if (hit == 1) {
if (equip==0) {
Display("You hit for 10 damage with your axe.");
HP1-=equip;}
else {
Display("You miss.");}
}
else if (player_s < e1s) {
int hit2=Random(9);
if (hit2 == (1 || 3 || 5 || 7 || 9)) {
Display("The Rotweiler hit you for 15 damage.");
HP-=e1d;}
else if (hit2 == (0 || 2 || 4 || 6 || 8)) {
Display("The Rotweiler missed.");}
}
AGS is case-sensitive, so you have to write "while" in lowercase.
I feel so stupid. I suppose everyone has to have a stupid moment every now and again.
Hehe, don't worry, it happens to all of us. :)
I'm not quite sure of what you're going to archive, but if you want that check to happen every game loop (as you put it in repeatedly execute) you shouldn't need to use while, you can just change the while to 'if'.