Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Yo Mama! on Sun 02/05/2004 18:55:11

Title: Game Score Problem...
Post by: Yo Mama! on Sun 02/05/2004 18:55:11
I want to make the game score like the players money. I have it all figured out except for the part where you can buy things. How do I get it so that if the player has 250 or more it lets him "buy" something. Here is what I have so far:

if (game.score ==250) AddInventory(4);
else {DisplayMessage (8); StopDialog();}

But that only works if they have exactly 250. If the player is above or below it gives the message that he does not have enough money. There's probably some simple solution that I dont know of or something.
Title: Re: Game Score Problem...
Post by: Ben on Sun 02/05/2004 19:15:46
Use "greater than":

if (game.score > 249) AddInventory(4);
else {DisplayMessage (8); StopDialog();}
Title: Re: Game Score Problem...
Post by: Yo Mama! on Sun 02/05/2004 19:23:07
OH man I knew it would be something simple! I dont know why I didn't think of that! Thanks  ;D
Title: Re: Game Score Problem...
Post by: Akumayo on Sun 02/05/2004 21:41:34
You need to use >= instead of just greater than, otherwise if you have exactly 250, you can't purchase the item, unless of course they need one more dollar for tax ;D ;D wait, was that funny ???
Title: Re: Game Score Problem...
Post by: Gilbert on Mon 03/05/2004 03:08:44
Quote from: Akumayo on Sun 02/05/2004 21:41:34
You need to use >= instead of just greater than,

Well, Ben's code was "> 249", so using greater than is okay already. Of course ">=250" may look more readible sometimes.
Title: Re: Game Score Problem...
Post by: Akumayo on Mon 03/05/2004 23:46:36
Nununununo, only using greater than causes the game to think you need a value of "money" that is more than or greater than  250.  So you need to use >= 

Do you get it yet!!!
Title: Re: Game Score Problem...
Post by: Akumayo on Mon 03/05/2004 23:53:31
Though >249 may work, it is much more proper and legible to write >= 250, this way the same amount of money will always be recognized, ommiting confusion.

Warning:  Words with strikethroughs may be to complicated for some weaker minds!!!

I
just
love
glows!
Title: Re: Game Score Problem...
Post by: Yo Mama! on Tue 04/05/2004 04:44:15
Well thanks for all the concern but I figured it all out already  ;D! I just used the >=
Title: Re: Game Score Problem...
Post by: Gilbert on Tue 04/05/2004 04:49:47
Akamayo: Why argue about using > or >=? They both work and are clear, as long as you can understand your own codes well, it's just left to the programmer himself to decide which to use.