How would you setup a income stat


#1

so i’m making this game about a footballer and was wandering how would i setup a money and an income stat could you please tell me what to put in mygame.js, choicescriptstats and what to put it in when i’m writing my story e.g. he offers you a contract. what code should i write


#2

In mygame.js:

,money: 0
,income: 0

You can specify any starting value, doesn’t have to be zero.

In choicescript_stats.txt

Money: $${money}
Income: $${income}

Will display the current values of money & income with a dollar sign, e.g.

Money: $500

In the story use:

*set money +500 (or -500 etc)

to add or subtract to that value

If you don’t use +/- it will overwrite the current value with whatever you specify.

You can also tell the player the current value at any point in the story, e.g.

‘You have $${money} cash on you.’


#3

Off-topic, but important question: Footballer like Gerrard / Rooney or American Footballer?


#4

A good question–note that ChoiceScript doesn’t display the symbol for Pounds Sterling (it displays a question mark instead) only the Dollar symbol. If your game is about a British / European footballer I would suggest instead something like:

“You have ${money} pounds cash on you.”

With just the one dollar sign (this is needed to display a variable). This would display as (e.g.):

“You have 500 pounds cash on you.”


#5

footballer like gerrard or rooney


#6

what about income vendetta


#7

vendetta it keeps giving me error in In choicescript_stats.txt


#8

and how would you set it up so the income automatically adds to your money in evrey scene wt code


#9

I’d suggest copying & pasting your stats file here. Many would be able to help with any problems in that if they can see how you’ve done things. Knowing what the actual error message is as well also helps (always use Internet Explorer to test your game, for the full error messages).

For the income, there’s no ‘automatic’ way to do anything–you have to code precisely what it is you want to achieve. For instance, if you want ‘Income’ added to ‘Money’ you have to do this yourself at certain points in the story, e.g.

*set money + income

would add the current value of ‘income’ to the current value of ‘money’ wherever you put that line in the story. If you want gaining income to be a fairly regular thing, just insert that line at appropriate intervals.


#10

in mygame.js it is
,money: 0
,income: 0
and in mychoicescriptstats
Money: $${money}
Income: $${income}
it gives an error saying line 5 should start with text percent or opposed pair.
and when i write
text money: $${money}
text Income: $${income}
it just says on the stats screen $0 0


#11

It sounds like you’ve got your money & income lines within / below a *stat_chart command. Try it this way:

Money: $${money}
*line_break
Income: $${income}
*line_break
*stat_chart
(add chart info here, if you want to use one)

If you don’t actually use a stat chart for (e.g.) displaying your footballer’s skills, remove that line completely.

You also want to read the following to properly understand the stats page:


#12

thanks vendetta i finally done it


#13

Cool. I know it can all seem a bit confusing at first (that was me just nine or ten short weeks ago) but stick with it, it definitely gets easier. :slight_smile: