Skip to content

Commit c290f40

Browse files
committed
feedback
1 parent d3ae47f commit c290f40

7 files changed

Lines changed: 39 additions & 1 deletion

File tree

src/content/docs/ch01/01-instructions.mdx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ An `instruction` is a single operation in a CLEO script. It is the smallest unit
88

99
In Sanny Builder each instruction is written on a separate line. An instruction ends at the end of the line.
1010

11+
When compiled, scripts run from top to bottom. Each instruction is executed in order, one after another. When the game encounters an instruction, it executes it and then moves to the next line.
12+
1113
Let's have a look at the shortest possible script that has only one instruction:
1214

1315
```sb

src/content/docs/ch02/02-wait.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,3 +22,8 @@ print_formatted "Current time: %d:%d" 250 hours minutes
2222
```
2323

2424
This script will print the current time, wait for 5 seconds, and then print the time again. Note how the time changes between the two prints.
25+
26+
:::tip
27+
28+
Use `wait` command sparingly. You only need it when you want to pause the script and let the game do other things.
29+
:::

src/content/docs/ch02/06-quiz.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,5 +39,14 @@ import Quiz from '../../../components/Quiz.astro';
3939
],
4040
correct: 1,
4141
hint: "There is a specific command designed to exit a loop early."
42+
},
43+
{
44+
question: "True or false: You must put wait at the start of every code block.",
45+
answers: [
46+
"True",
47+
"False"
48+
],
49+
correct: 1,
50+
hint: "You only need it while waiting on game or player conditions."
4251
}
4352
]} />

src/content/docs/ch05/02-for-loop.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ end
2828

2929
The variable `i` will take values `1`, `2`, `3`, `4`, `5`, and the loop body will execute 5 times. After the loop, the player has $500 more.
3030

31+
:::note
32+
FOR's end value is inclusive. The loop runs with the end value as the last iteration. In the example above, `i` takes the value `5` in the last iteration, and then the loop ends.
33+
:::
34+
3135
## Counting Backwards with DOWNTO
3236

3337
To count in the opposite direction, use `downto` instead of `to`. The loop variable decreases by `1` after each iteration:

src/content/docs/ch05/06-quiz.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,14 @@ import Quiz from '../../../components/Quiz.astro';
3838
],
3939
correct: 2,
4040
hint: "It's the opposite of break — instead of leaving the loop, it starts a new iteration"
41+
},
42+
{
43+
question: "True or false: In a for loop, the end value is not used.",
44+
answers: [
45+
"True",
46+
"False"
47+
],
48+
correct: 1,
49+
hint: "The loop variable takes the end value in the last iteration, and then the loop ends."
4150
}
4251
]} />

src/content/docs/ch07/06-script-vehicle-roulette.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ loadModel(currentModel)
165165
currentCar = spawnNearPlayer(currentModel)
166166
```
167167

168-
`generate_random_int_in_range` picks an index between `0` (inclusive) and `NUM_VEHICLES` (exclusive). That index pulls a model ID from the array, which flows through `loadModel` and `spawnNearPlayer`.
168+
`generate_random_int_in_range` picks an index between `0` (inclusive) and `NUM_VEHICLES` (exclusive). If `NUM_VEHICLES` is `8`, the possible index to return are `0` to `7`, which matches the valid indices of the `models` array. That index pulls a model ID from the array, which flows through `loadModel` and `spawnNearPlayer`.
169169

170170
Save the file as `vehicle_roulette.txt`, press `F7`, and try your luck!
171171

src/content/docs/ch07/07-quiz.mdx

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,5 +38,14 @@ import Quiz from '../../../components/Quiz.astro';
3838
],
3939
correct: 2,
4040
hint: "If the game's execution flow can reach a function definition without calling it, things won't work correctly."
41+
},
42+
{
43+
question: "True or false: generate_random_int_in_range includes the max value in the result.",
44+
answers: [
45+
"True",
46+
"False"
47+
],
48+
correct: 1,
49+
hint: "The max value is exclusive — the result is always less than it."
4150
}
4251
]} />

0 commit comments

Comments
 (0)