Use score as money ?

Started by AndersM, Sun 16/11/2003 19:18:00

Previous topic - Next topic

AndersM

Can I do that?

I know that I can use 'GiveScore (-10);' if the player buys something that
costs $10, but can I add something that displays "You can't afford that" if the
score is less than 10? It does not have to be fancy, just something like
'if score<10 display message, else Givescore (-10); ad inventory...'

Please help

Kweepa

Ummm, it seems you have answered your own question.
:)
Still waiting for Purity of the Surf II

AndersM

#2

Quote from: SteveMcCrea on Sun 16/11/2003 19:21:45
Ummm, it seems you have answered your own question.

Do you realy mean that 'if score<10' works? I've never tried it..

Squinky

#3
I've never messed with the score thingt in ags, so I'd just use a globalint to store it. but either way is prolly good

if (GetGlobalInt (1)<=10){
Display ("You can't afford that");
Display ("You only have %d Dollars",GetGlobalInt (1));
}
else if (GetGlobalInt (1)>=10){
Display ("You purchase the stuff");
SetGlobalInt (1,GetGlobalInt (1)-10);
Display ("You have %d Dollars Left", GetGlobalInt (1));
}
}
Thats how I'd probably try it, might actaully be easier with the score though

Pumaman

The variable name is "game.score"

Kweepa

Quote from: MrMasse on Sun 16/11/2003 19:23:31
Do you realy mean that 'if score<10' works? I've never tried it..

Well, no, but a quick look at the manual reveals "game.score < 10" will work.
So,

// item costs 10 "dollars"
if (game.score < 10) { // do not use <= as in Squinky's code! :)
Display("You're too poor.");
}
else {
Display("You buy it. You feel a buzz of buyers' excitement, quickly followed by a pang of spendthrifts' guilt and a jolt of suckers' disappointment.");
GiveScore(-10);
AddInventory(1337);
}

Steve
Still waiting for Purity of the Surf II

Squinky

#6
Heh, whats wrong with my code? Works for me...

My understanding, from the manual is that:

> this will compare values and then proceed
>= This will dosent mention comparing in the manual, but works okay for me.

Is there truley any difference?

CB..

yu can alter the score text in the gui bar to read as money instead of score to add interest

GUI

status bar

Money @SCORE@ of @TOTALSCORE@ .


or

members of the voting public@SCORE@ of @TOTALSCORE@ .

whatever yu need

hmm a game to simulate a general election? as in that new republic idea? dont see why not..get enough votes win the game  

TerranRich

Squinky: > means "greater than", >= means "greater than OR equal to" :)
Status: Trying to come up with some ideas...

Squinky



Squinky

I got it to work by turning your "else" into an "else if". I think if you wanted to use else you need to get rid of that condition, otherwise if there is a condition, you should use else if....I believe, heh...

// script for character2: Talk to character
if (game.score < 10){
Display("You're too poor.");
}
else if (game.score > 10)
Display("You buy the item");
GiveScore(-10);
AddInventory(1);

AndersM

#12

Squinky

Well, if I understand you right, you should leave it at ten and change it to <=10....That would be more accurate?

Ginny

>=10 instead of >9 if I'm not mistaken, though either way works just aswell.
Try Not to Breathe - coming sooner or later!

We may have years, we may have hours, but sooner or later, we push up flowers. - Membrillo, Grim Fandango coroner

AndersM

I'm happy with it now. Maybe this is something for the 'technical archive' ?

SMF spam blocked by CleanTalk