summaryrefslogtreecommitdiff
path: root/manuals/chickadee/Agendas.html
diff options
context:
space:
mode:
Diffstat (limited to 'manuals/chickadee/Agendas.html')
-rw-r--r--manuals/chickadee/Agendas.html66
1 files changed, 33 insertions, 33 deletions
diff --git a/manuals/chickadee/Agendas.html b/manuals/chickadee/Agendas.html
index f6acd57..51be160 100644
--- a/manuals/chickadee/Agendas.html
+++ b/manuals/chickadee/Agendas.html
@@ -1,6 +1,6 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
-<!-- Copyright (C) 2017-2021 David Thompson davet@gnu.org
+<!-- Copyright (C) 2017-2023 David Thompson dthompson2@worcester.edu
Permission is granted to copy, distribute and/or modify this document
under the terms of the GNU Free Documentation License, Version 1.3
@@ -17,25 +17,25 @@ Foundation Web site at http://www.gnu.org/licenses/fdl.html.
The document was typeset with
http://www.texinfo.org/ (GNU Texinfo).
- -->
-<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
+ -->
+<!-- Created by GNU Texinfo 6.7, http://www.gnu.org/software/texinfo/ -->
<head>
-<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Agendas (The Chickadee Game Toolkit)</title>
-<meta name="description" content="Agendas (The Chickadee Game Toolkit)">
-<meta name="keywords" content="Agendas (The Chickadee Game Toolkit)">
-<meta name="resource-type" content="document">
-<meta name="distribution" content="global">
-<meta name="Generator" content="makeinfo">
-<link href="index.html" rel="start" title="Top">
-<link href="Index.html" rel="index" title="Index">
-<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents">
-<link href="Scripting.html" rel="up" title="Scripting">
-<link href="Scripts.html" rel="next" title="Scripts">
-<link href="Scripting.html" rel="prev" title="Scripting">
+<meta name="description" content="Agendas (The Chickadee Game Toolkit)" />
+<meta name="keywords" content="Agendas (The Chickadee Game Toolkit)" />
+<meta name="resource-type" content="document" />
+<meta name="distribution" content="global" />
+<meta name="Generator" content="makeinfo" />
+<link href="index.html" rel="start" title="Top" />
+<link href="Index.html" rel="index" title="Index" />
+<link href="index.html#SEC_Contents" rel="contents" title="Table of Contents" />
+<link href="Scripting.html" rel="up" title="Scripting" />
+<link href="Scripts.html" rel="next" title="Scripts" />
+<link href="Scripting.html" rel="prev" title="Scripting" />
<style type="text/css">
-<!--
+&lt;!--
a.summary-letter {text-decoration: none}
blockquote.indentedblock {margin-right: 0em}
div.display {margin-left: 3.2em}
@@ -72,9 +72,9 @@ ul.no-bullet {list-style: none}
}
}
--->
+--&gt;
</style>
-<link rel="stylesheet" type="text/css" href="https://dthompson.us/css/dthompson.css">
+<link rel="stylesheet" type="text/css" href="https://dthompson.us/css/dthompson.css" />
</head>
@@ -84,7 +84,7 @@ ul.no-bullet {list-style: none}
<p>
Next: <a href="Scripts.html" accesskey="n" rel="next">Scripts</a>, Up: <a href="Scripting.html" accesskey="u" rel="up">Scripting</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html" title="Index" rel="index">Index</a>]</p>
</div>
-<hr>
+<hr />
<span id="Agendas-1"></span><h4 class="subsection">5.5.1 Agendas</h4>
<p>To schedule a task to be performed later, an &ldquo;agenda&rdquo; is used.
@@ -93,15 +93,15 @@ additional agendas may be created for different purposes. The
following example prints the text &ldquo;hello&rdquo; when the agenda has
advanced to time unit 10.
</p>
-<div class="example">
-<pre class="example">(at 10 (display &quot;hello\n&quot;))
+<div class="lisp">
+<pre class="lisp"><span class="syntax-open">(</span><span class="syntax-symbol">at</span> <span class="syntax-symbol">10</span> <span class="syntax-open">(</span><span class="syntax-symbol">display</span> <span class="syntax-string">"hello\n"</span><span class="syntax-close">)</span><span class="syntax-close">)</span>
</pre></div>
<p>Most of the time it is more convenient to schedule tasks relative to
the current time. This is where <code>after</code> comes in handy:
</p>
-<div class="example">
-<pre class="example">(after 10 (display &quot;hello\n&quot;))
+<div class="lisp">
+<pre class="lisp"><span class="syntax-open">(</span><span class="syntax-symbol">after</span> <span class="syntax-symbol">10</span> <span class="syntax-open">(</span><span class="syntax-symbol">display</span> <span class="syntax-string">"hello\n"</span><span class="syntax-close">)</span><span class="syntax-close">)</span>
</pre></div>
<p>Time units in the agenda are in no way connected to real time. It&rsquo;s
@@ -109,9 +109,9 @@ up to the programmer to decide what agenda time means. A simple and
effective approach is to map each call of the update procedure
(see <a href="Kernel.html">Kernel</a>) to 1 unit of agenda time, like so:
</p>
-<div class="example">
-<pre class="example">(define (update dt)
- (update-agenda 1))
+<div class="lisp">
+<pre class="lisp"><span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-open">(</span><span class="syntax-symbol">update</span> <span class="syntax-symbol">dt</span><span class="syntax-close">)</span>
+ <span class="syntax-open">(</span><span class="syntax-symbol">update-agenda</span> <span class="syntax-symbol">1</span><span class="syntax-close">)</span><span class="syntax-close">)</span>
</pre></div>
<p>It is important to call <code>update-agenda</code> periodically, otherwise
@@ -124,13 +124,13 @@ a simple matter of not updating the world&rsquo;s agenda while continuing to
update the user interface&rsquo;s agenda. The current agenda is dynamically
scoped and can be changed using the <code>with-agenda</code> special form:
</p>
-<div class="example">
-<pre class="example">(define game-world-agenda (make-agenda))
+<div class="lisp">
+<pre class="lisp"><span class="syntax-open">(</span><span class="syntax-special">define</span> <span class="syntax-symbol">game-world-agenda</span> <span class="syntax-open">(</span><span class="syntax-symbol">make-agenda</span><span class="syntax-close">)</span><span class="syntax-close">)</span>
-(with-agenda game-world-agenda
- (at 60 (spawn-goblin))
- (at 120 (spawn-goblin))
- (at 240 (spawn-goblin-king)))
+<span class="syntax-open">(</span><span class="syntax-symbol">with-agenda</span> <span class="syntax-symbol">game-world-agenda</span>
+ <span class="syntax-open">(</span><span class="syntax-symbol">at</span> <span class="syntax-symbol">60</span> <span class="syntax-open">(</span><span class="syntax-symbol">spawn-goblin</span><span class="syntax-close">)</span><span class="syntax-close">)</span>
+ <span class="syntax-open">(</span><span class="syntax-symbol">at</span> <span class="syntax-symbol">120</span> <span class="syntax-open">(</span><span class="syntax-symbol">spawn-goblin</span><span class="syntax-close">)</span><span class="syntax-close">)</span>
+ <span class="syntax-open">(</span><span class="syntax-symbol">at</span> <span class="syntax-symbol">240</span> <span class="syntax-open">(</span><span class="syntax-symbol">spawn-goblin-king</span><span class="syntax-close">)</span><span class="syntax-close">)</span><span class="syntax-close">)</span>
</pre></div>
<dl>
@@ -211,7 +211,7 @@ registered conditions are met.
(returns a value other than <code>#f</code>.)
</p></dd></dl>
-<hr>
+<hr />
<div class="header">
<p>
Next: <a href="Scripts.html" accesskey="n" rel="next">Scripts</a>, Up: <a href="Scripting.html" accesskey="u" rel="up">Scripting</a> &nbsp; [<a href="index.html#SEC_Contents" title="Table of contents" rel="contents">Contents</a>][<a href="Index.html" title="Index" rel="index">Index</a>]</p>