/* + Starve: a pipelines version of foodchck. + If you are playing a game with a strange MAX_POP in a sector you can + change the MAX_POP variable to indicate the max number of civs and + uws in a sector. + Another fine product from Dwarven Developments + USAGE: /pipe dump * >> FILTER starve | console + sends output to the screen. + /pipe dump * >> FILTER starve | > starve file a + sends output to the file STARVE FILE A + Requires: makevers exec to set the globalvs or you can set the game + parameters by hand if you like. */ signal on error MAX_POP=999; starves=0 /* Get the game parameters */ address cms GLOBALV SELECT EMPIRE STACK GAME ETU CBRATE UWBRATE FRATE BFRATE pull GAME; pull ETU; pull CBRATE; pull UWBRATE; pull FRATE; pull BFRATE /* Read off the 1st 3 lines */ 'readto data'; 'readto data'; 'readto data' do forever 'readto data' parse var data x y des . . . . . . . . . . . . civ mil uw food . if y='sectors' then leave /* If end of dump leave loop */ civbabies=civ* CBRATE*ETU/1000 /* Calc # of civ babies */ uwbabies = uw*UWBRATE*ETU/1000 /* Calc # of uw babies */ if civbabies+civ>MAX_POP then civbabies=MAX_POP-civ if uwbabies + uw>MAX_POP then uwbabies=MAX_POP-uw adult_food=(civ+mil+uw)/1000*FRATE*ETU /* Find food needed for pop */ baby_food=(civbabies+uwbabies)*BFRATE/1000 /* Food needed for babies */ needed=adult_food+baby_food if (needed-food)>1 then do if starves=0 then do 'output x,y des civ mil uw food needed' end starves=starves+1 starving=right(x,4)','left(y,4) des right(civ,4) right(mil,4) right(uw,4) right(food,5) format(needed-food,3,2) 'output' starving end end 'output' right(starves,6) 'sectors' /* Number of starving sectors */ do forever /* Show any other text in file */ 'readto data' /* such as new teles etc. */ 'output' data end error: exit RC*(RC<>12)