Replace 2 Ints with Bool

Started by steptoe, Sun 05/08/2012 19:33:26

Previous topic - Next topic

steptoe

Hi

I'm looking at manual to find the best way of doing this:


EDIT: Surely must be:
Rep Exec
Code: AGS

if(Enemy1a <= 0 && Enemy1b <= 0)
{
bool=true;
}


--------------------------



Int A (Enemy1a) plus Int B (Enemy1b) (or vise versa) = Bool false/true sort of thing.

I want to replace Enemy1a >= 1 && Enemy1b >= 1 with a bool=false and change if both Ints are met (Both Int=0) by Rep Exec to true.
Code: AGS

{
if(cryan.ActiveInventory==igrenade && Enemy1a >= 1 && Enemy1b >= 1)
{
 cblondie.FaceLocation(292, 206);
 Grenades=(Grenades -1); 
 object[8].X =cblondie. x-0;
 object[8].Y = cblondie.y- 0;
 cblondie.ChangeView(10);
 cblondie.Animate(0, 6, eOnce, eBlock);
 object[8].Visible=true;
 cblondie.ChangeView(7);

 //PLUS MORE AS RANDOM INTS 


Would someone please assist

cheers


Atelier

#1
Something like:

Code: AGS

bool mybool;

function repeatedly_execute()
{
     if (!Enemy1a && !Enemy1b) mybool = true;
}

if (cryan.ActiveInventory == igrenade && mybool)


?

steptoe

Hi

I have already gone with another sure-fire option.

cheers


Crimson Wizard

A small hint.
Since the result of any condition is boolean value on its own, writing
Code: ags

if (!Enemy1a && !Enemy1b) mybool = true;

is considered a bit redundant. Simplier way is
Code: ags

mybool = !Enemy1a && !Enemy1b;

steptoe

Cheers Crimson Wizard,

Just to confirm (in case we have cross wires):

Enemy1a && Enemy1b are Ints that both start at 3 and when both reach 0 a bool becomes true.

Although I have chosen another option knowing this way may help me for later on.

cheers

While I'm here, I may as well slip this one in:

Rep Exec:

Is it possible to display Mouse Walk graphic while executing this code before changing modes?

Code: AGS
}
 if (mouse.Mode==eModeWalkto)
 {
 
 cryan.SpeechView=14;
 cryan.Say("I'm too busy reading this map to walk around!");
 mouse.SelectNextMode();
 }
 }


cheers again




SMF spam blocked by CleanTalk