summaryrefslogtreecommitdiff
path: root/example/scripts/global_events.lua
diff options
context:
space:
mode:
authorThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-11 18:16:16 +0100
committerThorbjørn Lindeijer <thorbjorn@lindeijer.nl>2012-03-11 19:27:32 +0100
commit5ff34fd2458dff28d664c90fb93f455231f8633c (patch)
tree533151e5f3002c1e24ce4d44e5cd32c66c026b51 /example/scripts/global_events.lua
parentb822dcee52d15d41c4186a250e73b85b16c9dc39 (diff)
downloadmanaserv-5ff34fd2458dff28d664c90fb93f455231f8633c.tar.gz
manaserv-5ff34fd2458dff28d664c90fb93f455231f8633c.tar.bz2
manaserv-5ff34fd2458dff28d664c90fb93f455231f8633c.tar.xz
manaserv-5ff34fd2458dff28d664c90fb93f455231f8633c.zip
Register Lua script API functions into the global namespace
Scripts mostly execute the Mana script API, and it seems like just unnecessary verbosity to refer to the 'mana' table all the time. This table no longer exists now. Reviewed-by: Erik Schilling
Diffstat (limited to 'example/scripts/global_events.lua')
-rw-r--r--example/scripts/global_events.lua24
1 files changed, 12 insertions, 12 deletions
diff --git a/example/scripts/global_events.lua b/example/scripts/global_events.lua
index 42a25f00..1268ef91 100644
--- a/example/scripts/global_events.lua
+++ b/example/scripts/global_events.lua
@@ -12,21 +12,21 @@
-- Register the callback that is called when the hit points of a character
-- reach zero.
-mana.on_character_death(function(ch)
- mana.being_say(ch, "Noooooo!!!")
+on_character_death(function(ch)
+ being_say(ch, "Noooooo!!!")
end)
-- This function is called when the player clicks on the OK button after the
-- death message appeared. It should be used to implement the respawn
-- mechanic (for example: warp the character to the respawn location and
-- bring HP above zero in some way)
-mana.on_character_death_accept(function(ch)
+on_character_death_accept(function(ch)
-- restores to full hp
- mana.being_heal(ch)
+ being_heal(ch)
-- restores 1 hp (in case you want to be less nice)
- -- mana.being_heal(ch, 1)
+ -- being_heal(ch, 1)
-- warp the character to the respawn location
- mana.chr_warp(ch, 1, 815, 100)
+ chr_warp(ch, 1, 815, 100)
end)
@@ -51,14 +51,14 @@ end
-- to the character and/or initialize a tutorial quest.
local function on_chr_birth(ch)
-- this message is shown on first login.
- mana.chat_message(0, ch, "And so your adventure begins...")
+ chat_message(0, ch, "And so your adventure begins...")
end
-- This function is called when a character logs into the game. This can,
-- for example, be utilized for a message-of-the-day or for various
-- handlings of offline processing mechanics.
local function on_chr_login(ch)
- mana.chat_message(0, ch, "Welcome to Manasource")
+ chat_message(0, ch, "Welcome to Manasource")
end
@@ -66,11 +66,11 @@ end
-- be useful for various handling of offline processing mechanics.
local function on_chr_logout(ch)
-- notifies nearby players of logout
- local around = mana.get_beings_in_circle(posX(ch), posY(ch), 1000)
- local msg = mana.being_get_name(ch).." left the game."
+ local around = get_beings_in_circle(posX(ch), posY(ch), 1000)
+ local msg = being_get_name(ch).." left the game."
for b in pairs(around) do
- if mana.being_type(b) == TYPE_CHARACTER then
- mana.chat_message(0, b, msg)
+ if being_type(b) == TYPE_CHARACTER then
+ chat_message(0, b, msg)
end
end
end