Revised 2006-09-03 DMB
Generated Wed Dec 8 14:18:59 2010 by make_actions_html

Return to the Index | The Events File | The Analyze File

# List of Actions

## Action Categories

There is a large library of actions available for scheduling as events. Additionally, all of these actions can be used within analyze scripts. Below you will find a listing of the high level groupings of these actions, along with detailed sections for each them.

Print
  Print actions are the primary way of saving data from an Avida experiments.
Population
  Population actions modify the state of the population, and will actually change the course of the run.
Environment
  Actions that allow user to change properties of the environment, including resources.
Save and Load
  Actions that allow for saving and loading large data sets, such as full populations.
Landscape Analysis
  Actions that use data from the current state of Avida, process it and then output the results.
Driver
  Actions that allow user to control program execution, including experiment termination.

For a brief overview of writing a new action, please see Creating an Action below.

## Alphabetical Listing of Available Actions

AnalyzeLandscape AnalyzePopulation AssignRandomCellData AttackDen AvidianConjugation CalcConsensus ChangeEnvironment CompeteDemes CompeteDemes_AttackKillAndEnergyConserve CompeteDemesByEnergyDistribution CompeteDemesByNetwork CompeteDemesByTaskCount CompeteDemesByTaskCountAndEfficiency CompeteOrganisms ConnectCells CopyDeme CountMultipleOpinions CountOpinions DecayPoints DelayedDemeEvent DelayedDemeEventsPerSlots DeletionLandscape DemeBalanceTwoTasks DemeReactionDiversity DemeResourceThresholdPredicate Desynchronization DiffuseHGTGenomeFragments DisconnectCells DistributeData DistributeDataCheaply DistributeDataEfficiently DivideDemes DumpCellDataGrid DumpClassificationIDGrid DumpDonorGrid DumpEnergyGrid DumpExecutionRatioGrid DumpFitnessGrid DumpGenotypeColorGrid DumpHostTaskGrid DumpLandscape DumpMemory DumpParasiteTaskGrid DumpPhenotypeIDGrid DumpReactionGrid DumpReceiverGrid DumpSleepGrid DumpTaskGrid Echo Exit ExitAveGeneration ExitAveLineageLabelGreater ExitAveLineageLabelLess ExitDemeReplications ExitElapsedTime Flash FlushTopNavTrace FullLandscape HillClimb Inject InjectAll InjectAllRandomRepro InjectDemes InjectDemesFromNest InjectDemesRandom InjectGroup InjectModuloDemes InjectParasite InjectParasitePair InjectRandom InjectRange InjectResource InjectScaledResource InjectSequence InjectSequenceWDivMutRate InsertionLandscape IteratedConsensus JoinGridCol JoinGridRow KillFractionInSequence KillFractionInSequence_PopLimit KillInstLimit KillInstPair KillNBelowResourceThreshold KillProb KillRate KillRectangle KillWithinRadiusBelowResourceThreshold KillWithinRadiusBelowResourceThresholdTestAll KillWithinRadiusMeanBelowResourceThreshold LoadPopulation MeasureDemeNetworks MixPopulation ModMutProb MutationalNeighborhood NewTrial OutflowScaledResource PairTestLandscape | Pause PrecalcLandscape Pred_DemeEventMoveBetweenTargets Pred_DemeEventMoveCenter Pred_DemeEventNUniqueIndividualsMovedIntoTarget PredictNuLandscape PredictWLandscape PrintAgePolyethismData PrintAveNumTasks PrintAverageData PrintAvgDemeTasksExeData PrintAvgTreatableDemeTasksExeData PrintAvgUntreatableDemeTasksExeData PrintCCladeCounts PrintCCladeFitnessHistogram PrintCCladeRelativeFitnessHistogram PrintCellData PrintCellVisitsData PrintCompetitionData PrintConsensusData PrintCountData PrintCurrentMeanDemeDensity PrintCurrentOpinions PrintCurrentReactionData PrintCurrentReactionRewardData PrintCurrentTaskCounts PrintData PrintDebug PrintDemeAllStats PrintDemeAverageData PrintDemeCompetitionData PrintDemeCurrentTaskExeData PrintDemeDonorStats PrintDemeEnergyDistributionStats PrintDemeEnergySharingStats PrintDemeFoundersData PrintDemeGlobalResources PrintDemeMigrationSuicidePoints PrintDemeNetworkData PrintDemeNetworkTopology PrintDemeOrgReactionData PrintDemeOrgTasksData PrintDemeOrgTasksExeData PrintDemeReactionData PrintDemeReactionDiversityReplicationData PrintDemeReplicationData PrintDemeResourceStats PrintDemeResourceThresholdPredicate PrintDemeSpacialEnergyStats PrintDemeSpacialSleepStats PrintDemeStats PrintDemesTotalAvgEnergy PrintDemeTasksData PrintDemeTasksExeData PrintDemeTestamentStats PrintDemeTreatableCount PrintDemeTreatableReplicationData PrintDemeUntreatableReplicationData PrintDepthHistogram PrintDetailedFitnessData PrintDetailedSynchronizationData PrintDirectReciprocityData PrintDivideMutData PrintDominantData PrintDominantGenotype PrintDominantGroupGenotypes PrintDominantForagerGenotypes PrintDonationStats PrintDynamicMaxMinData PrintEditDistance PrintErrorData PrintExtendedTimeData PrintFlowRateTuples PrintGeneticDistanceData PrintGenomicSiteEntropy PrintGenotypeAbundanceHistogram PrintGermlineData PrintGroupIds PrintGroupsFormedData PrintHGTData PrintHostPhenotypeData PrintHostTasksData PrintInstructionAbundanceHistogram PrintInstructionData PrintInternalTasksData PrintInternalTasksQualData PrintInterruptData PrintLineageCounts PrintLineageTotals PrintLogFitnessHistogram PrintMarketData PrintMessageData PrintMessageLog PrintMigrationData PrintMiniTraces PrintMicroTraces PrintMultiProcessData PrintMutationRateData PrintNewReactionData | PrintNewTasksData PrintNewTasksDataPlus PrintNumOrgsInDeme PrintNumOrgsKilledData PrintOpinionsSetPerDeme PrintParasiteData PrintParasitePhenotypeData PrintParasiteTasksData PrintPerDemeGenPerFounderData PrintPerDemeReactionData PrintPerDemeTasksData PrintPerDemeTasksExeData PrintPhenotypeData PrintPhenotypeStatus PrintPhenotypicPlasticity PrintPlasticGenotypeSummary PrintPopulationDistanceData PrintPredicatedMessages PrintProfilingData PrintReactionData PrintReactionExeData PrintReactionRewardData PrintRelativeFitnessHistogram PrintReproData PrintReputationData PrintResourceData PrintResourceLocData PrintResWallLocData PrintSenseData PrintSenseExeData PrintShadedAltruists PrintSimpleConsensusData PrintSleepData PrintSpeciesAbundanceHistogram PrintStatsData PrintStringMatchData PrintSynchronizationData PrintTaskProbHistogram PrintTasksData PrintTasksExeData PrintTaskSnapshot PrintTasksQualData PrintTimeData PrintTopNavTrace PrintTotalsData PrintVarianceData PrintViableTasksData RandomLandscape RemovePredators ReplaceFromGermline ReplicateDemes ResetDemes SampleLandscape SaveDemeFounders SaveFlameData SavePopulation SerialTransfer SetCellResource SetConfig SetDemeResource SetDemeResourceInflow SetDemeResourceOutflow SetEnvironmentInputs SetEnvironmentRandomMask SetFracDemeTreatable SetGradientResource SetGradientInflow SetGradientOutflow SetGradientConeInflow SetGradientConeOutflow SetGradientPlatInflow SetGradientPlatOutflow SetGradPlatVarInflow SetMigrationRate SetMutProb SetNumInstBefore0Energy SetOptimizeMinMax SetPopCapEnforcement SetPeriodicResource SetPredatoryResource SetProbabilisticResource SetReactionInst SetReactionMaxTaskCount SetReactionMinTaskCount SetReactionTask SetReactionValue SetReactionValueMult SetResource SetResourceInflow SetResourceOutflow SetSeasonalResource SetSeasonalResource10Kyears_1To_1 SetSeasonalResource1Kyears_1To_1 SetTaskArgDouble SetTaskArgInt SetTaskArgString SetVerbose SeverGridCol SeverGridRow StopFastForward SwapCells Synchronization TestDominant TherapyDecayDemeResource TherapyStructuralNumInst TherapyStructuralRatioDistBetweenNearest ToggleFitnessValley ToggleRewardInstruction TrackAllMessages UnitFitness VERBOSE ZeroMuts ZeroResources

## Driver Actions

These actions control the driver object responsible for executing the current run.

- Exit No Arguments

  Unconditionally terminate the current run.

- ExitAveGeneration <double generation>

- ExitAveLineageLabelGreater <double threshold>

  Halts the run if the current average lineage label is larger than threshold.

- ExitAveLineageLabelLess <double threshold>

  Halts the run if the current average lineage label is smaller than threshold.

- ExitDemeReplications

- ExitElapsedTime <int elapsed time [seconds]>

- Pause No Arguments

- StopFastForward none

## Environment Actions

Events that allow user to change environment properties, such as resources and reaction parameters.

- ChangeEnvironment <string env_string>

  Action designed to read in and process a line formatted as if it were in the environment file. This will change environmental settings on the fly. You should create all resources and reactions in the environment file and only use this file to change these resources and reactions.
  All resources in the environment (other than the one specified in this event) will be reset to last used initial conditions.

- DelayedDemeEvent <int x1> <int y1> <int x2> <int y2> <int delay> <int duraion> <bool static_position> <int total_events>

- DelayedDemeEventsPerSlots <int x1> <int y1> <int x2> <int y2> <int delay> <int duraion> <bool static_position> <int total_slots_per_deme> <int total_events_per_slot_max> <int total_events_per_slot_min> <int tolal_event_flow_levels>

- InjectResource <string res_name> <double res_count>

  Inject (add) a specified amount of a specified resource. res_name must already exist as a resource in environment file.

- InjectScaledResource <string res_name> <double res_count>

- OutflowScaledResource <string res_name> <double res_percent>

- SetCellResource <int cell_id> <string res_name> <double res_count>

- SetConfig <string config_var> <string value>

- SetDemeResource <string res_name> <double res_count>

- SetDemeResourceInflow <int deme id> <string resource_name> <int inflow>

- SetDemeResourceOutflow <int deme id> <string resource_name> <int outflow>

- SetEnvironmentInputs <int input_1> <int input_2> <int input_3>

  Set the inputs that all organisms get from the environment when doing IO to these specific values. There must be exactly three inputs, and they must have the usual values for the top 8 "key" bits, i.e. they must be of the form 0x0F?????? 0x33?????? 0x55?????? where ? can be replaced with any hexadecimal digit.

- SetEnvironmentRandomMask <int mask>

- SetFracDemeTreatable

- SetGradientResource <string env_string>

  Action designed to read in and process a line for ONE gradient resource, formatted as if it were in the environment file. This will change environmental settings for this one gradient resource on the fly. You should create the resource in the environment file and only use this file to change this resource.
  Unlike with ChangeEnvironment, no resources other than the one specified in the event will be affected.

- SetGradientInflow <string res_name> <double res_inflow>

  Set existing gradient resource plateau inflow rate to a new value, without redrawing the entire resource.

- SetGradientOutflow <string res_name> <double res_outflow>

  Set existing gradient resource plateau outflow rate to a new value, without redrawing the entire resource.

- SetGradientConeInflow <string res_name> <double res_inflow>

- SetGradientConeOutflow <string res_name> <double res_outflow>

- SetGradientPlatInflow <string res_name> <double res_inflow>

- SetGradientPlatOutflow <string res_name> <double res_outflow>

- SetGradPlatVarInflow <string res_name> <double mean> <double variance> <int type>

  Set existing gradient resource plateau inflow rate to a new value, without redrawing the entire resource, based on a random number pull from normal distribution of this mean and variance. As such, this uses a half normal or folded normal approach with expected value = sigma * sqrt(2 /pi). If type == 0, new inflow will be the random number pulled. If type > 0, new inflow will be mean + abs(the random number pulled). If type == 1, new inflow will be max (0, mean - abs(the random number pulled)). If type == 2, new inflow will be max (0, mean + the random number pulled).

- SetNumInstBefore0Energy <int new_value>

- SetOptimizeMinMax No Arguments

- SetPeriodicResource <string reaction_name> <string amplitude> <string pi/frequence> <phaseShift*pi> <string initial_Y>

- SetPopCapEnforcement [int cap=0] [int rate=1]

  Will set POPULATION_CAP to cap and begin killing orgs off at rate rate by killing rate # orgs + 1 every time a new org is born. Accepts string args (e.g. SetPopCapEnforcement cap=0:rate=1).

- SetPredatoryResource <string res_name> <double kill_odds> <int guarded_juvs_per_adult>double detection_prob>

  A gradient resource with teeth. If set in motion, will kill with prob kill_odds 1 random org in each cell of plateau. If it passes over a den resource, will kill unguarded offspring with probability kill_odds. If an org steps on the resource, the org is killed with probability kill_odds. detection_prob sets the probability of orgs detecting the predator via look sensors.

- SetProbabilisticResource <string res_name> <double initial> <double inflow> <double outflow> <double lambda> <double theta> <int x> <int y> <int num >

  A gradient resource with probabilistically distributed cells. If x and y are not specified, a random 'seed' cell is chosen. That cell is given the initial value. Then, we look at all of the other cells in the world and add resource with prob = PDF from half normal distribution given lambda and the current distance from the center cell. Normally you'd leave theta for the PDF alone at the fixed value of 0. However, you can do things like set lambda = 1 and theta to 10 to get 'rings' (larger theta == larger rings). If num is specified, we will randomly select and test each cell in the world, looping through unused cells over and over until the num quota is reached. If num is not specified, we walk through and test each cell in the world only once. When looping, we give up when we have looped either 1000 times or world_size number of times, whichever is less. Arguements are specified in the form theta=4.0:num=7, etc not as unlabeled column arguements.

  Defaults are: res_name = name of first res in environment file, initial = 0.0, inflow = 0.0, outflow = 0.0, lambda = 1.0, theta = 0.0, x = -1 (random), y = -1 (random), num = -1.

- SetReactionInst <string reaction_name> <string inst>

  Set the instruction triggered by this reaction. reaction_name must already exist in the environment file. inst must be in the instruction set.

- SetReactionMaxTaskCount <string reaction_name> <int max_count>

  Set the max task count required to trigger a reaction to task_count. reaction_name must already exist in the environment file.

- SetReactionMinTaskCount <string reaction_name> <int min_count>

  Set the min task count required to trigger a reaction to task_count. reaction_name must already exist in the environment file.

- SetReactionTask <string reaction_name> <string task_name>

  Set the task required to trigger a reaction to task_name. reaction_name and task_name must already exist in the environment file.

- SetReactionValue <string reaction_name> <double value>

  Set the reaction value to a specific level. reaction_name must already exist in the environment file. value can be negative.

- SetReactionValueMult <string reaction_name> <double value>

  Multiply the reaction value by the value. reaction_name must already exist in the environment file. value can be negative.

- SetResource <string res_name> <double res_count>

  Set the resource amount to a specific level. res_name must already exist as a resource in environment file.

- SetResourceInflow <string resource_name> <int inflow>

  Set the resource inflow to a specific level. res_name must already exist as a resource in environment file.

- SetResourceOutflow <string resource_name> <int outflow>

  Set the resource outflow to a specific level. res_name must already exist as a resource in environment file.

- SetSeasonalResource

  Sets resource availiblity to seasonal

- SetSeasonalResource10Kyears_1To_1

  Sets resource availiblity to seasonal 1 to -1 for 10K years of 365 updates

- SetSeasonalResource1Kyears_1To_1

  Sets resource availiblity to seasonal 1 to -1 for 1K years of 365 updates

- SetTaskArgDouble <int task> <int arg> <double value>

- SetTaskArgInt <int task> <int arg> <int value>

- SetTaskArgString <int task> <int arg> <string value>

- ZeroResources none

  Set all resurce levels to zero.

## Landscape Analysis Actions

Landscape analysis actions perform various types mutation studies to calculate properties of the fitness landscape for a particular genome. When scheduled as an event during a run, these actions will typically perform analysis on the dominant genotype. In analyze mode, analysis is performed on the entire currently selected batch.

These actions are often very computationally intensive, thus will take a long time to compute. In order to take advantage of increasingly available multi-processor/multi-core systems, a number of these actions have been enhanced to make use of multiple threads to parallize work. Set the configuration setting `MT_CONCURRENCY` to the number of logical processors available to make use of all processor resources for these compuations.

- AnalyzeLandscape [filename="land-analyze.dat"] [int trials=1000] [int min_found=0] [int max_trials=0] [int max_dist=10]

- AnalyzePopulation [double sample_prob=1] [int landscape=0] [int save_genotype=0] [string filename=""]

- DeletionLandscape [string filename="land-del.dat"] [int distance=1] [string sitecount_file=""]

- DumpLandscape [string filename="land-dump.dat"]

- FullLandscape [string filename="land-full.dat"] [int distance=1] [string entropy_file=""] [string sitecount_file=""]

  Do a landscape analysis of the dominant genotype or current batch of genotypes, depending on the current mode. The resulting output is a collection of statistics obtained from examining all possible mutations at the distance specified. The default distance is one.

- HillClimb [string filename="hillclimb.dat"]

  Does a hill climb with the dominant genotype.

- InsertionLandscape [string filename="land-ins.dat"] [int distance=1] [string sitecount_file=""]

- MutationalNeighborhood [string fname="mut-neighborhood.dat"] [int target=-1]

- PairTestLandscape [string filename=""] [int sample_size=0]

  If sample_size = 0, pairtest the full landscape.

- PrecalcLandscape No Arguments

  Precalculate the distance 1 full landscape for the current batch in parallel using multiple threads. The resulting data is stored into the current batch and can be used by many subsequent output commands within Analyze mode.

- PredictNuLandscape [string filename="land-predict.dat"]

- PredictWLandscape [string filename="land-predict.dat"]

- RandomLandscape [string filename="land-random.dat"] [int distance=1] [int trials=0]

- SampleLandscape [string filename="land-sample.dat"] [int trials=0]

## Population Actions

Population events modify the state of the population, and will actually change the course of the run. There are a wide variety of these.

- AssignRandomCellData [num_cells=deme_size]

- AttackDen [double probability=0.0] [int juvs_per_adult=1]

  Kills each unguarded juv in dens (habitat == 3 or 4) with set probability. juvs_per_adult sets the ratio of guarding adults to juvs. E.g. if ratio is set to 5 and there are 2 guards and 12 juveniles in a den, two random juveniles will be attacked with their probability of death at the set probability.

- AvidianConjugation

- CompeteDemes [int type=1]

- CompeteDemes_AttackKillAndEnergyConserve No Arguments

- CompeteDemesByEnergyDistribution Competes demes according to the distribution of energy among the organisms

- CompeteDemesByNetwork

- CompeteDemesByTaskCount Competes demes according to the number of times a given task has been completed within that deme

  Competes demes based on the total number of times that a task has been completed by an organism in the deme since the was initialized. This action takes one integer parameter representing number of the task that is to be used for competition. If no parameter supplied, the class uses the first task defined in the environment file compete the demes.

- CompeteDemesByTaskCountAndEfficiency Competes demes according to the number of times a given task has been completed within that deme and the efficiency with which it was done

- CompeteOrganisms [int type=0] [int parents_survive=0] [double scaled_time=1.0] [int dynamic_scaling=0]

  Calculates fitness of each organism in the population and creates a new population of descendants where each organism has a chance of replication proportional to its fitness. Can be used to make Avida operate without population dynamics and asynchronous replication, i.e. like a genetic algorithm. If NewTrial events have occurred since the last CompeteOrganisms event, then the average fitness over those trials will be used.

  `competition_type` controls how the fitnesses of multiple trials determine the overall fitness used for the competition: 0=geometric mean of fitnesses, 1=scaled geometric mean of fitnesses (the greatest fitness of each trial is scaled to 1.0 before taking the geometric mean), 2=arithmetic mean, 3=geometric mean plus rescales effective fitness values by the geometric mean of the difference from the top score and the median.

  Setting `parents_survive` to 1, causes the first copy of an organism that makes it into the new population to be the original (unmutated) parent organism.

- ConnectCells <int cellA_x> <int cellA_y> <int cellB_x> <int cellB_y>

  Connects a pair of specified cells.

- CopyDeme <int src_id> <int dest_id>

- CountMultipleOpinions

- CountOpinions

- DecayPoints

  Decays the number of points a deme has accumulated by a percentage that is set in the configuration file.

- DemeBalanceTwoTasks

- DemeReactionDiversity

- DemeResourceThresholdPredicate

- Desynchronization

- DiffuseHGTGenomeFragments

- DisconnectCells <int cellA_x> <int cellA_y> <int cellB_x> <int cellB_y>

  Disconnects a pair of specified cells.

- DistributeData

- DistributeDataCheaply

- DistributeDataEfficiently

- DivideDemes No arguments (yet!)

- Flash

- FlushTopNavTrace Force printing of nav trace (as set up by PrintTopNavTrace) even if all candidate orgs have not been evaluated / reproduced.

- Inject [string fname="START_ORGANISM"] [int cell_id=0] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]

  Inject a single organisms into the population. Arguments must be included from left to right; if all arguments are left out, the default creature is the ancestral organism, and it will be injected into cell 0, have an uninitialized merit, and be marked as liniage id 0.

- InjectAll [string fname="START_ORGANISM"] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]

  Same as Inject, but no cell_id is specified and the organism is placed into all cells in the population.

- InjectAllRandomRepro <int length> [double merit=-1] [int lineage_label=0] [double neutral_metric=0]

- InjectDemes [string fname="START_ORGANISM"] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]

- InjectDemesFromNest [int num_orgs=1] [int nest_cellid=0] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]

- InjectDemesRandom [int num_orgs=1] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]

- InjectGroup [string fname=\"START_ORGANISM\"] [int cell_id=0] [int group_id=-1] [int forager_type=-1] [bool trace=0] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]

  Inject a single organisms into the population with the specified group_id (opinion) and foraging target along with other options as in Inject. Trace will setup minitrace for injected org.

- InjectModuloDemes

- InjectParasite <string filename> <string label> [int cell_start=0] [int cell_end=-1]

  Attempt to inject a parasite genome into the supplied population cell range with the specified label.

- InjectParasitePair <string filename_genome> <string filename_parasite> <string label> [int cell_start=0] [int cell_end=-1] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]

  Inject host parasite pairs into the population cell range specified.

- InjectRandom <int length> [int cell_id=0] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]

  Injects a randomly generated genome of the supplied length into the population.

- InjectRange [string fname="START_ORGANISM"] [int cell_start=0] [int cell_end=-1] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]

  Injects identical organisms into a range of cells of the population.

  Example:
  `InjectRange 000-aaaaa.org 0 10`
  Will inject 10 organisms into cells 0 through 9.

- InjectSequence <string sequence> [int cell_start=0] [int cell_end=-1] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]

  Injects identical organisms based on the supplied genome sequence into a range of cells of the population.

  Example:
  `InjectSequence ckdfhgklsahnfsaggdsgajfg 0 10 100`
  Will inject 10 organisms into cells 0 through 9 with a merit of 100.

- InjectSequenceWDivMutRate <string sequence> [int cell_start=0] [int cell_end=-1] [double div_mut_rate=0] [double merit=-1] [int lineage_label=0] [double neutral_metric=0]

- IteratedConsensus [int compete_period=100 [int replace_number=1 [int kill=1 [int restrict_range=1]]]]

- JoinGridCol [int col_id=-1] [int min_row=0] [int max_row=-1]

  Add connections between cells along a column in an Avida grid.

- JoinGridRow [int row_id=-1] [int min_col=0] [int max_col=-1]

  Add connections between cells along a row in an Avida grid.

- KillFractionInSequence

- KillFractionInSequence_PopLimit

- KillInstLimit

- KillInstPair

- KillNBelowResourceThreshold [int numkills=0, string resource name, double threshold=0]

- KillProb [double probability=0.9]

  Using the specified probability, test each organism to see if it is killed off.

- KillRate [double probability=0.9]

  Randomly removes a certain proportion of the population. In principle, this action does the same thing as the KillProb event. However, instead of a probability, here one has to specify a rate. The rate has the same unit as fitness. So if the average fitness is 20000, than you remove 50% of the population on every update with a removal rate of 10000.

- KillRectangle [int x1=0] [int y1=0] [int x2=0] [int y2=0]

  Kill off all organisms in a rectangle defined by the points (x1, y1) and (x2, y2).

- KillWithinRadiusBelowResourceThreshold [int numradii=0, int radius=0, string resource name, double threshold=0, double killdensity=1]

- KillWithinRadiusBelowResourceThresholdTestAll

- KillWithinRadiusMeanBelowResourceThreshold [int numradii=0, int radius=0, string resource name, double threshold=0, double killdensity=1]

- MeasureDemeNetworks

- MixPopulation No arguments.

- ModMutProb [string mut_type="COPY_MUT"] [double prob=0.0] [int start_cell=-1] [int end_cell=-1]

- NewTrial No Arguments

  Immediately calculates the fitness of each organism in the population, saves this value for use with the CompeteOrganisms event, and resets the state of all organisms.

- Pred_DemeEventMoveBetweenTargets [int times=1]

- Pred_DemeEventMoveCenter

- Pred_DemeEventNUniqueIndividualsMovedIntoTarget [int numorgs=1]

- RemovePredators

- ReplaceFromGermline

- ReplicateDemes [string trigger=full_deme]

- ResetDemes No Arguments

- SerialTransfer [int transfer_size=1] [int ignore_deads=1]

  Similar to KillProb, but we specify the exact number of organisms to keep alive after the event. The ignore_deads argument determines whether only living organisms are retainted.

- SetMigrationRate [double rate=0.0]

- SetMutProb [string mut_type="COPY_MUT"] [double prob=0.0] [int start_cell=-1] [int end_cell=-1]

- SeverGridCol [int col_id=-1] [int min_row=0] [int max_row=-1]

  Remove the connections between cells along a column in an Avida grid.

- SeverGridRow [int row_id=-1] [int min_col=0] [int max_col=-1]

  Remove the connections between cells along a row in an Avida grid.

- SwapCells <int cell_id1> <int cell_id2>

- Synchronization

- TherapyDecayDemeResource [string resource_name=resname, string decrease_type=(none|lin|exp), double amount=0.2]

- TherapyStructuralNumInst

- TherapyStructuralRatioDistBetweenNearest

- ToggleFitnessValley No Arguments

- ToggleRewardInstruction No Arguments

- TrackAllMessages

- UnitFitness

- ZeroMuts No Arguments

  This event will set all mutation rates to zero.

## Print Actions

Output events are the primary way of saving data from an Avida experiments. The main two types are continuous output, which append to a single file every time the event is trigged, and singular output, which produce a single, complete file for each trigger.

- CalcConsensus [int lines_saved=0]

- DumpCellDataGrid [string fname=""]

- DumpClassificationIDGrid [string fname_prefix=""]

- DumpDonorGrid [string fname=""]

  Print out the grid of organisms who donated their merit.

- DumpEnergyGrid [string fname=""]

- DumpExecutionRatioGrid [string fname=""]

- DumpFitnessGrid [string fname=""]

  Print out the grid of organism fitness values.

- DumpGenotypeColorGrid [int num_colors=12] [string fname=""]

- DumpHostTaskGrid

  Print out the grid of takss that host organisms did in the last gestation cycle. For each host, tasks are first encoded as a binary string (e.g. 100000001 means that organism is doing NOT and EQU and then reported as a base-10 number (257 in the example above).

- DumpMemory [string fname=""]

  Dump memory summary information.

- DumpParasiteTaskGrid [string fname=""]

  Print out the grid of tasks that parasites did last gestation. For each parasite, tasks are first encoded as a binary string (e.g. 100000001 means that organism is doing NOT and EQU and then reported as a base-10 number (257 in the example above).

- DumpPhenotypeIDGrid [string fname=""]

- DumpReactionGrid [string fname=""]

- DumpReceiverGrid [string fname=""]

- DumpSleepGrid [string fname=""]

- DumpTaskGrid [string fname=""]

  Print out the grid of takss that organisms do. For each organism, tasks are first encoded as a binary string (e.g. 100000001 means that organism is doing NOT and EQU and then reported as a base-10 number (257 in the example above).

- Echo <cString message>

  Print the supplied message to standard output.

- PrintAgePolyethismData

- PrintAveNumTasks [string fname=""]

- PrintAverageData [string fname="average.dat"]

  [string filename='average.dat'] Print all of the population averages the specified file.

- PrintAvgDemeTasksExeData [string fname="avg_deme_tasks_exe.dat"]

- PrintAvgTreatableDemeTasksExeData [string fname="avg_treatable_deme_tasks_exe.dat"]

- PrintAvgUntreatableDemeTasksExeData [string fname="avg_untreatable_deme_tasks_exe.dat"]

- PrintCCladeCounts [filename = "cclade_count.dat"]

  Print a count of the number of oraganisms belonging to a each coalescence clade currently in the population.
  This action will only work in run mode.
  This action will require TRACK_CCLADE to be enabled.

- PrintCCladeFitnessHistogram [filename] [fit_mode] [hist_min] [hist_step] [hist_max]

  Print a histogram of fitnesses for each coalescence clade in the population.
  This action will only work in run mode.
  This action will rerequire TRACK_CCLADE to be enabled.
  `mode` may be {`CURRENT, ACTUAL, TESTCPU`}, where
  `CURRENT` uses the current phenotype value of fitness

`ACTUAL` uses the current merit and the true gestation time (via test cpu calculation)
`TESTCPU` uses the test cpu measurement.
`lower_bound, step, upper_bound` are log10 values for the individual histogram bins.

- PrintCCladeRelativeFitnessHistogram [filename] [fit_mode] [hist_min] [hist_step] [hist_max]

  Print a histogram of parent-relative fitness ratios for each coalescence clade in the population.
  This action will only work in run mode.
  This action will rerequire TRACK_CCLADE to be enabled.
  `mode` may be {`CURRENT, ACTUAL, TESTCPU`}, where
  `CURRENT` uses the current phenotype value of fitness

`ACTUAL` uses the current merit and the true gestation time (via test cpu calculation)
`TESTCPU` uses the test cpu measurement.
`lower_bound, step, upper_bound` are values for the individual histogram bins.

- PrintCellData

- PrintCellVisitsData [string fname="visits.dat "]

- PrintCompetitionData [string fname="competition.dat"]

  Print out CompeteOrganism statistics. Make the first call after the first set of trials has been completed to get a complete header.

- PrintConsensusData

- PrintCountData [string fname="count.dat"]

  Print all of the statistics the keep track of counts (such as the number of organisms in the population or the number of instructions executed).

- PrintCurrentMeanDemeDensity

- PrintCurrentOpinions

- PrintCurrentReactionData [string fname="cur_reactions.dat"]

- PrintCurrentReactionRewardData [string fname="cur_reaction_reward.dat"]

- PrintCurrentTaskCounts [string fname="curr_task_counts.dat"]

- PrintData <cString fname> <cString format>

  Append to the file specified (continuous output), the data given in the column list. The column list needs to be a comma-seperated list of keywords representing the data types. Many possible data types can be output; see the complete listing for details. Note that this event will even create a detailed column legend at the top of your file so you don't need to seperately keep track of what the columns mean.

- PrintDebug No Arguments

- PrintDemeAllStats No Arguments

- PrintDemeAverageData [string fname="deme_average.dat"]

- PrintDemeCompetitionData [string fname="deme_compete.dat"]

- PrintDemeCurrentTaskExeData [string fname=" deme_cur_task_exe.dat "]

- PrintDemeDonorStats No Arguments

- PrintDemeEnergyDistributionStats No Arguments

- PrintDemeEnergySharingStats No Arguments

- PrintDemeFoundersData [string fname="deme_founders.dat"]

- PrintDemeGlobalResources No Arguments

- PrintDemeMigrationSuicidePoints [string fname=" deme_mig_suicide_points.dat "]

- PrintDemeNetworkData

- PrintDemeNetworkTopology

- PrintDemeOrgReactionData [string fname="deme_org_reactions.dat"]

- PrintDemeOrgTasksData [string fname="deme_org_tasks.dat"]

- PrintDemeOrgTasksExeData [string fname="deme_org_tasks_exe.dat"]

- PrintDemeReactionData [string fname="deme_reactions.dat"]

- PrintDemeReactionDiversityReplicationData

- PrintDemeReplicationData [string fname="deme_repl.dat"]

- PrintDemeResourceStats No Arguments

- PrintDemeResourceThresholdPredicate

- PrintDemeSpacialEnergyStats No Arguments

- PrintDemeSpacialSleepStats No Arguments

- PrintDemeStats No Arguments

- PrintDemesTotalAvgEnergy No Arguments

- PrintDemeTasksData [string fname="deme_tasks.dat"]

- PrintDemeTasksExeData [string fname="deme_tasks_exe.dat"]

- PrintDemeTestamentStats [string fname="deme_testament.dat"]

- PrintDemeTreatableCount [string fname="deme_treatable.dat"]

- PrintDemeTreatableReplicationData [string fname="deme_repl_treatable.dat"]

- PrintDemeUntreatableReplicationData [string fname="deme_repl_untreatable.dat"]

- PrintDepthHistogram [string fname="depth_histogram.dat"]

- PrintDetailedFitnessData [int save_max_f_genotype=0] [int print_fitness_histo=0] [double hist_fmax=1] [double hist_fstep=0.1] [string datafn="fitness.dat"] [string histofn="fitness_histos.dat"] [string histotestfn="fitness_histos_testCPU.dat"]

- PrintDetailedSynchronizationData [string fname="sync-detail.dat"]

- PrintDirectReciprocityData

- PrintDivideMutData [string fname="divide_mut.dat"]

  Output (regular and log) statistics about individual, per site, rates divide mutation rates (aver, stdev, skew, cur) to divide_mut.dat. Use with multiple divide instuction set.

- PrintDominantData [string fname="dominant.dat"]

  Print all of the statistics relating to the dominant genotype.

- PrintDominantGenotype [string fname=""]

  Print the dominant organism's genome (and lots of information about it) into the file specified. If no filename is given, the genotype's assigned name is used and the file is placed into the archive subdirectory.

- PrintDominantGroupGenotypes [string fname=""]

  Print the dominant genomes for every active group in the population (and lots of information about them). For each group, this will print the most common genotype which has that group id at birth and is above threshold.

- PrintDominantForagerGenotypes [string fname=""]

  Print the dominant genomes for every active type of forager in the population (and lots of information about them). For each forager type, this will print the most common genotype which has that forage target at birth as is above threshold.

- PrintDonationStats No Arguments

- PrintDynamicMaxMinData [string fname=" maxmin.dat "]

- PrintEditDistance

- PrintErrorData [string fname="error.dat"]

  Print all of the standard errors of the average population statistics.

- PrintExtendedTimeData

- PrintFlowRateTuples [string fname="flow_rate_tuples.dat"]

- PrintGeneticDistanceData [string ref_creature_file="START_ORGANISM"] [string fname="genetic_distance.dat"]

- PrintGenomicSiteEntropy [filename = "GenomicSiteEntropyData.dat"]

  This function will take the initial genotype for each organism in the population/batch, align them, and calculate the per-site entropy of the aligned sequences. Please note that there may be a variable number of columns in each line if the runs are not fixed length. The site entropy will be measured in mers, normalized by the instruction set size. This is a population/batch measure of entropy, not a mutation-selection balance measure.

- PrintGenotypeAbundanceHistogram [string fname="genotype_abundance_histogram.dat"]Arguments: [string fname="species_abundance_histogram.dat"]Arguments: [string fname="lineage_totals.dat"] [int verbose=1]Arguments: [string fname="lineage_counts.dat"] [int verbose=1]

  Writes out a genotype abundance histogram.

- PrintGermlineData [string fname="germline.dat"]

- PrintGroupIds

- PrintGroupsFormedData

- PrintHGTData

- PrintHostPhenotypeData [string fname="host_phenotype_count.dat"]

- PrintHostTasksData [string fname="host_tasks.dat"]

- PrintInstructionAbundanceHistogram [string fname="instruction_histogram-${inst_set}.dat"] [string inst_set]

  Appends a line containing the bulk count (abundance) of each instruction in the population onto a file.

- PrintInstructionData [string fname="instruction-${inst_set}.dat"] [string inst_set]

  Print the by-organisms counts of what instructions they _successfully_ executed beteween birth and divide. Prior to their first divide, organisms values for their parents.

- PrintInternalTasksData [string fname="in_tasks.dat"]

- PrintInternalTasksQualData [string fname="in_tasks_quality.dat"]

- PrintInterruptData [string fname="interrupt.dat"]

- PrintLineageCounts

- PrintLineageTotals

- PrintLogFitnessHistogram Parameters: <filename> <mode> <min> <step> <max>

  Print a histogram of organism fitnesses in the current population.
  This action will only work in run mode.
  `mode` may be {`CURRENT, ACTUAL, TESTCPU`}, where
  `CURRENT` uses the current phenotype value of fitness

`ACTUAL` uses the current merit and the true gestation time (via test cpu calculation)
`TESTCPU` uses the test cpu measurement.
`lower_bound, step, upper_bound` are log10 values for the individual histogram bins.

- PrintMarketData [string fname="market.dat"]

- PrintMessageData [string fname="message.dat"]

- PrintMessageLog

- PrintMigrationData [string fname="migration.dat"]

- PrintMiniTraces [boolean random=0] [boolean save_dominants=0] [boolean save_groups=0] [boolean save_foragers=0] [int orgs_per=1] [int max_samples=0] [boolean print_genomes=0] [boolean print_reacs=0]

  Prints a condensed trace of execution during a lifetime. Who is traced is determined by arguements. E.g. with the args save_dominants=1:orgs_per=2, at the specified update(s) a list is created containing the two most abundant genotypes. The next offspring born to parents with those specified genotypes will then be traced for their entire lifetimes. If save_foragers is set to 1, the list would contain the two most abundant genotypes for EACH existing forager type. Multiple types can be saved without duplicating traces. E.g. save_dominants=1:save_foragers=1:orgs_per=2 would trace one org from each of the two most dominant genotypes and one org from each of the two most common genotypes for each of the existing forager types if those genotypes were not also one of the two most abundant overall. If max_samples is > 0, this will cap the total number of orgs traced with priorities on fullfilling orgs_per quota for: dominants > forager types > group ids.

  Setting random will look at current population, select individuals up to max_samples (without replacement) record the sampled genotypes (one per individual, including genotype duplicates) and then trace the next orgs born with those genotypes, removing the genotype instance from the 'to-do' list with each new trace. Random option is not currently compatible with (will override) other save_ arguements or orgs_per.

  Minitraces are currently only fully implemented for the experimental hardware and partially for the SMT hardware because of differences in the way some minitrace variables are tracked by the different hardware types.

  Each call to PrintMiniTraces resets the genotype list, rather than appending to it.

- PrintMicroTraces [boolean random=0] [boolean rand_prey=0] [boolean rand_pred=0] [int next_prey=0] [int next_pred=0] [boolean save_dominants=0] [boolean save_groups=0] [boolean save_foragers=0] [int orgs_per=1] [int max_samples=0] [boolean print_genomes=0] [boolean print_reacs=0]

  Same general operation behavior as PrintMiniTraces but only saves executed instruction symbols along with org id, genotype id, forager type, and birth and death updates. Microtraces map executions as 'what the org was trying to do'. So, failed executions are recorded except when CPU costs are being paid. If CPU costs are being paid, we record the execution when the instruction was submitted, not necessarily when it was actually executed. Each microtrace is saved on a single line in microtrace.dat.

  rand_pred and rand_prey are compatible with each other, building a single list of genotypes to trace based on current genotypes in the population for each of the two general forager types (will generate a list of 2 X max_samples if both arguements are used).

  Each call to PrintMicroTraces appends to the genotype list, rather than replacing it (opposite of mini traces).

  If next_prey or next_pred are used, the organisms born to parents with prey or predator foraging targets will be traced, regardless of genotype, until the set arg number have been traced (requested number will be replaced, not appended to, by subsequent event calls).

- PrintMultiProcessData

- PrintMutationRateData [string fname="mutation_rates.dat"]

  Output (regular and log) statistics about individual copy mutation rates (aver, stdev, skew, cur). Useful only when mutation rate is set per organism.

- PrintNewReactionData [string fname=" newreactions.dat "]

  Print number of times the particular reaction has newly appeared in the population since the last time this datum was printed. Newly appeared is defined as an organism triggering a reaction that was not triggered by its parent.

- PrintNewTasksData [string fname=" newtasks.dat "]

  Print number of times the particular task has newly appeared in the population since the last time this datum was printed. Newly appeared is defined as an organism executing a task that was not executed by its parent.

- PrintNewTasksDataPlus [string fname=" newtasksplus.dat "]

- PrintNumOrgsInDeme No Arguments

- PrintNumOrgsKilledData [string fname="orgs_killed.dat"]

- PrintOpinionsSetPerDeme

- PrintParasiteData [string fname="parasite.dat"]

- PrintParasitePhenotypeData [string fname="parasite_phenotype_count.dat"]

- PrintParasiteTasksData [string fname="parasite_tasks.dat"]

- PrintPerDemeGenPerFounderData [string fname="deme_gen_between_founders.dat"]

- PrintPerDemeReactionData [string fname="per_deme_reactions.dat"]

- PrintPerDemeTasksData [string fname="per_deme_tasks.dat"]

- PrintPerDemeTasksExeData [string fname="per_deme_tasks_exe.dat"]

- PrintPhenotypeData [string fname="phenotype_count.dat"]

  [string filename='phenotype_count.dat'] Print the number of phenotypes based on tasks executed this update. Executing a task any number of times is considered the same as executing it once.

- PrintPhenotypeStatus [string fname="phenotype_status.dat"]

- PrintPhenotypicPlasticity [string filename="phenplast"] [int num_trials=1000]

  This function will provided detailed information about the phenotypic varients of the current population/batch by running each genome through a test cpu `num_trials` times. If this command is executed in run mode, the `filename` will be appeneded with `-Update.dat` where `Update` is the current update. In analyze mode, the default file is merely phenplast.dat. The output file contains the following: id, parent_id, phenotypic_varient_number, frequency, fitness, merit, gestation_time, and task counts for each phenotypic variant of each genotype.

- PrintPlasticGenotypeSummary [string filename="genotype_plsticity.dat"]

- PrintPopulationDistanceData [string creature="START_ORGANISM"] [string fname=""] [int save_genotypes=0]

- PrintPredatorAverageData

- PrintPredatorErrorData

- PrintPredatorInstructionData

- PrintPredatorVarianceData

- PrintMinPreyFailedAttacks

- PrintPredicatedMessages

- PrintPreyAverageData

- PrintPreyErrorData

- PrintPreyInstructionData

- PrintPreyVarianceData

- PrintProfilingData

- PrintReactionData [string fname="reactions.dat"]

- PrintReactionExeData [string fname="reactions_exe.dat"]

- PrintReactionRewardData [string fname="reaction_reward.dat"]

- PrintRelativeFitnessHistogram [filename] [fit_mode] [hist_min] [hist_step] [hist_max]

  Print a histogram of parent-relative fitness ratios for each coalescence clade in the population.
  This action will only work in run mode.
  `mode` may be {`CURRENT, ACTUAL, TESTCPU`}, where
  `CURRENT` uses the current phenotype value of fitness

`ACTUAL` uses the current merit and the true gestation time (via test cpu calculation)
`TESTCPU` uses the test cpu measurement.
`lower_bound, step, upper_bound` are values for the individual histogram bins.

- PrintReproData Record and print some data up to first reproduction for every org alive now.

- PrintReputationData [string fname="reputation.dat"]

- PrintResourceData [string fname="resource.dat"]

  Print the current counts of each resource available to the population. This uses the environment configuration to determine what resources are in use. Also creates seperate files `resource_resource_name.m` (in a format that is designed to be read into Matlab) for each spatial resource.

- PrintResourceLocData [string fname="resourceloc.dat"]

- PrintResWallLocData [string fname="reswallloc.dat"]

- PrintSenseData [string fname="sense.dat"]

- PrintSenseExeData [string fname="sense_exe.dat"]

- PrintShadedAltruists

- PrintSimpleConsensusData

- PrintSleepData [string fname="sleep.dat"]

- PrintSpeciesAbundanceHistogram

  Writes out a species abundance histogram.

- PrintStatsData [string fname="stats.dat"]

  Print all of the miscellanous population statistics.

- PrintStringMatchData [string fname="stringmatch.dat"]

- PrintSynchronizationData

- PrintTaskProbHistogram [filename=pp_histogram.dat] [weightbycpus=0]

- PrintTasksData [string fname="tasks.dat"]

  Print the number of organisms that are able to perform each task. This uses the environment configuration to determine what tasks are in use.

- PrintTasksExeData [string fname="tasks_exe.dat"]

  Print number of times the particular task has been executed this update.

- PrintTaskSnapshot [string fname=""]

  Run all organisms in the population through test cpus and print out the number of tasks each can perform.

- PrintTasksQualData [string fname="tasks_quality.dat"]

  Print the total quality of each task. By default a successful task is valued as 1.0. Some tasks, however, can grant partial values and/or special bonuses via the quality value.

- PrintTimeData [string fname="time.dat"]

  Print all of the timing related statistics.

- PrintTotalsData [string fname="totals.dat"]

  Print various totals for the entire length of the run (for example, the total number of organisms ever).

- PrintTopNavTrace Record and print some nav data up to first reproduction for best of orgs alive now, including trace execution, locations, and facings. Will print these data for the org among those with the highest reaction achieved By time of reproduction in shortest amount of time (as measured by cycles). Will print nothing if any of the candidate orgs are still alive when avida exits and no FlushTopNavTrace events were called.

- PrintVarianceData [string fname="variance.dat"]

  Print all of the variances of the average population statistics.

- PrintViableTasksData [string fname="viable_tasks.dat"]

- SaveDemeFounders [string fname=""]

- SetVerbose [string verbosity=""]

  Change the level of output verbosity. Verbose messages will print all of the details of what is happening to the screen. Minimal messages will only briefly state the process being run. Verbose messages are recommended if you're in interactive analysis mode. When no arguments are supplied, action will toggle between NORMAL and ON.
  Levels: SILENT, NORMAL, ON, DETAILS, DEBUG

- TestDominant [string fname="dom-test.dat"]

- VERBOSE [string verbosity=""]

## Save Load Actions

- LoadPopulation <cString fname> [int update=-1] [int cellid_offset=0] [int lineage_offset=0] [bool load_groups=0] [bool load_birth_cells=0] [bool load_avatars=0] [bool load_rebirth]

  Sets up a population based on a save file such as written out by SavePopulation. It is also possible to append a history file to the save file, in order to preserve the history of a previous run.
  update allows user to set the current update number to a new value
  load_groups allows users to load population files containing individual group ids (opinions) and forager types (aka saved populations with save_groups = 1)
  load_birth_cells allows users to drop each org into it's original birth cell. This can be important for populations in spatial environments where state information would have been collected as the org moved around the world.
  e.g to load a population with birth cells and group ids, but without cell, lineage, or update offsets:
  i LoadPopulation -1 0 0 1 1 0
  load_rebirth will override load_groups, load_birth_cells, load avatars and inject orgs into their saved birth cells, put avatars in their birth cells (if avatars are on), assign parent's merit to org (if inherit merit is on) and assign the parent's forage target if the parent was a 'teacher'
  i LoadPopulation -1 0 0 0 0 0 1

- SavePopulation [string fname=""] [bool save_historic=1] [bool save_groups=0] [bool save_avatars=0] [boolean save_rebirth=0]

  Save the genotypes and lots of statistics about the population to the file specified; if not filename is given, use the name `detail-update.pop`. As with clones, the update number allows a single event to produce many detail files. The details are used to collect crossection data about the population.
  save_groups will append data on current group ids, current forage targets and the cell orgs were born into for each occurence of each genotype Using save_rebirth will save additional information about the birth of the organism which would be required to 'repeat' the birth of the organism as if it was still in the population (for behavioral trials, etc): parent_ft, parent is teacher, parent merit (out to 4 dec places) Using save_rebirth will save all possible columns (i.e. will save all save_groups + all save_avatars data even if those flags are off).

- SaveFlameData [string fname=""]

  Save only the data needed for generating flame graphs (genotype id, depth, and number of organisms).

## Creating an Action

The action source code is contained in the source/action directory. Each of the individual action categories has its own source code files (e.g. Landcape Actions are located in the LandscapeActions files).

Each action is derrived from the cAction class. Briefly, to get an action to work you must create a child class that has a Process and GetDescription function defined as well as a constructor. You must also register this new class with the action library.

So, with that quick review of what must be done, here is a step by step guide to creating an action:

1. Identify which of the action categories your action should be assigned to. There are six different action categories described above. Each category has a similar means of creating a new action, but do note that some action commands are generated via macros defined at the top of the files. For instance, in the PrintActions file, you will notice a number of STATS_OUT_FILE macros being used to generate rather repetitively coded standard output files.

2. Create a new class in the file that follows proper naming conventions. Any class should begin with "cAction" and be followed by the name of the action command you will register with the library. For instance, if we were to create a new command "MyAction", we'd name the class cActionMyAction. Below is a stub for this new action class:

       class cActionMyAction : public cAction
       {
       	private:
       		// Private data members for this action
       	public:
       		cActionMyAction(cWorld* world, const cString& args) : cAction(world, args) { ; }

       		static const cString GetDescription() { return "Arguments: My Arguments"; }

       		void Process(cAvidaContext& ctx)
       		{
       			//Perform whatever processing is needed when the action is triggered.
       		}
       };

3. Define the private data members, constructor, description string in GetDescription, and the Process function. Any arguments that you specify after the action name in the events configuration will be passed to your new class via the args argument in the constructor.

4. Register the new action with the action library. At the bottom of each action definitions file, there are the commands that register the individual actions with the action library. In the PrintActions.cc file, for instance, this function is called RegisterPrintActions.

   To register our example action "MyAction", we'd write:

       action_lib->Register<cActionMyAction>("MyAction");

5. Test your action.

6. Add a ==== Action action name ==== line in source/utils/make_actions_html/actions_source_info file

Return to the Index | The Events File | The Analyze File