File: cave2.lua

package info (click to toggle)
kq 0.99.cvs20070319-1.1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 8,344 kB
  • ctags: 2,870
  • sloc: ansic: 26,328; sh: 3,737; makefile: 203; perl: 100
file content (69 lines) | stat: -rw-r--r-- 1,964 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69


-- cave2 - "Pit in grotto north of Ekla"

--
function autoexec()
  refresh()
end
function entity_handler(en)
  return
end
function postexec()
  if (get_progress(11) == 0) then
    bubble(200, "Ouch!")
    bubble(200, "This is no ordinary gopher hole!")
  end
end
function refresh()
  -- Show the shiny, glowing rescue spot
  if (get_progress(11) > 0) then
    set_btile("exit", 30)
    set_zone("exit", 3)
  end
end
function zone_handler(zn)
  if (zn == 1) then
    --
    if (get_progress(11) == 0) then
      bubble(200, "There's some kind of barrier here. I can't get past it.")
      set_progress(11, 1)
      refresh()
      bubble(200, "Hey... What's that thing down there?")
    --
    else
      bubble(200, "This barrier is still here. I can't get out.")
    end
  elseif (zn == 2) then
    chest(16, 103, 1)
    refresh()
  elseif (zn == 3) then
    if (get_progress(36) == 0) then
      if (get_progress(9) == 1) then
        --
        bubble(200, "This doesn't do anything; I can't get out of here. I'll give up and just go to sleep.")
        set_progress(9, 2)
        inn("You decide to sleep.", 0, 0)
      elseif (get_progress(9) == 2) then
        --
        bubble(200, "Oops, I'm stuck down here again. I'll try sleeping again to get back out.")
        inn("You decide to sleep.", 0, 0)
      end
      set_ent_facing(200, 3)
      change_map("grotto", "by_fire")
    elseif (get_progress(36) == 1) then
      bubble(200, "Hmm... this doesn't look like it does anything.")
      msg("Hello? Who's there? Is that somebody down there?", 255, 0)
      bubble(200, "Yeah... I fell down here and the door's blocked.")
      msg("Hang on, let me get you out of there.", 255, 0)
      set_progress(9, 3)
      change_map("grotto", "by_pit")
    else
      --
      bubble(200, "Derig, can you help me out of here?")
      msg("Sure thing. Here you go.", 255, 0)
      set_ent_facing(200, 3)
      change_map("grotto", "by_fire")
    end
  end
end