Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: steptoe on Mon 26/09/2011 12:34:02

Title: SOLVED: Change mouse graphic (act.inv) +1 after clicking on an object solution
Post by: steptoe on Mon 26/09/2011 12:34:02
I have a variable: int switch_clicks; when the user clicks on an object with

appropriate inventory item the inv graphic shows on the mouse and it goes to

appropriate Display message.


What I am trying to do, but can't quite remember the script line, is to advance

the cursor graphic +1 (or new number) so that the mouse graphic changes and you

can click object again and graphic +1 (or new number).

After the 3rd click it displays a different text and ActiveInventory=null.

This is so I don't have to reopen inventory window again.

I have 3 graphics for 3 clicks.

Can someone please remind me?

cheers

UPDATE: This works but if you know better:


// SPIT PIPS

int switch_clicks;

function omixersw_UseInv()
{

switch_clicks++;
 
         if (switch_clicks ==1 && cChris.ActiveInventory==ipip)

{
          Display("You spit a pip and it narrowly misses the switch!");
  cChris.ActiveInventory=ipip;




}

   else if (switch_clicks ==2 && cChris.ActiveInventory==ipip)


{

Display("You spit a pip and it just misses the switch!");
cChris.ActiveInventory=ipip;

}

else if (switch_clicks ==3 && cChris.ActiveInventory==ipip)



{

      Display("You spit a pip and it catches the switch and turns it off!");
      object[19].Visible=true;
      object[17].Visible=false;
      object[11].SetView(67);
      object[11].Animate(1, 3, eRepeat, eNoBlock, eForwards);
      cChris.SayAt(165,86,200,"Rock on Tommy!!");
      object[11].SetView(67);
      cChris.ActiveInventory=null;
      cChris.LoseInventory(ipip);


}

     else if (switch_clicks   >3)
     
     {

      Display("The switch already is off!");



}
}