Netlogo- how to perform a procedure every 30 ticks

214 Views Asked by At

how can i make a precise procedure every 30 ticks?I have written this procedure in "to go". i tried to write like this:

    'to go
     if count population with [underPovertyLine] = count population   or 
     count firms = 0 [stop]

     ask population [
     set min-indiv-cost-of-living  runresult  [max-indiv-cost-of-living]
     ]

    if ticks mod 30 = 0 [
    ask population with [employed = false and color = grey] [
    set mymoneyOnBankOfGrey runresult [moneyOnBankOfGrey -  min-indiv- 
    cost-of-living]
    if  mymoneyOnBankOfGrey < 0 [die]
    ]
    ask population with [employed = false and color = blue ] [
    set mymoneyOnBankOfBlue runresult[ moneyOnBankOfBlue - min-indiv-cost- 
    of-living]
    if   mymoneyOnBankOfBlue < 0 [die]
    ]
   ask population with [employed = false and color = red] [
   set mymoneyOnBankOfRed runresult [ moneyOnBankOfRed - min-indiv-cost- 
   of-living]
  if  mymoneyOnBankOfRed < 0 [die]
  ]

   ask population with [employed = true and color = grey] [
   set mymoneyOnBankOfGrey runresult[ moneyOnBankOfGrey + wage - min- 
   indiv-cost-of-living]
    if  mymoneyOnBankOfGrey < 0 [die]
   ]
   ask population with [employed = true and color = blue] [
   set mymoneyOnBankOfBlue runresult [ moneyOnBankOfBlue + wage - min- 
   indiv-cost-of-living]
  if   mymoneyOnBankOfBlue < 0 [die]
  ]
  ask population with [employed = true and color = red ] [
  set mymoneyOnBankOfRed runresult [ moneyOnBankOfRed + wage - min-indiv- 
  cost-of-living]
    if  mymoneyOnBankOfRed < 0 [die]
  ]


  ]
  tick
  end'  
    

I would like the procedure to take place every 30 ticks but it happens only 1 time at the 30th tick and it stops and it does not update. how can i fix it?? thanks!!

0

There are 0 best solutions below