summaryrefslogtreecommitdiff
path: root/scripts
AgeCommit message (Collapse)AuthorFilesLines
2012-07-13Fixed the atinit functionErik Schilling1-3/+7
Previously each map had its own scope. They got merged now but the atinit function was forgotten to adapt.
2012-03-30Fixed Lua error reporting for NPC scriptsThorbjørn Lindeijer1-3/+4
This was due to a naming conflict between the 'debug' function I had recently introduced and the 'debug' library provided by Lua. This caused problems when trying to use debug.traceback for printing a backtrace of the error. There's multiple ways to avoid the naming conflict. I opted for writing the related helper functions in all-caps. Also added an ERROR log function now. As Erik pointed out, there is no conflict anymore with Lua's 'error' function with the new naming style. Reviewed-by: Erik Schilling
2012-03-17Added map update function, moved schedules there to keep map contextErik Schilling1-13/+31
Reviewed-by: bjorn.
2012-03-13Added some convenience wrappers to libmana.luaThorbjørn Lindeijer1-0/+25
Global functions 'warn', 'info', 'debug' as shortcuts to the respective 'log' call, which also support passing multiple parameters at the same time, which will be separated by spaces. Global tables 'map' and 'world' which provide convenient read/write access to map and world state variables. Reviewed-by: Yohann Ferreira
2012-03-11Register Lua script API functions into the global namespaceThorbjørn Lindeijer2-26/+26
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
2012-03-11Removed the create_npc wrapper and the last two NPC callbacksThorbjørn Lindeijer1-40/+2
When creating an NPC, you now provide its optional talk and update functions directly rather than them being stored in a table on the Lua side and then called in response to a global callback. Also fixed an issue with a missing gender parameter to the delayed NPC creation callback used by NPCs defined on the map (found by Erik while reviewing this patch). Reviewed-by: Erik Schilling
2012-03-11Removed deprecated NPC helper functionsThorbjørn Lindeijer1-9/+0
Reviewed-by: Erik Schilling
2012-03-11Added callbacks for map/worldvar changesErik Schilling1-0/+44
Reviewed-by: bjorn.
2012-03-10Moved the managing of NPC script coroutines into C++Thorbjørn Lindeijer1-256/+12
Rather than wrapping NPC functions up in coroutines in the Lua side, they are now managed on the C++ side as "script threads", which are essentially the same thing. The main purpose is that the server can now know whether any of these long running script interactions are still active, which will probably be useful when adding the ability to reload scripts. Reviewed-by: Erik Schilling
2012-03-05Added lua function for getting pvp status of mapErik Schilling1-0/+4
mana.map_get_pvp() now returns one of the constants in libmana-constants.lua Reviewed-by: Bertram.
2012-03-03Made some global Lua variables localThorbjørn Lindeijer1-46/+47
We have to be careful with introducing globals now that there is only a single Lua state, so we shouldn't use globals unnecessarily. Any variable should be declared 'local' unless there is a reason to make it global. For additional safety we can also think about disallowing the use of globals entirely. This also helps to catch typos in scripts. Reviewed-by: Erik Schilling
2012-03-03Added further missing callbacksErik Schilling1-0/+11
Reviewed-by: bjorn.
2012-03-02Converted functions called by LuaScript to callbacksThorbjørn Lindeijer1-21/+16
This includes the quest reply, post reply, death notification and remove notification. Also, Script::Ref was changed from a typedef to a small class, automating initialization and making the check for validness clearer. Reviewed-by: Erik Schilling
2012-03-02Merged all the different Lua states into oneThorbjørn Lindeijer1-2/+2
No more Lua state for each status effect, monster, item effect or map. All scripts are loaded into the same state. This should be more efficient overall and make it easier to implement dynamic reloading of the scripts in the future. Now, this introduces the problem of name collisions between different Lua scripts. For now this is solved by using more specific function names, like 'tick_plague' and 'tick_jump' rather than just 'tick'. The plan is however to get rid of these globals, and register these callbacks from the script, so that they can be local functions without the danger of colliding with other scripts. Reviewed-by: Erik Schilling Reviewed-by: Yohann Ferreira
2012-01-02Made all beings capable of having a genderErik Schilling1-2/+2
Reviewed-by: o11c, bjorn, Bertram.
2012-01-02Made do_npc_close to be called by default after the end of the talk functionErik Schilling1-1/+6
Reviewed-by: Bertram.
2011-10-22Officially added the being gender to the protocol.Yohann Ferreira1-0/+1
Reviewed-by: o11c.
2011-06-27Added Lua function for logging.Ablu1-0/+7
You can now call mana.log(loglevel, message) to log messages with scripts. For loglevel you can use the new constants defined in libmana-constants.lua Resolves: Mana-Mantis #359
2011-03-11Simplified check_schedule a bitThorbjørn Lindeijer1-14/+9
2011-03-10Avoid running newly scheduled jobs by using a fixed time point.Yohann Ferreira1-1/+2
Reviewed-by: Thorbjorn.
2011-02-20Fixed the check_schedule() lua function.Yohann Ferreira1-0/+5
An misleading error was raised when the function dealt with its last remaining job as it didn't return after removing it. Reviewed-by: Ablu.
2011-02-11Added the schedule_per_date() lua function.Yohann Ferreira1-0/+11
Reviewed-by: Ablu, Freeyorp.
2011-02-11Fix basic money handling using the ATTR_GP attribute.Yohann Ferreira1-3/+5
Reviewed-by: Freeyorp.
2011-02-11Synced the libmana-constants.lua file with the current protocol.Yohann Ferreira1-59/+68
Trivial.
2011-02-08Implemented LUA binding to get the gender of a characterPhilipp Sehmisch1-0/+3
The function is named mana.chr_get_gender. It returns 0 for male and 1 for female. libmana-constants.lua defines the variables GENDER_MALE and GENDER_FEMALE with these values. Also made the banker NPC refer to the gender of the player character. Reviewed-by: Jaxad0127
2010-05-30Copied basic Lua libs back from tmwserv-data and added dummy dataThorbjørn Lindeijer3-0/+654
The dummy data is currently mostly empty data though, so still nothing to see as far as the example content is concerned. Reviewed-by: Bertram
2007-08-13Deleted obsolete files. Cleaned configuration. Removed obsolete SQL tables.Guillaume Melquiond1-66/+0
2005-11-15Updated bindings, game state class and more (see ChangeLog).Aaron Marks1-6/+53
2005-11-14CVS is being stupid.Aaron Marks1-0/+19