Discuss Scratch
- Discussion Forums
- » Help with Scripts
- » Tax Script
- RickCall12
-
100+ posts
Tax Script
Hey guys.
I'm currently making a City Building game which requires the need for a Tax Script.
I've been practicing with a few, but they don't achieve what I need.
((Population / 2) + Money)
(Population * TaxRate)
What is want is, the population each pays a set tax rate, which can be defined by the player.
So if the tax rate is 5%, everyone pays 5% of their income.
How might I simulate all of this?
I haven't got a defined/predefined income yet, if its necessary.
I don't know, does anyone have any ideas for this?
I'm currently making a City Building game which requires the need for a Tax Script.
I've been practicing with a few, but they don't achieve what I need.
((Population / 2) + Money)
(Population * TaxRate)
What is want is, the population each pays a set tax rate, which can be defined by the player.
So if the tax rate is 5%, everyone pays 5% of their income.
How might I simulate all of this?
I haven't got a defined/predefined income yet, if its necessary.
I don't know, does anyone have any ideas for this?
- coke11
-
1000+ posts
Tax Script
Hi,
It would really help if you could provide a link to your project.
Thanks!
coke11
It would really help if you could provide a link to your project.
Thanks!
coke11
- deck26
-
1000+ posts
Tax Script
Not sure what the problem is - you store the current rate as a variable.
Tax paid = income * rate/100
Income after tax = income * (100 - rate) / 100
Tax paid = income * rate/100
Income after tax = income * (100 - rate) / 100
- RickCall12
-
100+ posts
Tax Script
Sorry, here's the link Hi,
It would really help if you could provide a link to your project.
Thanks!
coke11
https://scratch.mit.edu/projects/71983440/
- RickCall12
-
100+ posts
Tax Script
That formula would work if the population in the game had a method of income, but I don't know how to simulate all of that yet. Not sure what the problem is - you store the current rate as a variable.
Tax paid = income * rate/100
Income after tax = income * (100 - rate) / 100
- deck26
-
1000+ posts
Tax Script
So the question was about simulating the income rather than handling the tax!That formula would work if the population in the game had a method of income, but I don't know how to simulate all of that yet. Not sure what the problem is - you store the current rate as a variable.
Tax paid = income * rate/100
Income after tax = income * (100 - rate) / 100
Presumably the income for the population can depend on various things - population size, (un)employment level, type of work available etc - so I'd start by thinking about things like that.
Last edited by deck26 (Aug. 1, 2015 17:34:05)
- RickCall12
-
100+ posts
Tax Script
Well.. I want a system that provides money based on the population.So the question was about simulating the income rather than handling the tax!That formula would work if the population in the game had a method of income, but I don't know how to simulate all of that yet. Not sure what the problem is - you store the current rate as a variable.
Tax paid = income * rate/100
Income after tax = income * (100 - rate) / 100
Presumably the income for the population can depend on various things - population size, (un)employment level, type of work available etc - so I'd start by thinking about things like that.
Maybe I can have a look at the employment etc. But it might mean changing how the game functions.
- wkelly42
-
100+ posts
Tax Script
If you just want money based on population, set income to something like 2 per person. Total income = population * 2, tax = total income *.05 Well.. I want a system that provides money based on the population.
Maybe I can have a look at the employment etc. But it might mean changing how the game functions.
- RickCall12
-
100+ posts
Tax Script
I wrote these scripts to simulate incomes. There are some errors that I cannot identify. For instance, is sometimes changes the Money value to Infinity. When I checked some of the variables, some of the values were also Infinity. But I cannot identify where these are coming from.
(Sorry about the scriptblock errors above, I don't know how to fix these.)
Last edited by RickCall12 (Aug. 1, 2015 19:44:17)
- RickCall12
-
100+ posts
Tax Script
I might try that formula if I can't get simulated incomes to work.If you just want money based on population, set income to something like 2 per person. Total income = population * 2, tax = total income *.05 Well.. I want a system that provides money based on the population.
Maybe I can have a look at the employment etc. But it might mean changing how the game functions.
- deck26
-
1000+ posts
Tax Script
Make sure that Taxes has a value before you run the ‘change Money’ block or you'll get a divide by zero error. Same with other calculations, anything you're dividing by must be non-zero.
- KingCatboy90000
-
12 posts
Tax Script
Hey dude, I just made a tax calculator for the game, and I hope it helps 
https://scratch.mit.edu/projects/72005248/

https://scratch.mit.edu/projects/72005248/
- RickCall12
-
100+ posts
Tax Script
Project isn't shared so I can't view it. Hey dude, I just made a tax calculator for the game, and I hope it helps
https://scratch.mit.edu/projects/72005248/
- RickCall12
-
100+ posts
Tax Script
Taxes have a default value of 5 but can be changed by the player. Make sure that Taxes has a value before you run the ‘change Money’ block or you'll get a divide by zero error. Same with other calculations, anything you're dividing by must be non-zero.
- RickCall12
-
100+ posts
Tax Script
Still having trouble with the script.
Tests have come up with “infinity” being added to the money, of which I don't know how to resolve.
Any way to fix this or should I try a different script?
Tests have come up with “infinity” being added to the money, of which I don't know how to resolve.
Any way to fix this or should I try a different script?
Last edited by RickCall12 (Aug. 3, 2015 00:12:03)
- RickCall12
-
100+ posts
Tax Script
Hey, I think I worked it out.
I made this project to help me, I think the problem with the original tax code was a lack of variables.
https://scratch.mit.edu/projects/72149214/#player
I made this project to help me, I think the problem with the original tax code was a lack of variables.
https://scratch.mit.edu/projects/72149214/#player
- Discussion Forums
- » Help with Scripts
-
» Tax Script