ID:178643
 
world
name = "Sim City Online (Testing)"
hub = "Tazor07.Sim City Online"
New()
Calender()


proc/Calender()
Month = "January"
sleep(100)
Month = "February"
sleep(100)
Month = "March"
sleep(100)
Month = "April"
sleep(100)
Month = "May"
sleep(100)
Month = "June"
sleep(100)
Month = "July"
sleep(100)
Month = "August"
sleep(100)
Month = "September"
sleep(100)
Month = "October"
sleep(100)
Month = "November"
sleep(100)
Month = "December"
sleep(100)
Year += 1
Calender()
Tax()

proc/Tax()
usr << "Tax Time!"
sleep(5)
usr << "
Crime Rate lowered your tax by $[usr.CrimeI*2]"
usr.Cash -= usr.CrimeI*2
sleep(5)
usr << "Fires in the city lowered your tax by $[usr.FireI*2]"
usr.Cash -= usr.FireI*2
sleep(5)
usr << "
Pollution lowered your tax by $[usr.PollutionI*2]"
usr.Cash -= usr.PollutionI*2
sleep(5)
usr << "Fun in your city put your taxes up by $[usr.FunI*3]"
usr.Cash += usr.FunI*3
sleep(5)
usr << "
Taxing of your citizens put your taxes up by $[usr.PopI/2]"
usr.Cash += usr.PopI/2
sleep(5)
usr << "Total Tax $[usr.PopI/2+usr.FunI*3-usr.PollutionI*2-usr.FireI*2-usr.Crime I*2]"

How would you make everyone have do the tax proc?
mob
proc
tax()
//stuff here, oh and don't use usr in procs use src


And call it..

for(var/mob/M in world)
M.tax()
Make each mob start their own personal loop when they are created, something that works like this:

<code>mob/New() ..() spawn() MonthLoop() spawn() TaxLoop() mob/proc/MonthLoop() // do repeating month stuff</code>

Also, make note that you shouldn't repeat the same proc over and over the way you're doing, like this:

<code>proc/Loop() //whatever Loop()</code>

That will eventually cause the program to crash. Use one of the following alternative ways:

<code>proc/Loop() for() //repeating action proc/Loop() while() //repeating action proc/Loop() //repeating action spawn() Loop()</code>

In response to Nadrew
Nadrew wrote:
> mob
> proc
> tax()
> //stuff here, oh and don't use usr in procs use src
>
>

And call it..

> for(var/mob/M in world)
> M.tax()
>


I tried it but it doesnt seem to work