Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Knox on Wed 31/08/2011 16:40:52

Title: Basic script question **SOLVED**
Post by: Knox on Wed 31/08/2011 16:40:52
How can I simplify this code? I remember (I think) someone posting a simple way of expressing "if something is A, than make it B, if its B, make it A".

 if (btnCitation_Magnifier.NormalGraphic == 3289) btnCitation_Magnifier.NormalGraphic = 3291;
 else btnCitation_Magnifier.NormalGraphic = 3289;
Title: Re: Basic script question
Post by: Khris on Wed 31/08/2011 16:52:23
To alternate between two int values, subtract the current one from the sum.

  btnCitation_Magnifier.NormalGraphic = 6580 - btnCitation_Magnifier.NormalGraphic;
Title: Re: Basic script question
Post by: Knox on Wed 31/08/2011 16:57:32
Man that's smart!

Thanks Khris :)