Update cubzh.lua
Browse files
cubzh.lua
CHANGED
|
@@ -226,28 +226,28 @@ local skills = {
|
|
| 226 |
end,
|
| 227 |
action_format_str = "{protagonist_name} summoned a flying squirrel! It's vibrating with excitement!",
|
| 228 |
},
|
| 229 |
-
|
| 230 |
name = "TEACH_LOOP",
|
| 231 |
description = "Teach the concept of looping in programming",
|
| 232 |
-
parameter_types = {
|
| 233 |
callback = function(client, action)
|
| 234 |
local npc = client:getNpc(action.character_id)
|
| 235 |
if not npc then print("Can't find npc") return end
|
| 236 |
|
| 237 |
dialog:create("Let's learn about loops! They help us repeat actions easily.", npc.avatar.Head)
|
| 238 |
Timer(3, function()
|
| 239 |
-
dialog:create("Imagine you'
|
| 240 |
end)
|
| 241 |
Timer(6, function()
|
| 242 |
-
dialog:create("It looks like this: for i = 1, 5 do
|
| 243 |
end)
|
| 244 |
end,
|
| 245 |
-
action_format_str = "{protagonist_name} taught
|
| 246 |
},
|
| 247 |
{
|
| 248 |
-
name = "
|
| 249 |
description = "Demonstrate a loop visually",
|
| 250 |
-
parameter_types = {
|
| 251 |
callback = function(client, action)
|
| 252 |
local npc = client:getNpc(action.character_id)
|
| 253 |
if not npc then print("Can't find npc") return end
|
|
@@ -255,15 +255,42 @@ local skills = {
|
|
| 255 |
dialog:create("Watch this loop in action!", npc.avatar.Head)
|
| 256 |
for i = 1, 5 do
|
| 257 |
Timer(i, function()
|
| 258 |
-
local
|
| 259 |
-
|
| 260 |
-
|
| 261 |
-
World:AddChild(
|
| 262 |
-
dialog:create("
|
| 263 |
end)
|
| 264 |
end
|
| 265 |
end,
|
| 266 |
-
action_format_str = "{protagonist_name} demonstrated a loop by
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 267 |
}
|
| 268 |
}
|
| 269 |
|
|
@@ -293,10 +320,10 @@ local NPCs = {
|
|
| 293 |
physicalDescription = "Energetic, with wild hair and a colorful lab coat",
|
| 294 |
psychologicalProfile = "Enthusiastic and creative, loves to explain concepts through interactive demonstrations",
|
| 295 |
currentLocationName = "Scientist Island",
|
| 296 |
-
|
| 297 |
-
"Welcome to
|
| 298 |
-
"Loops are
|
| 299 |
-
"
|
| 300 |
},
|
| 301 |
},
|
| 302 |
{
|
|
|
|
| 226 |
end,
|
| 227 |
action_format_str = "{protagonist_name} summoned a flying squirrel! It's vibrating with excitement!",
|
| 228 |
},
|
| 229 |
+
{
|
| 230 |
name = "TEACH_LOOP",
|
| 231 |
description = "Teach the concept of looping in programming",
|
| 232 |
+
parameter_types = {},
|
| 233 |
callback = function(client, action)
|
| 234 |
local npc = client:getNpc(action.character_id)
|
| 235 |
if not npc then print("Can't find npc") return end
|
| 236 |
|
| 237 |
dialog:create("Let's learn about loops! They help us repeat actions easily.", npc.avatar.Head)
|
| 238 |
Timer(3, function()
|
| 239 |
+
dialog:create("Imagine you want to print 'Hello' 5 times. Instead of writing it 5 times, we use a loop!", npc.avatar.Head)
|
| 240 |
end)
|
| 241 |
Timer(6, function()
|
| 242 |
+
dialog:create("It looks like this: for i = 1, 5 do print('Hello') end", npc.avatar.Head)
|
| 243 |
end)
|
| 244 |
end,
|
| 245 |
+
action_format_str = "{protagonist_name} taught about loops in programming."
|
| 246 |
},
|
| 247 |
{
|
| 248 |
+
name = "DEMONSTRATE_LOOP",
|
| 249 |
description = "Demonstrate a loop visually",
|
| 250 |
+
parameter_types = {},
|
| 251 |
callback = function(client, action)
|
| 252 |
local npc = client:getNpc(action.character_id)
|
| 253 |
if not npc then print("Can't find npc") return end
|
|
|
|
| 255 |
dialog:create("Watch this loop in action!", npc.avatar.Head)
|
| 256 |
for i = 1, 5 do
|
| 257 |
Timer(i, function()
|
| 258 |
+
local cube = Shape(Items.pratamacam.squirrel) -- Using squirrel as a placeholder for a cube
|
| 259 |
+
cube.LocalScale = 0.3
|
| 260 |
+
cube.Position = npc.object.Position + Number3(i*2, 5, 0)
|
| 261 |
+
World:AddChild(cube)
|
| 262 |
+
dialog:create("Created cube " .. i .. "!", npc.avatar.Head)
|
| 263 |
end)
|
| 264 |
end
|
| 265 |
end,
|
| 266 |
+
action_format_str = "{protagonist_name} demonstrated a loop by creating cubes."
|
| 267 |
+
},
|
| 268 |
+
{
|
| 269 |
+
name = "EXPLAIN_LOOP_PARTS",
|
| 270 |
+
description = "Explain the different parts of a loop",
|
| 271 |
+
parameter_types = {},
|
| 272 |
+
callback = function(client, action)
|
| 273 |
+
local npc = client:getNpc(action.character_id)
|
| 274 |
+
if not npc then print("Can't find npc") return end
|
| 275 |
+
|
| 276 |
+
dialog:create("Let's break down the parts of a loop:", npc.avatar.Head)
|
| 277 |
+
Timer(3, function()
|
| 278 |
+
dialog:create("1. 'for' keyword: Starts the loop", npc.avatar.Head)
|
| 279 |
+
end)
|
| 280 |
+
Timer(6, function()
|
| 281 |
+
dialog:create("2. 'i = 1': Initialize the loop variable", npc.avatar.Head)
|
| 282 |
+
end)
|
| 283 |
+
Timer(9, function()
|
| 284 |
+
dialog:create("3. '5': The end condition", npc.avatar.Head)
|
| 285 |
+
end)
|
| 286 |
+
Timer(12, function()
|
| 287 |
+
dialog:create("4. 'do': Begins the loop body", npc.avatar.Head)
|
| 288 |
+
end)
|
| 289 |
+
Timer(15, function()
|
| 290 |
+
dialog:create("5. 'end': Ends the loop", npc.avatar.Head)
|
| 291 |
+
end)
|
| 292 |
+
end,
|
| 293 |
+
action_format_str = "{protagonist_name} explained the parts of a loop."
|
| 294 |
}
|
| 295 |
}
|
| 296 |
|
|
|
|
| 320 |
physicalDescription = "Energetic, with wild hair and a colorful lab coat",
|
| 321 |
psychologicalProfile = "Enthusiastic and creative, loves to explain concepts through interactive demonstrations",
|
| 322 |
currentLocationName = "Scientist Island",
|
| 323 |
+
initialReflections = {
|
| 324 |
+
"Welcome to Loop Island! I'm Professor Loop, and I'm here to teach you about loops in programming.",
|
| 325 |
+
"Loops are a fundamental concept in coding. They help us repeat actions without writing the same code over and over.",
|
| 326 |
+
"Are you ready to learn about loops through some fun visual demonstrations?",
|
| 327 |
},
|
| 328 |
},
|
| 329 |
{
|