Timer - theRAPTLab/gsgo GitHub Wiki

See !113


TABLE OF CONTENTS

[[TOC]]


Overview

Timers have not really been implemented yet.

Rounds use a special Rounds timer that is defined at the project level and handled directly by sim-rounds.js. See Rounds for more information.


stopRound method

See !113

You can stop a running round via script using the stopRound method.

For example, a Predator might need to stop the round after it eats all the prey.

REVIEW: We could implement this as a some kind of conditional stop script defined at the rounds level, but we would then have to jump through hoops to set agent contexts.

Syntax

featCall Timer stopRound

Example

This will stop a round after all Moths are gone:

useFeature Timer
// Stop sim if no more agents
ifExpr {{ Moth.callFeatMethod('Population', 'getActiveAgentsCount', 'Moth') < 1 }} [[
  featCall Predator.Timer stopRound
]]
⚠️ **GitHub.com Fallback** ⚠️