Adventure Game Studio

AGS Support => Beginners' Technical Questions => Topic started by: Icey on Sat 05/11/2011 17:24:55

Title: Multiplying game score with int.
Post by: Icey on Sat 05/11/2011 17:24:55
I never really tried multiplication in AGS before and now that I am I am having truoble.

I can't figure out how to set this line up

game.score *= Link;//Link = int

Can someone tell me what it is I'm doing wrong?
Title: Re: Multiplying game score with int.
Post by: pcj on Sat 05/11/2011 17:32:12
game.score is read-only.  Use GiveScore(game.score * 4);

See the manual for more info.
Title: Re: Multiplying game score with int.
Post by: Icey on Sat 05/11/2011 17:45:47
Thanks it works now.
Title: Give a int the games score
Post by: Icey on Sat 05/11/2011 23:24:54
Is there a way around this to get this to work?


@1
score = game.score;//Is there something else I could use in the place of game.score?


if(score <= 2000){

}


stop

[code]
[/code]
Title: Re: Multiplying game score with int.
Post by: pcj on Sat 05/11/2011 23:56:39
You can read game.score any time, no need to set it to another variable to check it.  It looks like this is in a dialog though so make sure you add one tab to use the script commands (see the "Using scripting commands in dialogs" section in "Setting up the game" in the manual)
Title: Re: Multiplying game score with int.
Post by: Icey on Sun 06/11/2011 00:16:27
I got it working but I have my last questions

The player is getting to much score points and it makes it go down into the negatives.

I would like to use this instead.

Link *= 50;// or something like it.

no no thats not right. I wanted to have it do something else so just give me a sec to think.


I wanted to have 50x2 then add that to the score.
Title: Re: Multiplying game score with int.
Post by: pcj on Sun 06/11/2011 00:22:23
You can manage score (and multiply it in another variable) then set it back to the real score with GiveScore:

int score = game.score;
score *= Link;
GiveScore(score - game.score);


I don't use score in my games but it seems like you could manage score in a custom variable (since it's basically just a global variable being displayed on a GUI anyway), but you would also have to add in any sound you wanted to make when it changed manually (and the on_event for the change wouldn't fire).
Title: Re: Multiplying game score with int.
Post by: Calin Leafshade on Sun 06/11/2011 02:12:40
i dont think AGS supports the *= operator.

I think it only has += and -=
Title: Re: Multiplying game score with int.
Post by: Icey on Sun 06/11/2011 03:15:44
@pcj: Thanks but I found away to around it.

@Calin: that maybe true but it would be nice if it was included.