Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: timlump on Wed 29/11/2006 22:24:05

Title: integer deduction
Post by: timlump on Wed 29/11/2006 22:24:05
sorry about my rather abrubt and noobish question but how do i deduct integers e.g
int=20

how do i deduct 1
so that if i run a script 1 is deducted.
Thanks in advance
Title: Re: integer deduction
Post by: strazer on Wed 29/11/2006 22:55:48
int myvariable = 20; // define an integer variable named myvariable and initialize it to 20

myvariable = myvariable - 1; // subtract 1 from myvariable's current value
myvariable--; // shorter version of the above
myvariable -= 1; // another alternative

myvariable = myvariable - 3; // subtract 3 from myvariable's current value
myvariable -= 3; // shorter version of the above
Title: Re: integer deduction
Post by: timlump on Thu 30/11/2006 15:25:34
thanks im very appreciative of your help.
Title: Re: integer deduction
Post by: strazer on Fri 01/12/2006 16:02:10
You're welcome! :)