Multiplying game score with int.

Started by Icey, Sat 05/11/2011 17:24:55

Previous topic - Next topic

Icey

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?

pcj

#1
game.score is read-only.  Use
Code: ags
GiveScore(game.score * 4);


See the manual for more info.
Space Quest: Vohaul Strikes Back is now available to download!

Icey


Icey

Is there a way around this to get this to work?

Code: ags

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


 if(score <= 2000){
 
 }
 
 
stop

[code]
[/code]

pcj

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)
Space Quest: Vohaul Strikes Back is now available to download!

Icey

#5
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.

pcj

You can manage score (and multiply it in another variable) then set it back to the real score with GiveScore:

Code: ags
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).
Space Quest: Vohaul Strikes Back is now available to download!

Calin Leafshade

i dont think AGS supports the *= operator.

I think it only has += and -=

Icey

@pcj: Thanks but I found away to around it.

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

SMF spam blocked by CleanTalk