File: tutorial.lua

package info (click to toggle)
crawl 2%3A0.33.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 95,264 kB
  • sloc: cpp: 358,145; ansic: 27,203; javascript: 9,491; python: 8,359; perl: 3,327; java: 2,667; xml: 2,191; makefile: 1,830; sh: 611; objc: 250; cs: 15; sed: 9; lisp: 3
file content (58 lines) | stat: -rw-r--r-- 1,328 bytes parent folder | download | duplicates (7)
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
----------------------------------------------------------------------
-- tutorial.lua:
--
-- Code for tutorials.
----------------------------------------------------------------------

function tutorial_messenger (data, triggerable, triggerer, marker, ev)

  crawl.clear_messages(true)
  crawl.mpr(data.text, data.channel)
  if data.onetime == true then
    triggerable:remove(marker)
  end
end

function tutorial_message (text, onetime)
  -- defaults to false
  if onetime == nil then
    onetime = false
  end

  local data = {text=text, channel="tutorial", onetime=onetime}

  return function_at_spot('tutorial_messenger', data, true)
end

function tutorial_intro (msg)
  if msg ~= nil then
    crawl.clear_messages(true)
    crawl.mpr(msg, "tutorial")
  end
  crawl.tutorial_msg("tutorial intro")
  crawl.more()
end

function tutorial_messenger_db(data, triggerable, triggerer, marker, ev)

  crawl.clear_messages(true)
  crawl.tutorial_msg(data.text, data.exit)
  if data.onetime == true then
    triggerable:remove(marker)
  end
end

function tutorial_msg(text, onetime, exit)
  -- defaults to false
  if onetime == nil then
    onetime = false
  end

  if exit == nil then
    exit = false
  end

  local data = {text=text, onetime=onetime, exit=exit}

  return function_at_spot('tutorial_messenger_db', data, true)
end