From c079e7235f11d124b9254f44e0d4ec18c7662b6e Mon Sep 17 00:00:00 2001 From: Bardur Arantsson Date: Wed, 25 Jun 2014 19:31:01 +0200 Subject: Remove all the left-over Lua help files --- lib/help/advanced.hlp | 5 +- lib/help/lua.hlp | 34 - lib/help/lua_gf.txt | 45 - lib/help/lua_intr.txt | 133 --- lib/help/lua_mon.txt | 535 ---------- lib/help/lua_play.txt | 1225 ---------------------- lib/help/lua_pow.txt | 266 ----- lib/help/lua_ques.txt | 299 ------ lib/help/lua_skil.txt | 342 ------ lib/help/lua_spel.txt | 2150 -------------------------------------- lib/help/lua_util.txt | 898 ---------------- lib/mods/theme/help/advanced.hlp | 5 +- lib/mods/theme/help/lua.hlp | 34 - lib/mods/theme/help/lua_gf.txt | 45 - lib/mods/theme/help/lua_intr.txt | 133 --- lib/mods/theme/help/lua_mon.txt | 535 ---------- lib/mods/theme/help/lua_play.txt | 1225 ---------------------- lib/mods/theme/help/lua_pow.txt | 266 ----- lib/mods/theme/help/lua_ques.txt | 299 ------ lib/mods/theme/help/lua_skil.txt | 342 ------ lib/mods/theme/help/lua_spel.txt | 2150 -------------------------------------- lib/mods/theme/help/lua_util.txt | 898 ---------------- 22 files changed, 4 insertions(+), 11860 deletions(-) delete mode 100644 lib/help/lua.hlp delete mode 100644 lib/help/lua_gf.txt delete mode 100644 lib/help/lua_intr.txt delete mode 100644 lib/help/lua_mon.txt delete mode 100644 lib/help/lua_play.txt delete mode 100644 lib/help/lua_pow.txt delete mode 100644 lib/help/lua_ques.txt delete mode 100644 lib/help/lua_skil.txt delete mode 100644 lib/help/lua_spel.txt delete mode 100644 lib/help/lua_util.txt delete mode 100644 lib/mods/theme/help/lua.hlp delete mode 100644 lib/mods/theme/help/lua_gf.txt delete mode 100644 lib/mods/theme/help/lua_intr.txt delete mode 100644 lib/mods/theme/help/lua_mon.txt delete mode 100644 lib/mods/theme/help/lua_play.txt delete mode 100644 lib/mods/theme/help/lua_pow.txt delete mode 100644 lib/mods/theme/help/lua_ques.txt delete mode 100644 lib/mods/theme/help/lua_skil.txt delete mode 100644 lib/mods/theme/help/lua_spel.txt delete mode 100644 lib/mods/theme/help/lua_util.txt diff --git a/lib/help/advanced.hlp b/lib/help/advanced.hlp index 3f6fe4bd..8595712b 100644 --- a/lib/help/advanced.hlp +++ b/lib/help/advanced.hlp @@ -7,9 +7,8 @@ Please choose one of the following help files: *****/aoption.txt*0[(a) Options] *****/bmacrofaq.txt*0[(b) Macros] *****/cautomat.txt*0[(c) Automatizer help] - (d) Lua scripting help - coming soon - *****/edebug.txt*0[(e) Debug commands] - *****/fversion.txt*0[(f) Version information] A history of ToME's roots + *****/ddebug.txt*0[(d) Debug commands] + *****/eversion.txt*0[(e) Version information] A history of ToME's roots *****/zhelp.hlp*0[(z) Main Help menu] diff --git a/lib/help/lua.hlp b/lib/help/lua.hlp deleted file mode 100644 index ba61676a..00000000 --- a/lib/help/lua.hlp +++ /dev/null @@ -1,34 +0,0 @@ -|||||oy -~~~~~01|Help|Lua scripting for ToME -#####R Welcome to the ToME Lua Help System. -#####R============================================= - -Please choose one of the following help files: - - *****/alua_intr.txt*0[(a) An Introduction to scripting] - *****/blua_pow.txt*0[(b) Adding a racial power (the 'U' menu)] - *****/clua_skil.txt*0[(c) Adding new skills (the 'm' menu)] - *****/dlua_ques.txt*0[(d) Adding a quest] - - - *****/elua_mon.txt*0[(e) Useful functions in monster.pkg] - *****/flua_play.txt*0[(f) Useful functions in player.pkg] - *****/glua_spel.txt*0[(g) Useful functions in spell.pkg] - *****/hlua_util.txt*0[(h) Useful functions in util.pkg] - - *****/ilua_gf.txt*0[(g) A list of GF_FOO flags] - - - *****/zhelp.hlp*0[(z) Main Help menu] - - - - - - - - - - - - diff --git a/lib/help/lua_gf.txt b/lib/help/lua_gf.txt deleted file mode 100644 index 000f4af5..00000000 --- a/lib/help/lua_gf.txt +++ /dev/null @@ -1,45 +0,0 @@ -|||||oy -#####R /--------------------------\ -#####R< A partial list of GF_FLAGS > -#####R \--------------------------/ - -GF_ARROW: arrows -GF_MISSILE: magic missiles -GF_MANA: mana -GF_LITE_WEAK: light -GF_DARK_WEAK: dark -GF_WATER: water -GF_PLASMA: plasma -GF_METEOR: meteors -GF_ICE: ice -GF_GRAVITY: gravity -GF_INERTIA: inertia -GF_FORCE: force -GF_TIME: pure time -GF_ACID: acid -GF_ELEC: lightning -GF_FIRE: flames -GF_COLD: cold -GF_POIS: poison -GF_LITE: pure light -GF_DARK: pure dark -GF_CONFUSION: confusion -GF_SOUND: sound -GF_SHARDS: shards -GF_NEXUS: nexus -GF_NETHER: nether -GF_CHAOS: chaos -GF_DISENCHANT: disenchantment -GF_KILL_WALL: wall destruction -GF_KILL_DOOR: door destruction -GF_KILL_TRAP: trap destruction -GF_STONE_WALL: wall creation -GF_MAKE_DOOR: door creation -GF_MAKE_TRAP: trap creation -GF_DESTRUCTION: destruction - -Back to the *****lua.hlp*0[lua help index] . - - [[[[[gThis file by fearoffours (fearoffours@moppy.co.uk)] - - diff --git a/lib/help/lua_intr.txt b/lib/help/lua_intr.txt deleted file mode 100644 index ccb87067..00000000 --- a/lib/help/lua_intr.txt +++ /dev/null @@ -1,133 +0,0 @@ -|||||oy -#####R /----------------------------------------\ -#####R < Scripting for ToME with lua > -#####R \----------------------------------------/ - -So, you want to patch ToME eh? Maybe you've had a look at how the edit files -work, maybe even added your own race/class, but want to go further and add -new racial (U) or magic (m) powers. Well these help files will show a little -bit of how to do that. - -I am not a master at this kind of thing. I wrote a small script, with much -help from DarkGod, and he subsequently asked me to write these help files. I -was looking forward to when the lua help files came out so that I could look -at them myself. Little did I know I'd be asked to write them. Therefore I -apologise for any inaccuracies or errors that you find, and if you care to let -me know of any improvements which could be made (especially if you're an -experienced programmer/scripter), I'd love to know. Email me at -[[[[[gfearoffours@moppy.co.uk]. - -#####R=== The example scripts === - -These help files take the form of a tutorial, adding a line at a time to a -script, and explaining important concepts along the way. To see it all in -action, I strongly suggest that you download my example script pack from -[[[[[Ghttp://www.moppy.co.uk/angband.htm]. As well as including all the -scripts covered in these help files, they also include the addition of my -"hina" race which has a Lua scripted racial power which you might like to look -at. There's also a quest which I will be including documentation for as a -tutorial soon. Plus there's all the other lua scripts in the lib\scpt -directory to look at. Most of what you see in these files has been learned from -those files anyway! - -The source code is invaluable as well. There's a searchable and browsable -version of the latest ToME source code available online at -[[[[[Ghttp://www.t-o-m-e.net/cvs.php]. Use it! - -If you don't want to download and install the example scripts, then just -follow the tutorials with a text editor open! But I'll say it again, it's a lot -easier if you download and install the example scripts. - -This file goes on to explain the concepts of scripting, programming, -variables and functions. If you're familiar with these concepts, you might -as well take a look at how to add a power to the U menu in the -*****lua_pow.txt*0[Scripting a racial power] file. - - -#####R=== Defining some basic stuff === - -Computers don't do anything that they're not told to do. When we script, or -program, we must assume they know nothing. We have to tell them each little -bit of information from the ground up. - -A program, or a script (we'll talk about exact differences later) is like a -set of instructions. Let's imagine that people responded to programs, and -that we had a program called "Housework". Its series of instructions might -look something like this: - -#####BDo the Washing up. -#####BClean the kitchen. -#####BDust the shelves. -#####BHoover the lounge. - -Each step above could be called a function, as they are all actions that -need to be carried out. Now to you and me, we'd understand that program just -fine, but if someone didn't know HOW to wash, or what hoovering was, they'd -soon run into problems. For those people we'd need to define each function -clearly. Thus "do the washing up" might be - - -#####BRun hot water into bowl. -#####BAdd washing up liquid. -#####BPut dirty plates into bowl -#####BScrub plates till clean -#####BPlace clean plates on rack to dry, - -There's still plenty of problems here though. We've not said to turn the tap -off, or what the bowl is, or to wash any dirty cutlery, mugs, saucepans, etc., -etc. Whilst this might seem fairly obvious to a person, this is how we need -to think when writing programs for computers. - -Lets look now at some of the terms we're going to be using, in the rest of -these help files, and what they mean... - -#####R=== Variables and Constants === -A variable is a way to store information in a computer. Just as you store -things in your own memory, you can store things in the computer's memory. And -just as things change in your memory, so things can change in the computer's -memory. This factor of change is why they're called "variables" and not -"statics". - -For instance, you may have a friend's email address committed to memory, but -things change over time, they get a new ISP or domain, and so their email -address changes. You commit this new address to memory, and eventually -forget the old one. The thing you have stored in your memory is the same -(your friend's address) but the value (property) of what you have stored has -changed (from friend@old-address.com to friend@new-address.com). - -Variables are the building blocks out of which you will create your patch. - -A variable which will *never* change its value is called a constant. - -#####R===Functions=== - -A function is a series of steps or statements, grouped together and given -one name. When you want to carry out those steps, you simply ask the -computer to carry out that function. To go back to our original example, -rather than saying, "I'd like you to run some hot water into a bowl, add the -washing up liquid, put the dirty plates into it, and then scrub them till -they're clean", we just say "do the washing up". - -This is where we come to the difference between scripting and programming. -With scripting we can use the functions and variables that exist in the -ToME code. Maintainers like DarkGod have already made sure that the -computer knows how to "do the washing up", including turning the tap off and -what the bowl is. All we need to do in our script is say "do the washing -up". Or to look at it in a more relevant way, the game has been coded so -that when a magic missile is fired, a bolt or beam spell with a black line -of asterisks will be drawn in the direction indicated by the player, the -mana of that spell will be used up, the monster will take the appropriate -amount of damage, and so on. All we need to do in our script is say "fire a -magic missile". - -As you script, you will still be designing your own functions, and -variables, but the hardest parts have been done for you! - -Not every function and global variable in the source-code has been exported to -use in your scripting. But the ones that have are easily identifiable by -looking in any source files with the extension .pkg . Chris Hadgis has written -some excellent documentation which outline the use of the most important -functions in some of these files. They outline the functions from the - -OK, the first tutorial proper is on *****lua_pow.txt*0[adding a racial power] . - - [[[[[gThis file by fearoffours (fearoffours@moppy.co.uk)] diff --git a/lib/help/lua_mon.txt b/lib/help/lua_mon.txt deleted file mode 100644 index 9bb363c0..00000000 --- a/lib/help/lua_mon.txt +++ /dev/null @@ -1,535 +0,0 @@ -|||||oy - -#####R /----------------------------------------\ -#####R < monster.pkg functions helper file > -#####R \----------------------------------------/ - - ----------------------------------------------------------------------- - -#####R=== race_info_idx === - -#####GDeclaration - extern monster_race* race_info_idx(int r_idx, int ego); - -#####GFile - monster2.c - -#####GComment -/* - * Return a (monster_race*) with the combinations of the monster - * properties and the ego type - */ - -#####GDescription -Get monster info and ego info for monster with monster index "r_idx" -and monster ego "ego". The ego information is applied to the monster -information and the new monster information is returned. - -For example, race_info_idx(141,7) will create a brown yeek (monster) -shaman (ego). - -#####GParameters -> "r_idx" is an entry from the "r_info.txt" file. Beware: there is no - range checking. -> "ego" is an entry from the "re_info.txt". Beware: there is no range - checking. - ----------------------------------------------------------------------- - -#####R=== delete_monster_idx === - -#####GDeclaration - extern void delete_monster_idx(int i); - -#####GFile - monster2.c - -#####GComment -/* - * Delete a monster by index. - * - * When a monster is deleted, all of its objects are deleted. - */ - -#####GDescription -Delete monster "i" from the monster array. - -#####GParameters -> "i" is the index for the monster list (m_list[]). Beware: there is - no range checking. - ----------------------------------------------------------------------- - -#####R=== m_pop === - -#####GDeclaration - extern s16b m_pop(void); - -#####GFile - monsters2.c - -#####GComment -/* - * Acquires and returns the index of a "free" monster. - * - * This routine should almost never fail, but it *can* happen. - */ - -#####GDescription -Get an empty slot in the monster list (m_list[]). If there are no -empty slots, a slot will be reclaimed from a "dead" monster. If all -slots are full, 0 is returned, which means the function has failed -("Too many monsters!"). - ----------------------------------------------------------------------- - -#####R=== get_mon_num_prep === - -#####GDeclaration - extern errr get_mon_num_prep(void); - -#####GFile - monster2.c - -#####GComment -/* - * Apply a "monster restriction function" to the "monster allocation table" - */ - -#####GDescription -There are no parameters, but there are some other variables which will -need to be set. They are get_mon_num_hook and get_mon_num2_hook. They -are pointers to functions. - -For example, get_mon_num_hook = monster_volcano means when -get_mon_num_hook is called (*get_mon_num_hook)(index), the actual -function called is monster_volcano(index). This particular function -returns TRUE if the monster indicated by "index" has the -RF8_WILD_VOLCANO flag set. - -It is a good idea to store the old value of get_mon_num_hook before -setting a new one, and restoring it when your function is finished. - -Following is a list of functions which can be assigned to -get_mon_num_hook: - -create_molds_hook -create_townpeople_hook -mon_hook_bounty -monster_dungeon -monster_grass -monster_mountain -monster_ocean -monster_quest -monster_shore -monster_town -monster_volcano -monster_waste -monster_wood -mutate_monster_okay -place_monster_okay -summon_specific_okay -vault_aux_animal -vault_aux_chapel -vault_aux_clone -vault_aux_demon -vault_aux_dragon -vault_aux_giant -vault_aux_jelly -vault_aux_kennel -vault_aux_orc -vault_aux_symbol -vault_aux_treasure -vault_aux_troll -vault_aux_undead - -Or you can write your own. The function must take an integer (index) -as a parameter and return boolean (TRUE if the monster is selected, -or FALSE if it is not). - ----------------------------------------------------------------------- - -#####R=== get_mon_num === - -#####GDeclaration - extern s16b get_mon_num(int level); - -#####GFile - monster2.c - -#####GComment -/* - * Choose a monster race that seems "appropriate" to the given level - * - * This function uses the "prob2" field of the "monster allocation table", - * and various local information, to calculate the "prob3" field of the - * same table, which is then used to choose an "appropriate" monster, in - * a relatively efficient manner. - * - * Note that "town" monsters will *only* be created in the town, and - * "normal" monsters will *never* be created in the town, unless the - * "level" is "modified", for example, by polymorph or summoning. - * - * There is a small chance (1/50) of "boosting" the given depth by - * a small amount (up to four levels), except in the town. - * - * It is (slightly) more likely to acquire a monster of the given level - * than one of a lower level. This is done by choosing several monsters - * appropriate to the given level and keeping the "hardest" one. - * - * Note that if no monsters are "appropriate", then this function will - * fail, and return zero, but this should *almost* never happen. - */ - -Description: -For the given level "level", return the index of an appropriate -monster race. - -#####GParameters -> "level" is a dungeon level - ----------------------------------------------------------------------- - -#####R=== monster_desc === - -#####GDeclaration - extern void monster_desc(char *desc, monster_type *m_ptr, - int mode); - -#####GFile - monster2.c - -#####GComment -/* - * Build a string describing a monster in some way. - * - * We can correctly describe monsters based on their visibility. - * We can force all monsters to be treated as visible or invisible. - * We can build nominatives, objectives, possessives, or reflexives. - * We can selectively pronominalize hidden, visible, or all monsters. - * We can use definite or indefinite descriptions for hidden monsters. - * We can use definite or indefinite descriptions for visible monsters. - * - * Pronominalization involves the gender whenever possible and allowed, - * so that by cleverly requesting pronominalization / visibility, you - * can get messages like "You hit someone. She screams in agony!". - * - * Reflexives are acquired by requesting Objective plus Possessive. - * - * If no m_ptr arg is given (?), the monster is assumed to be hidden, - * unless the "Assume Visible" mode is requested. - * - * If no r_ptr arg is given, it is extracted from m_ptr and r_info - * If neither m_ptr nor r_ptr is given, the monster is assumed to - * be neuter, singular, and hidden (unless "Assume Visible" is set), - * in which case you may be in trouble... :-) - * - * I am assuming that no monster name is more than 70 characters long, - * so that "char desc[80];" is sufficiently large for any result. - * - * Mode Flags: - * 0x01 --> Objective (or Reflexive) - * 0x02 --> Possessive (or Reflexive) - * 0x04 --> Use indefinites for hidden monsters ("something") - * 0x08 --> Use indefinites for visible monsters ("a kobold") - * 0x10 --> Pronominalize hidden monsters - * 0x20 --> Pronominalize visible monsters - * 0x40 --> Assume the monster is hidden - * 0x80 --> Assume the monster is visible - * - * Useful Modes: - * 0x00 --> Full nominative name ("the kobold") or "it" - * 0x04 --> Full nominative name ("the kobold") or "something" - * 0x80 --> Genocide resistance name ("the kobold") - * 0x88 --> Killing name ("a kobold") - * 0x22 --> Possessive, genderized if visible ("his") or "its" - * 0x23 --> Reflexive, genderized if visible ("himself") or "itself" - */ - -#####GDescription -Return a monster description "desc" for monster "monster_type" using -flag "mode". The modes are described above. - -#####GParameters -> "desc" is the returned description. -> "monster type" is the monster (monster pointer). -> "mode" is one of the modes described in the comments. - ----------------------------------------------------------------------- - -#####R=== monster_race_desc === - -#####GDeclaration - extern void monster_race_desc(char *desc, int r_idx, - int ego); - -#####GFile - monster2.c - -#####GComment -(none) - -#####GDescription -Return the monster description "desc" for monster with monster index -"r_idx" and monster ego "ego". The monster description is made up of -the ego name (if any) and monster name, or the unique name. - -#####GParameters -> "desc" is the returned description. -> "r_idx" is an entry from the "r_info.txt" file. Beware: there is no - range checking. -> "ego" is an entry from the "re_info.txt". Beware: there is no range - checking. - ----------------------------------------------------------------------- - -#####R=== place_monster_aux === - -#####GDeclaration - extern bool place_monster_aux(int y, int x, int r_idx, - bool slp, bool grp, int status); - -#####GFile - monster2.c - -#####GComment -/* - * Attempt to place a monster of the given race at the given location - * - * Note that certain monsters are now marked as requiring "friends". - * These monsters, if successfully placed, and if the "grp" parameter - * is TRUE, will be surrounded by a "group" of identical monsters. - * - * Note that certain monsters are now marked as requiring an "escort", - * which is a collection of monsters with similar "race" but lower - * level. - * - * Some monsters induce a fake "group" flag on their escorts. - * - * Note the "bizarre" use of non-recursion to prevent annoying output - * when running a code profiler. - * - * Note the use of the new "monster allocation table" code to restrict - * the "get_mon_num()" function to "legal" escort types. - */ - -#####GDescription -Attempt to place a monster at grid "y", "x". The monster has monster -index "m_idx". The monster may be asleep ("slp"). The monster may be -surrounded by a group of identical monsters ("grp"). The monster has -a status of "status" (see below). The function returns TRUE if the -monster is placed successfully, otherwise FALSE. - -#####GParameters -> "y" is the y co-ordinate of the target grid. -> "x" is the x co-ordinate of the target grid. -> "r_idx" is an entry from the "r_info.txt" file. Beware: there is no - range checking. -> "slp" is TRUE if the monster is asleep, otherwise FALSE. -> "grp" is TRUE if the monster is surrounded by a group, otherwise - FALSE. -> "status" is the status of the monster - *****fields.txt*0[status] - ----------------------------------------------------------------------- - -#####R=== place_monster === - -#####GDeclaration - extern bool place_monster(int y, int x, bool slp, - bool grp); - -#####GFile - monster2.c - -#####GComment -/* - * Hack -- attempt to place a monster at the given location - * - * Attempt to find a monster appropriate to the "monster_level" - */ - -#####GDescription -Attempt to place a monster at grid "y", "x". The monster may be asleep -("slp"). The monster may be surrounded by a group of identical -monsters ("grp"). The monster is of the appropriate monster level. The -function returns TRUE if the monster is placed successfully, otherwise -FALSE. - -#####GParameters -> "y" is the y co-ordinate of the target grid. -> "x" is the x co-ordinate of the target grid. -> "slp" is TRUE if the monster is asleep, otherwise FALSE. -> "grp" is TRUE if the monster is surrounded by a group, otherwise - FALSE. - ----------------------------------------------------------------------- - -#####R=== place_monster_one === - -#####GDeclaration - extern s16b place_monster_one(int y, int x, int r_idx, - int ego, bool slp, int status); - -#####GFile - monster2.c - -#####GComment -/* - * Attempt to place a monster of the given race at the given location. - * - * To give the player a sporting chance, any monster that appears in - * line-of-sight and is extremely dangerous can be marked as - * "FORCE_SLEEP", which will cause them to be placed with low energy, - * which often (but not always) lets the player move before they do. - * - * This routine refuses to place out-of-depth "FORCE_DEPTH" monsters. - * - * XXX XXX XXX Use special "here" and "dead" flags for unique monsters, - * remove old "cur_num" and "max_num" fields. - * - * XXX XXX XXX Actually, do something similar for artifacts, to simplify - * the "preserve" mode, and to make the "what artifacts" flag more useful. - * - * This is the only function which may place a monster in the dungeon, - * except for the savefile loading code. - */ - -#####GDescription -Attempt to place a monster at grid "y", "x". The monster has monster -index "m_idx". The monster may be asleep ("slp"). The monster may have -an ego type ("ego"). The monster has a status of "status" (see below). -The function returns TRUE if the monster is placed successfully, -otherwise FALSE. - -#####GParameters -> "y" is the y co-ordinate of the target grid. -> "x" is the x co-ordinate of the target grid. -> "r_idx" is an entry from the "r_info.txt" file. Beware: there is no - range checking. -> "slp" is TRUE if the monster is asleep, otherwise FALSE. -> "ego" is an entry from the "re_info.txt". Beware: there is no range - checking. -> "status" is the status of the monster - *****fields.txt*0[status] - ----------------------------------------------------------------------- - -#####R=== is_friend === - -#####GDeclaration - extern int is_friend(monster_type *m_ptr); - -#####GFile - monster3.c - -#####GComment -/* - * Is the monster in friendly state(pet, friend, ..) - * -1 = enemy, 0 = neutral, 1 = friend - */ - -#####GDescription -Return a value to indicate the status of monster "m_ptr". - *****fields.txt*0[status] - -#####GParameters -> "m_ptr" is a pointer to a monster. - ----------------------------------------------------------------------- - -#####R=== is_enemy === - -#####GDeclaration - extern bool is_enemy(monster_type *m_ptr, - monster_type *t_ptr); - -#####GFile - monster3.c - -#####GComment -/* Should they attack each others */ - -#####GDescription -Return TRUE if monster "m_ptr" should attack monster "t_ptr". If -"m_ptr" is stupid and "r_ptr" is a different type of monster then the -function will return TRUE. If "m_ptr" is not neutral and "r_ptr" is a -breeder, and "r_ptr" is a different type of monster then the function -will return TRUE (and vice versa). If both monsters are not neutral -and one is friendly and the other isn't then the function will return -TRUE. Otherwise the function returns FALSE. - -#####GParameters -> "m_ptr" is a pointer to a monster. -> "t_ptr" is a pointer to a monster (target). - ----------------------------------------------------------------------- - -#####R=== change_side === - -#####GDeclaration - extern bool change_side(monster_type *m_ptr); - -#####GFile - monster3.c - -#####GComment -(none) - -#####GDescription -Change the status of monster "m_ptr" from friendly to unfriendly and -vice versa. Friends and pets become enemies. Neutral Ms become -neutral Ps and vice versa. Companions are unaffected. The -function returns TRUE if the status changed, otherwise FALSE. - -#####GParameters -> "m_ptr" is a pointer to a monster. - ----------------------------------------------------------------------- - -#####R=== find_position === - -#####GDeclaration - extern void find_position(int y, int x, int *yy = 0, - int *xx = 0); - -#####GFile - lua_bind.c - -#####GComment -(none) - -#####GDescription -Find a new grid "yy", "xx" within 6 grids of target grid "y", "x". -The new grid must be within line-of-sight of the target grid. A -maximum of 5000 attempts is made. - -#####GParameters -> "y" is the y co-ordinate of the target grid. -> "x" is the x co-ordinate of the target grid. -> "yy" is the y co-ordinate of the new grid. -> "xx" is the x co-ordinate of the new grid. - ----------------------------------------------------------------------- - -#####R=== can_create_companion === - -#####GDeclaration - extern bool can_create_companion(); - -#####GFile - monster3.c - -#####GComment -/* Returns if a new companion is allowed */ - -#####GDescription -Return TRUE if a companion can be created, otherwise FALSE. - ----------------------------------------------------------------------- - -Back to the *****lua.hlp*0[lua help index] . - - - [[[[[gThis file by Chris Hadgis] diff --git a/lib/help/lua_play.txt b/lib/help/lua_play.txt deleted file mode 100644 index 6ab64ddb..00000000 --- a/lib/help/lua_play.txt +++ /dev/null @@ -1,1225 +0,0 @@ -|||||oy - -#####R /----------------------------------------\ -#####R < player.pkg functions helper file > -#####R \----------------------------------------/ - ----------------------------------------------------------------------- - -#####RFunction: set_parasite - -#####GDeclaration: bool set_parasite(int v, int r); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->parasite" and "p_ptr->parasite_r_idx" -* notice observable changes -*/ - -#####GDescription: -Set time "v" until parasite with monster index "r" is created. The -player gets the message "You feel something growing in you" if "v" -is > 0. Otherwise the player gets the message "Your body convulse -and spawn " if the monster is created (80% chance) or -"The hideous thing growing in you seems to die" if the monster dies. - -#####GParameters: ->v is the time until the parasite gestates (must be between 0 and - 10000). ->r is the monster index of parasite to be created. - ----------------------------------------------------------------------- - -#####RFunction: set_disrupt_shield - -#####GDeclaration: bool set_disrupt_shield(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->disrupt_shield" -* notice observable changes -*/ - -#####GDescription: -Set time "v" until shield of invulnerability expires. The player gets -the message "You feel invulnerable" if "v" is > 0. Otherwise the -player gets the message "You are more vulnerable". - -#####GParameters: ->v is the time until the shield expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_prob_travel - -#####GDeclaration: bool set_prob_travel(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->prob_travel" -* notice observable changes -*/ - -#####GDescription: -Set time "v" until random teleportation expires. The player gets -the message "You feel instable" if "v" is > 0. Otherwise the -player gets the message "You are more stable". - -#####GParameters: ->v is the time until random teleportation expires (must be between 0 - and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_tim_deadly - -#####GDeclaration: bool set_tim_deadly(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_deadly" -*/ - -#####GDescription: -Set time "v" until deadly accuracy expires. The player gets the -message "You feel extremely accurate" if "v" is > 0. Otherwise the -player gets the message "You are suddenly much less accurate". - -#####GParameters: ->v is the time until deadly accuracy expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_tim_res_time - -#####GDeclaration: bool set_tim_res_time(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_res_time" -*/ - -#####GDescription: -Set time "v" until space-time distortions expire. The player gets the -message "You are now protected against the space-time distortions" if -"v" is > 0. Otherwise the player gets the message "You are no longer -protected against the space-time distortions". - -#####GParameters: ->v is the time until space-time distortions expire (must be between - 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_tim_reflect - -#####GDeclaration: bool set_tim_reflect(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_reflect" -*/ - -#####GDescription: -Set time "v" until reflection expire. The player gets the message -"You start reflecting the world around you" if "v" is > 0. Otherwise -the player gets the message "You stop reflecting". - -#####GParameters: ->v is the time until reflection expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_meditation - -#####GDeclaration: bool set_meditation(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->meditation" -*/ - -#####GDescription: -Set time "v" until meditation expire. The player gets the message -"You start meditating on yourself" if "v" is > 0. Otherwise the -player gets the message "You stop your self meditation". - -#####GParameters: ->v is the time until meditation expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_strike - -#####GDeclaration: bool set_strike(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->strike" -*/ - -#####GDescription: -Set time "v" until accurate strikes expire. The player gets the -message "You feel very accurate" if "v" is > 0. Otherwise the player -gets the message "You are no longer very accurate". - -#####GParameters: ->v is the time until accurate strikes expire (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_walk_water - -#####GDeclaration: bool set_walk_water(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->walk_water", notice observable changes -*/ - -#####GDescription: -Set time "v" until walking on water expires. The player gets the -message "You feel strangely insubmersible" if "v" is > 0. Otherwise -the player gets the message "You are no longer insubmersible". - -#####GParameters: ->v is the time until walking on water expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_tim_ffall - -#####GDeclaration: bool set_tim_ffall(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_ffall" -*/ - -#####GDescription: -Set time "v" until feather-fall expires. The player gets the message -"You feel very light" if "v" is > 0. Otherwise the player gets the -message "You are suddenly heavier". - -#####GParameters: ->v is the time until feather-fall expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_tim_fire_aura - -#####GDeclaration: bool set_tim_fire_aura(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_fire_aura" -*/ - -#####GDescription: -Set time "v" until fiery aura expires. The player gets the message -"You are enveloped in flames" if "v" is > 0. Otherwise the player -gets the message "You are no longer enveloped in flames". - -#####GParameters: ->v is the time until fiery aura expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_holy - -#####GDeclaration: bool set_holy(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->holy", notice observable changes -*/ - -#####GDescription: -Set time "v" until holiness expires. The player gets the message -"You feel a holy aura around you" if "v" is > 0. Otherwise the -player gets the message "The holy aura vanishes". - -#####GParameters: ->v is the time until holiness expires (must be between 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_grace - -#####GDeclaration: void set_grace(s32b v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->grace", notice observable changes -*/ - -#####GDescription: -Set grace to value "v". Don't allow grace to fall below -30000 or -rise above 30000. - -#####GParameters: ->v is the value of grace. - ----------------------------------------------------------------------- - -#####RFunction: set_mimic - -#####GDeclaration: bool set_mimic(int v, int p); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_mimic", and "p_ptr->mimic_form", -* notice observable changes -*/ - -#####GDescription: -Set time "v" until morph into monster with monster index "p" expires. -The player gets the message "You feel your body change" if "v" is > 0. -Otherwise the player gets the message "You are no longer transformed". - -#####GParameters: ->v is the time until transformation expires (must be between 0 and - 10000). ->p is the monster index of the monster the player wants to mimic. - ----------------------------------------------------------------------- - -#####RFunction: set_no_breeders - -#####GDeclaration: bool set_no_breeders(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "no_breeds" -*/ - -#####GDescription: -Set time "v" until breeders can breed again. The player gets the -message "You feel an anti-sexual aura" if "v" is > 0. Otherwise the -player gets the message "You no longer feel an anti-sexual aura". -Okay... - -#####GParameters: ->v is the time until breeders can breed again (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_invis - -#####GDeclaration: bool set_invis(int v,int p); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_invis", and "p_ptr->tim_inv_pow", -* notice observable changes -*/ - -#####GDescription: -Set time "v" until invisibility expires. The player gets the message -"You feel your body fade away" if "v" is > 0. Otherwise the player -gets the message "You are no longer invisible". - -#####GParameters: ->v is the time until invisibility expires (must be between 0 and - 10000). ->p is the power of timed invisibility. - ----------------------------------------------------------------------- - -#####RFunction: set_lite - -#####GDeclaration: bool set_lite(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_lite", notice observable changes -* -* Note the use of "PU_VIEW", which is needed to -* memorise any terrain features which suddenly become "visible". -* Note that blindness is currently the only thing which can affect -* "player_can_see_bold()". -*/ - -#####GDescription: -Set time "v" until brightness expires. The player gets the message -"You suddenly seem brighter" if "v" is > 0. Otherwise the player -gets the message "You are no longer bright". - -#####GParameters: ->v is the time until brightness expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_blind - -#####GDeclaration: bool set_blind(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->blind", notice observable changes -* -* Note the use of "PU_UN_VIEW", which is needed to memorise any terrain -* features which suddenly become "visible". -* Note that blindness is currently the only thing which can affect -* "player_can_see_bold()". -*/ - -#####GDescription: -Set time "v" until blindness expires. The player gets the message "You -are blind" if "v" is > 0. Otherwise the player gets the message "You -can see again". - -#####GParameters: ->v is the time until blindness expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_confused - -#####GDeclaration: bool set_confused(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->confused", notice observable changes -*/ - -#####GDescription: -Set time "v" until confusion expires. The player gets the message "You -are confused" if "v" is > 0. Otherwise the player gets the message -"You feel less confused now". - -#####GParameters: ->v is the time until confusion expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_poisoned - -#####GDeclaration: bool set_poisoned(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->poisoned", notice observable changes -*/ - -#####GDescription: -Set time "v" until poison expires. The player gets the message "You -are poisoned" if "v" is > 0. Otherwise the player gets the message -"You are no longer poisoned". - -#####GParameters: ->v is the time until poison expires (must be between 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_afraid - -#####GDeclaration: bool set_afraid(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->afraid", notice observable changes -*/ - -#####GDescription: -Set time "v" until fear expires. The player gets the message "You are -terrified" if "v" is > 0. Otherwise the player gets the message "You -feel bolder now". - -#####GParameters: ->v is the time until fear expires (must be between 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_paralyzed - -#####GDeclaration: bool set_paralyzed(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->paralyzed", notice observable changes -*/ - -#####GDescription: -Set time "v" until paralysis expires. The player gets the message "You -are paralyzed" if "v" is > 0. Otherwise the player gets the message -"You can move again". - -#####GParameters: ->v is the time until paralysis expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_image - -#####GDeclaration: bool set_image(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->image", notice observable changes -* -* Note that we must redraw the map when hallucination changes. -*/ - -#####GDescription: -Set time "v" until hallucination expires. The player gets the message -"Oh, wow! Everything looks so cosmic now" if "v" is > 0. Otherwise -the player gets the message "You can see clearly again". - -#####GParameters: ->v is the time until hallucination expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_fast - -#####GDeclaration: bool set_fast(int v, int p); - -#####GFile: xtra2.c - -#####GComment: -(none) - -#####GDescription: -Set time "v" until speed of speed factor "p" expires. The player gets -the message "You feel yourself moving faster" if "v" is > 0. Otherwise -the player gets the message "You feel yourself slow down". - -#####GParameters: ->v is the time until speed expires (must be between 0 and 10000). ->p is the speed factor. - ----------------------------------------------------------------------- - -#####RFunction: set_light_speed - -#####GDeclaration: bool set_light_speed(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->lightspeed", notice observable changes -*/ - -#####GDescription: -Set time "v" until light-speed expires. The player gets the message -"You feel as if time has stopped" if "v" is > 0. Otherwise the player -gets the message "You feel time returning to its normal rate". - -#####GParameters: ->v is the time until light-speed expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_slow - -#####GDeclaration: bool set_slow(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->slow", notice observable changes -*/ - -#####GDescription: -Set time "v" until slowness expires. The player gets the message "You -feel yourself moving slower" if "v" is > 0. Otherwise the player gets -the message "You feel yourself speed up". - -#####GParameters: ->v is the time until slowness expires (must be between 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_shield - -#####GDeclaration: bool set_shield(int v, int p, s16b o, s16b d1, s16b d2); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->shield", notice observable changes -*/ - -#####GDescription: -Set time "v" until stone-shield expires. The player gets the message -"Your skin turns to stone" if "v" is > 0. Otherwise the player gets -the message "Your skin returns to normal". Stone-shield has spell -power "p", spell option "o", and power options "d1" and "d2". - -#####GParameters: ->v is the time until stone-shield expires (must be between 0 and - 10000). ->p is the power of the stone-shield spell. ->o is the option of the stone-shield spell. ->d1 is the power for option 1 of the stone-shield spell. ->d2 is the power for option 2 of the stone-shield spell. - ----------------------------------------------------------------------- - -#####RFunction: set_blessed - -#####GDeclaration: bool set_blessed(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->blessed", notice observable changes -*/ - -#####GDescription: -Set time "v" until blessing expires. The player gets the message "You -feel righteous" if "v" is > 0. Otherwise the player gets the message -"The prayer has expired". - -#####GParameters: ->v is the time until blessing expires (must be between 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_hero - -#####GDeclaration: bool set_hero(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->hero", notice observable changes -*/ - -#####GDescription: -Set time "v" until heroism expires. The player gets the message "You -feel like a hero" if "v" is > 0. Otherwise the player gets the -message "The heroism wears off". - -#####GParameters: ->v is the time until heroism expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_shero - -#####GDeclaration: bool set_shero(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->shero", notice observable changes -*/ - -#####GDescription: -Set time "v" until berserk expires. The player gets the message "You -feel like a killing machine" if "v" is > 0. Otherwise the player gets -the message "You feel less Berserk". - -#####GParameters: ->v is the time until berserk expires (must be between 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_protevil - -#####GDeclaration: bool set_protevil(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->protevil", notice observable changes -*/ - -#####GDescription: -Set time "v" until protection from evil expires. The player gets the -message "You feel safe from evil" if "v" is > 0. Otherwise the player -gets the message "You no longer feel safe from evil". - -#####GParameters: ->v is the time until protection from evil expires (must be between 0 - and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_protgood - -#####GDeclaration: bool set_protgood(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->protgood", notice observable changes -*/ - -#####GDescription: -Set time "v" until protection from good expires. The player gets the -message "You feel safe from good" if "v" is > 0. Otherwise the player -gets the message "You no longer feel safe from good". - -#####GParameters: ->v is the time until protection from evil expires (must be between 0 - and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_protundead - -#####GDeclaration: bool set_protundead(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->protundead", notice observable changes -*/ - -#####GDescription: -Set time "v" until protection from undead expires. The player gets the -message "You feel safe from undead" if "v" is > 0. Otherwise the -player gets the message "You no longer feel safe from undead". - -#####GParameters: ->v is the time until protection from undead expires (must be between - 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_invuln - -#####GDeclaration: bool set_invuln(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->invuln", notice observable changes -*/ - -#####GDescription: -Set time "v" until invulnerability expires. The player gets the -message "Invulnerability" if "v" is > 0. Otherwise the player gets -the message "The invulnerability wears off". - -#####GParameters: ->v is the time until invulnerability expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_tim_invis - -#####GDeclaration: bool set_tim_invis(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_invis", notice observable changes -*/ - -#####GDescription: -Set time "v" until see invisible expires. The player gets the message -"Your eyes feel very sensitive" if "v" is > 0. Otherwise the player -gets the message "Your eyes feel less sensitive". - -#####GParameters: ->v is the time until see invisible expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_tim_infra - -#####GDeclaration: bool set_tim_infra(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_infra", notice observable changes -*/ - -#####GDescription: -Set time "v" until infravision expires. The player gets the message -"Your eyes begin to tingle" if "v" is > 0. Otherwise the player gets -the message "Your eyes stop tingling". - -#####GParameters: ->v is the time until infravision expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_mental_barrier - -#####GDeclaration: bool set_mental_barrier(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_mental_barrier", notice observable changes -*/ - -#####GDescription: -Set time "v" until mental barrier expires. The player gets the message -"Your mind grows stronger" if "v" is > 0. Otherwise the player gets -the message "Your mind is no longer especially strong". - -#####GParameters: ->v is the time until mental barrier expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_acid - -#####GDeclaration: bool set_oppose_acid(int v); - -#####GFile: xtra2.c - -#####GComment: - -#####GDescription: -Set time "v" until feather-fall expires. The player gets the message -"You feel very light" if "v" is > 0. Otherwise the player gets the -message "You are suddenly heavier". - -#####GParameters: ->v is the time until feather-fall expires (must be between 0 and - 10000). ->v is the time until feather-fall expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_elec - -#####GDeclaration: bool set_oppose_elec(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->oppose_elec", notice observable changes -*/ - -#####GDescription: -Set time "v" until electricity resistance expires. The player gets -the message "You feel resistant to electricity" if "v" is > 0. -Otherwise the player gets the message "You feel less resistant to -electricity". - -#####GParameters: ->v is the time until electricity resistance expires (must be between - 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_fire - -#####GDeclaration: bool set_oppose_fire(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->oppose_fire", notice observable changes -*/ - -#####GDescription: -Set time "v" until fire resistance expires. The player gets the -message "You feel resistant to fire" if "v" is > 0. Otherwise the -player gets the message "You feel less resistant to fire". - -#####GParameters: ->v is the time until fire resistance expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_cold - -#####GDeclaration: bool set_oppose_cold(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->oppose_cold", notice observable changes -*/ - -#####GDescription: -Set time "v" until cold resistance expires. The player gets the -message "You feel resistant to cold" if "v" is > 0. Otherwise the -player gets the message "You feel less resistant to cold". - -#####GParameters: ->v is the time until cold resistance expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_pois - -#####GDeclaration: bool set_oppose_pois(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->oppose_pois", notice observable changes -*/ - -#####GDescription: -Set time "v" until poison resistance expires. The player gets the -message "You feel resistant to poison" if "v" is > 0. Otherwise the -player gets the message "You feel less resistant to poison". - -#####GParameters: ->v is the time until poison resistance expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_ld - -#####GDeclaration: bool set_oppose_ld(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->oppose_ld" -*/ - -#####GDescription: -Set time "v" until light and dark resistance expires. The player gets -the message "You feel protected against the light's fluctuation" if -"v" is > 0. Otherwise the player gets the message "You are no longer -protected against the light's fluctuation". - -#####GParameters: ->v is the time until light and dark resistance expires (must be - between 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_cc - -#####GDeclaration: bool set_oppose_cc(int v); - -#####GFile: xtra2.c -/* -* Set "p_ptr->oppose_cc" -*/ - -#####GComment: - -#####GDescription: -Set time "v" until chaos resistance expires. The player gets the -message "You feel protected against raw chaos" if "v" is > 0. -Otherwise the player gets the message "You are no longer protected -against chaos". - -#####GParameters: ->v is the time until chaos resistance expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_ss - -#####GDeclaration: bool set_oppose_ss(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->oppose_ss" -*/ - -#####GDescription: -Set time "v" until sound and shard resistance expires. The player gets -the message "You feel protected against the ravages of sound and -shards" if "v" is > 0. Otherwise the player gets the message "You are -no longer protected against the ravages of sound and shards". - -#####GParameters: ->v is the time until sound and shard resistance expires (must be - between 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_nex - -#####GDeclaration: bool set_oppose_nex(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->oppose_nex" -*/ - -#####GDescription: -Set time "v" until nexus resistance expires. The player gets the -message "You feel protected against the strange forces of nexus" if -"v" is > 0. Otherwise the player gets the message "You are no longer -protected against the strange forces of nexus". - -#####GParameters: ->v is the time until nexus resistance expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_stun - -#####GDeclaration: bool set_stun(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->stun", notice observable changes -* -* Note the special code to only notice "range" changes. -*/ - -#####GDescription: -Set stun level "v". If the player race can't be stunned then the level -is forced to 0. A value > 100 means the player is knocked out. A value ->50 is a heavy stun. A value > 0 is a stun. If the stun level has -increased, a message is printed. There is a small chance of stun level -in 1000, or a 1 in 16 chance of a vicious blow which decreases -intelligence and/or wisdom for a while. - -#####GParameters: ->v is the stun level. - ----------------------------------------------------------------------- - -#####RFunction: set_cut - -#####GDeclaration: bool set_cut(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->cut", notice observable changes -* -* Note the special code to only notice "range" changes. -*/ - -#####GDescription: -Set cut level "v". If the player race can't be cut then the time is -forced to 0. A value > 1000 is a mortal wound. A value > 200 is a deep -gash. A value > 100 is a severe cut. A value > 50 is a nasty cut. A -value > 25 is a bad cut. A value > 10 is a light cut. A value > 0 is a -graze. If the cut level has increased, a message is printed. There is -a small chance of stun level in 1000, or a 1 in 16 chance of scarring -which decreases charisma for a while. - -#####GParameters: ->v is the cut level. - ----------------------------------------------------------------------- - -#####RFunction: set_food - -#####GDeclaration: bool set_food(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->food", notice observable changes -* -* The "p_ptr->food" variable can get as large as 20000, allowing the -* addition of the most "filling" item, Elvish Waybread, which adds -* 7500 food units, without overflowing the 32767 maximum limit. -* -* Perhaps we should disturb the player with various messages, -* especially messages about hunger status changes. XXX XXX XXX -* -* Digestion of food is handled in "dungeon.c", in which, normally, -* the player digests about 20 food units per 100 game turns, more -* when "fast", more when "regenerating", less with "slow digestion", -* but when the player is "gorged", he digests 100 food units per 10 -* game turns, or a full 1000 food units per 100 game turns. -* -* Note that the player's speed is reduced by 10 units while gorged, -* so if the player eats a single food ration (5000 food units) when -* full (15000 food units), he will be gorged for (5000/100)*10 = 500 -* game turns, or 500/(100/5) = 25 player turns (if nothing else is -* affecting the player speed). -*/ - -#####GDescription: -Set hunger level "v". A value < 500 is fainting. A value < 1000 is -weak. A value < 2000 is weak. A value < 10000 is full. A value -< 15000 is bloated. A value < 20000 is gorged. If one of these -levels is crossed a message is printed. - -#####GParameters: ->v is the hunger level (must be between 0 and 20000). - ----------------------------------------------------------------------- - -#####RFunction: check_experience - -#####GDeclaration: void check_experience(void); - -#####GFile: xtra2.c - -#####GComment: -/* -* Advance experience levels and print experience -*/ - -#####GDescription: -Check if player experience level has changed. If a player has achieved -a level for the first time, give reward or corruption (1 chance in 3) -if they apply, and increase skill points. - ----------------------------------------------------------------------- - -#####RFunction: check_experience_obj - -#####GDeclaration: void check_experience_obj(object_type *o_ptr); - -#####GFile: xtra2.c - -#####GComment: -/* -* Advance experience levels and print experience -*/ - -#####GDescription: -Check if object "o_ptr" experience level has changed. If an object has -achieved a level for the first time, apply gains. - -#####GParameters: ->o_ptr is the pointer to the object gaining experience. - ----------------------------------------------------------------------- - -#####RFunction: gain_exp - -#####GDeclaration: void gain_exp(s32b amount); - -#####GFile: xtra2.c - -#####GComment: -/* -* Gain experience (share it to objects if needed) -*/ - -#####GDescription: -Gain "amount" of experience. Count the number of objects which will -gain experience. The objects share equally 2/3 of "amount". Give -corruption if it applies. Gain experience. If experience is less -than maximum, then increase maximum experience by 20% of "amount". -Check for level change and print experience (check_experience). - -#####GParameters: ->amount is the amount of experience to share. - ----------------------------------------------------------------------- - -#####RFunction: lose_exp - -#####GDeclaration: void lose_exp(s32b amount); - -#####GFile: xtra2.c - -#####GComment: -/* -* Lose experience -*/ - -#####GDescription: -Decrease experience by "amount". Experience can not fall below zero. -Check for level change and print experience (check_experience). - -#####GParameters: ->amount is the amount of experience to lose. - ----------------------------------------------------------------------- - - -Back to the *****lua.hlp*0[lua help index] . - - - [[[[[gThis file by Chris Hadgis] - - diff --git a/lib/help/lua_pow.txt b/lib/help/lua_pow.txt deleted file mode 100644 index c221a664..00000000 --- a/lib/help/lua_pow.txt +++ /dev/null @@ -1,266 +0,0 @@ -|||||oy -#####R /----------------------------------------\ -#####R < Adding new racial powers > -#####R \----------------------------------------/ - -#####R=== Introduction === - -You *must* download and install my lua example files from -[[[[[Ghttp://www.moppy.co.uk/angband.htm]. And also you should read the -*****lua_intr.txt*0[scripting introduction] file if you haven't already done -so. - -The (commented) accompanying script file for this tutorial is -lib\scpt\pheonix.lua. Open it in your text editor! - -#####R=== The Racial Power === - -Let's start with something simple. Let's say you wanted your new race (let's -call it "Pheonix") to be able to cast fire balls as their racial power. - -#####R=== Starting off === - -If you have a look at pheonix.lua you'll note the first lines are comments. -I'll talk a bit more about comments later, but it's worth pointing out that any -lines of text preceded by a double hyphen ([[[[[B--]) will be ignored by the -scripting engine, and are therefore comments. -After the comments, the first 10 lines of code are as follows: - -#####BPHEONIX_POWER = add_power -#####B{ -#####B ["name"] = "Fire Breath", -#####B ["desc"] = "You are able to cast fireballs", -#####B ["desc_get"] = "Your beak glows red", -#####B ["desc_lose"] = "Your beak goes cold again", -#####B ["level"] = 10, -#####B ["cost"] = 11, -#####B ["stat"] = A_INT, -#####B ["fail"] = 14, - -So, [[[[[BPHEONIX_POWER = add_power] is registering our power. We're giving it -a name (PHEONIX_POWER) and saying that it is defined by calling the special -function [[[[[Badd_power]. This special function is only used to define lua- -scripted -powers, and has attributes which are identified by their inclusion in square -brackets. -Note the following: -- Lua is case sensitive. The name of our power is a constant, will never change -so that's been named with capitals. variables and functions are named all in -lower case. Technically speaking, Lua does not support constants, but we can -emulate them by variables in this way. They don't have to be capitalised, but -if you capitalise all your constants, it makes things easier to read, and -you'll be following normal programming protocol. -- There are no spaces in the name of the power. Use an underscore for spaces -if you need to improve legibility. - -[[[[[B"name" = "Fire Breath",] This is the name of the power as it is -displayed in the -U menu, and as you will define it in p_info.txt (more about that later). - -[[[[[B"desc" = "You are able to cast fireballs",] This is what would -appear in the -information display list if you drank a potion of self knowledge or -similar. - -[[[[[B"desc_get" = "Your beak glows red",] This is the information displayed -when you -gain this power. - -[[[[[B"desc_lose" = "Your beak goes cold again",] This is the information -displayed when -you lose this power. Eg After a mutation/corruption. - -[[[[[B"level" = 10,] Character level which must be gained in order to use -power, - -[[[[[B"cost" = 11,] Amount of mana to cast this power. - -[[[[[B"stat" = A_INT,] stat which will define whether it works or not, - -[[[[[B"fail" = 14,] how high that stat must be. - -So our Pheonix will be able to cast PHEONIX_POWER from clvl 10, at a cost of -11 mana, providing that the player's intelligence is 14 and upwards. - -#####R=== The function === - -The next section is a lot longer, so we'll look at it line by line. I'll -strip the comments for the purpose of this helpfile. - -#####B["power"] = function() -#####B local ret, dir, damage -#####B ret, dir = get_aim_dir(); -#####B if (ret == FALSE) then -#####B return -#####B end -#####B damage = player.lev*3 -#####B msg_print("You breathe fire.") -#####B fire_ball(GF_FIRE, dir, damage, 3) -#####Bend, - -The [[[[[B"power"] bit is what actually happens when the player accesses this -power -from their 'U' menu. Every function must start with the word [[[[[Bfunction]. -Normally, we'd also declare its name at this point, but as this is contained -within the [[[[[Badd_power] function, we just use the word [[[[[Bfunction] The -empty -brackets after this denote that no arguments are passed to the function. -Lets look at the next line. - -#####B local ret, dir, damage - -The [[[[[Blocal] bit is saying that we're going to declare some local -variables. That -is, that there will be three variables used in this function , that apply -exclusively to this function, and to no others. Global variables are -variables that apply to the whole script, in multiple functions. The three -variables will be called [[[[[Bret] (return), [[[[[Bdir] (direction), and -[[[[[Bdamage]. They will be used to determine the direction the ball -will fire in, and how much damage it will do. We'll see them in use when we add -the third line: - -#####B ret, dir = get_aim_dir(); - -here we're saying that the variables will take their value from the result -of a function. The program performs the function [[[[[Bget_aim_dir] which -essentially asks the player to choose a direction or pick a target. -[[[[[Bget_aim_dir] -assigns the value [[[[[Bret] to either TRUE (if the player correctly selected a -direction) or FALSE (if the player failed to do so (maybe they changed their -mind, or hit the wrong key!)). The value [[[[[Bdir] is the direction which was -selected (or the path to the target if a target was selected). OK so let's add -the next line: - -#####B if (ret == FALSE) then return end - -This introduces another fundamental scripting concept - [[[[[Bif] statements. -They work just as you would expect them too. You say "if a certain condition is -met, then do the following things." -So in this function we're saying, "if the value of [[[[[Bret] is FALSE then -[[[[[Breturn]." -As I mentioned above, [[[[[Bret] is false if the player aborted (either -deliberately or accidentally) the spell casting whilst choosing a direction -for the spell. The double equals sign are used to mean "is equal to" as a -single equals sign is used for defining variables remember? A single equals -sign is more of a "let x be equal to y" thing. -[[[[[Breturn] means stop the current function. And [[[[[Bend] signifies the -close of the [[[[[Bif] -statement. Every [[[[[Bif] statement must begin with an [[[[[Bif] and finish -with an [[[[[Bend]. -So, what our [[[[[Bif] statement is saying is; "if the player failed to specify -a direction or target for the spell, stop the function here." -If the player has correctly specified a direction/target, the function -continues to the next line: - -#####B damage = player.lev*3 - -Here we're saying that the variable [[[[[Bdamage] has a value equal to the -players current character level, multiplied by 3. - -#####B msg_print("You breathe fire.") - -Fairly easy to see what this does - displays the message "You breathe fire." -I could have put anything there obviously, like [[[[[Bmsg_print("You open] -[[[[[Byour mouth and everyone falls over with the smell of hot curry")] or -some other such rubbish. But note that the message is enclosed within double -quotes. The quotes aren't displayed in the message on screen, but signify the -start and end of the message. - -#####B fire_ball(GF_FIRE, dir, damage, 3) - -This is the line that casts the spell. it says execute the function -[[[[[Bfire_ball]. Now, this doesn't mean a fireball, it means fire a ball. -There's an important distinction there! All it knows it is doing is firing a -ball, it doesn't know what kind of ball, or where, or how big, or how much -damage. -The [[[[[BGF_FIRE,] bit is what tell us it is a fire ball. If it was -[[[[[BGF_COLD,] - we'd have a cold ball, or [[[[[BGF_CHAOS,] it would be a chaos ball and -so on and so on. A full list of those types can be found in *****lua_gf.txt*0[lua_gf.txt]. -[[[[[B dir,] is the direction, from the [[[[[Bget_aim_dir()] bit. -[[[[[B damage,] is the damage. As we've already said, this will be clvl*3. -[[[[[B 3)] is the radius. -and finally... - -#####B end, -#####B} - -[[[[[Bend,] tells it the function has ended. Every function must finish with -[[[[[Bend]. -You should have spotted that after the end of each attribute is a comma. Make -sure you include this, and don't forget the braces at the very very end to -close the [[[[[Badd_power] function. - -#####R=== Finishing the LUA file === - -Save this as a text file 'pheonix.lua' Put it into the lib\scrpt directory -of ToME, and open the init.lua file which you'll find in the same -directory. - -Add the following line and resave the init.lua file. - -#####Btome_dofile("pheonix.lua") - -This ensures that ToME loads your file on start-up. Because you've installed -the example scripts, this has all been done for you. - -#####R=== A quick word about comments === - -One of the reasons Angband has so many variants is because the source code is -clearly commented. Almost every line of code has an accompanying comment, -explaining what that line does. It's good practice to add comments to any code -or script you write. It's helpful to others who are learning, anyone who takes -over your project, and also to yourself when you come back in a month's time -and can't remember what you did! So comment your code clearly, and well! - -You can also add multi line comments which should be enclosed by [[[[[B--[[] -and -#####B]] - -#####R=== Tying it all together === - -You'll now need to link this 'U' power to the pheonix race via the -p_info.txt file. Simply add a line within the class definition file that has -the format [[[[[BR:Z:]the name of the power as it appears in the -[[[[[B"name"] -section we did right at the beginning, remember? Seeing as there is no pheonix -race, I've gone ahead and made one up as a demonstration. If you've downloaded -and installed the example files from [[[[[Ghttp://www.moppy.co.uk/angband.htm/] -then -you'll notice you already have the pheonix race available. Printed below is -the p_info.txt entry for it. - - -#####BR:N:23:Pheonix -#####BR:D:Born from flame, these powerful bird like creatures gain fire related -#####BR:D:abilities as they grow. -#####BR:S:1:0:2:1:-3:2:-5 -#####BR:K:-8:15:20:-10:5:-1:-5:-5 -#####BR:P:8:130:5:210 -#####BR:M:255:70:2:1:20:5:2:1:18:3 -#####BR:E:1:1:1:2:1:1 -#####BR:C:Warrior | Mage | Priest | Rogue | Ranger | Paladin | Blade | -#####BR:C:Warlock | Chaos-Warrior | Monk | Mindcrafter | High-Mage | -#####BR:C:BeastMaster | Alchemist | Power-Mage | Runecrafter | -#####BR:C:Sorceror | Archer | Illusionist | Druid | Necromancer | Black-Knight -| -#####BR:C:Daemonologist | Weaponmaster | Summoner | -#####BR:Z:Fire Ball -#####BR:R:1:0 -#####BR:F:RES_FIRE | FEATHER | - -Note the [[[[[BR:Z:] line. - -If all is well, you should be able to start ToME now and breathe fire! Once -you get to lvl 10 anyhow. Don't forget, this is the kind of thing wizard mode -was invented for! Ctrl-A and confirm at the prompt, and then 'e' will allow -you to alter stats, including experience. Approx 1000 exp should do to get you -to clvl 10. - -Ready for more? How about adding a new *****lua_skil.txt*0[skill] ? - - [[[[[gThis file by fearoffours (fearoffours@moppy.co.uk)] - - - - diff --git a/lib/help/lua_ques.txt b/lib/help/lua_ques.txt deleted file mode 100644 index 1d4b9c65..00000000 --- a/lib/help/lua_ques.txt +++ /dev/null @@ -1,299 +0,0 @@ -|||||oy -#####R /----------------------------------------\ -#####R < Adding a new quest > -#####R \----------------------------------------/ - -#####R=== Introduction === - -Adding a quest involves a bit more work, and there is, in some ways, rather -more potential for things to go wrong! But it's a great way of showing just -WHAT can be done with lua scripting. It proves just how much a lua patch can -change the overall feel of the game. And it will give you a much better idea of -how lua interfaces with the game source. You should have read the -*****lua_intr.txt*0[scripting introduction], *****lua_pow.txt*0[racial power tutorial] -and *****lua_skil.txt*0[adding new skills tutorial] before going much -further. All of the above files contain some fairly fundamental information -which you will find necessary for full understanding of this file. - -The script we're looking at is going to create a quest entrance in the middle -of Bree. Entering the quest you see a little girl who has had her necklace -stolen. Your job is to travel down a corridor, killing some monsters on the -way, pick up the amulet and return it to the girl. Once done, she'll reveal the -stairs back to Bree, and give you a (randomly generated) ring. If you feel the -monsters are too hard, the only thing to do is talk to the little girl who will -reveal the stairs again, failing the quest for you, and also block off the -entrance to the amulet so that you can't cheat and make off with the amulet! - -#####R=== Getting started === - -Open amulet.lua (you have downloaded the example scripts from -[[[[[Ghttp://www.moppy.co.uk/angband.htm], haven't you?). The first thing you -should see is that yet again we're calling a function that takes its arguments -from a table, making it easy to read what's going on in the script. - -This time our function is add_quest and we have the following keys and values: - -#####B["global"] = "AMULET_QUEST", -#####B["name"] = "Hannahs lost amulet", -#####B["desc"] = { -#####B "Retrieve an amulet for Hannah Cooke. It's guarded!" -#####B }, -#####B["level"] = 5, -#####B["hooks"] = { - -[[[[[B"global" = ] is a constant that we set when we refer to this quest in -various places... -[[[[[B"name" = ] Obviously a long name for the quest. This will appear in the -quest screen (Ctrl-Q) and we may use in some map files too. -[[[[[B"desc" = ] This is a long description for the quest. Again this is what -will appear in the quest screen, and each line should be not more than 80 -characters. -[[[[[B"level" = ] This is a rough indicator of how hard the quest is, and again, -appears in the quest screen -[[[[[B"hooks" = ] This is the real 'meat' of the quest. Like the [[[[[B"spell_list"] key -in the [[[[[Badd_magic] function, this is another sub-table. - -To understand fully the structure of the "hooks" key it's worth taking a bit of -a detour at this point and discussing how the scripting interface works in -general. - -#####R=== How the scripts work (ish) === - -Essentially there's a list of events that happen in the game. As each of these -events happen they run a check to see if there's any functions that they need -to run at that event. When we ran the add_mkey part of adding a new skill -power, we essentially said "when the 'm' key is pressed in the game, perform -the [[[[[Bexecute_magic(constructor_powers)] function". Likewise we did a similar -thing with adding the racial power, only we hooked onto the pressing of the -'U' key. - -All of this was partly hidden because of the way that the [[[[[Badd_magic] and -[[[[[Badd_power] functions work. But here in the [[[[[Badd_quest] function it's a bit more -specific. We are going to specify what events we're going to hook onto, and -what functions we want to trigger at that event. - -A full list of hooks can be found in the source-file util.pkg. - -#####R=== The hooks === - -#####B[HOOK_BIRTH_OBJECTS] = function() -#####B quest(AMULET_QUEST).status = QUEST_STATUS_TAKEN -#####Bend, - -So here we are with our first hook. We've declared that we're adding it to the -birth of your character. That is, the function will be called when you create -your character. And what we're doing here is automatically declaring the quest -as being taken, like the Dol Guldur quest is. Each quest has 7 different -statuses: - -[[[[[BQUEST_STATUS_IGNORED -1 ] This is unused, but the quest is -ignored (will not be taken and has not been taken). -[[[[[BQUEST_STATUS_UNTAKEN 0 ] The quest has not been accepted yet -[[[[[BQUEST_STATUS_TAKEN 1 ] You have accepted the quest -[[[[[BQUEST_STATUS_COMPLETED 2 ] You have completed the quest -successfully but not been rewarded for it -[[[[[BQUEST_STATUS_REWARDED 3 ] You've completed and rewarded the quest -[[[[[BQUEST_STATUS_FAILED 4 ] You've failed the quest -[[[[[BQUEST_STATUS_FINISHED 5 ] The quest is completely finished -successfully. -[[[[[BQUEST_STATUS_FAILED_DONE 6 ] The quest is completely finished -unsuccessfully. - -You see that we've used the constant we defined in the "global" section is -passed as an argument to [[[[[Bquest.status]. - -Next hook then: - -#####B[HOOK_GEN_QUEST] = function() -#####B if (player.inside_quest ~= AMULET_QUEST) then -#####B return FALSE -#####B else -#####B load_map("amulet.map", 2, 2) -#####B return TRUE -#####B end -#####Bend, - -Ok, we're hooking onto the generation of the quest here. This is specifically -triggered in this instance by going down the quest entrance stairs in Bree. -Once you've gone down the stairs, you are technically inside the quest, which -means we can say if the person is not inside the amulet quest, then ignore this -function, otherwise load the file 'amulet.map' at co-ordinates x=2 y=2. You'll -find the amulet.map file in the edit directory, make sure you check it out. The -syntax for map files is fairly simple, though I might get round to writing a -tutorial on them some day! In the mean time holler for me at the usual email -address if you're unsure. - -#####B[HOOK_FEELING] = function() -#####B if (player.inside_quest ~= AMULET_QUEST) then -#####B return FALSE -#####B else -#####B cmsg_print(TERM_L_BLUE, "Hannah speaks to you:") -#####B cmsg_print(TERM_YELLOW, "'Some nasty monsters stole my -#####B favourite necklace.'") -#####B cmsg_print(TERM_YELLOW, "'It's hidden at the back of that -#####B corridor! Please fetch it for me'") -#####B return TRUE -#####B end -#####Bend, - -We're moving into some rather more obvious territory here, and getting into the -meat of the quest. The [[[[[BHOOK_FEELING] is triggered at the point when the level -feeling appears. It's important that this is run only if the player is inside -the amulet quest, as otherwise it will trigger EVERY time a level feeling -occurs, when you go down a level in the barrow-downs, whenever! Returning TRUE -will replace the level feeling with what's above, returning FALSE will still -perform the function but will amend the normal level feeling - so here if we'd -returned false we'd still get our custom messages, but they'd follow with -'looks like a typical quest level'. Of course returning false may cause you -other problems (see end of this file!) depending on what else you have in your -function. - -#####B[HOOK_GIVE] = function(m_idx, item) - -#####B m_ptr = monster(m_idx) -#####B o_ptr = get_object(item) - -#####B if (m_ptr.r_idx == test_monster_name("Hannah Cooke, a little girl")) -#####B and (o_ptr.tval == TV_AMULET) and (o_ptr.sval == 2) then - -#####B cmsg_print(TERM_YELLOW, "'Thank-you!'") - -#####B inven_item_increase(item, -1) -#####B inven_item_optimize(item) - -#####B quest(AMULET_QUEST).status = QUEST_STATUS_COMPLETED - -#####B cave_set_feat(7, 6, 6) - -#####B cmsg_print(TERM_YELLOW, "'Here, take this pretty ring I found -#####B as a token of gratitude!'") -#####B random_type = randint(57) -#####B reward = create_object(TV_RING, random_type) -#####B drop_near(reward, -1, py, px) -#####B quest(AMULET_QUEST).status = QUEST_STATUS_REWARDED -#####B return TRUE -#####B else -#####B return FALSE -#####B end -#####Bend, - -This is a fairly long function, but don't be intimidated. It's not really -difficult to understand. As you can see we're hooking into the giving of an -object to a monster (the 'y' key). Because of this, the function takes two -arguments - [[[[[Bm_idx] (the monster that you're giving to) and [[[[[Bitem] (the item that -you're giving). - -We then make it possible to work with the monster and item variables by -referencing them to two functions which identify them from the edit files: -[[[[[Bmonster()] and [[[[[Bget_object()]. This enables us to now say, 'if the name of the -monster is "Hannah Cooke, a little girl" and the type of item is an amulet and -that amulet is an amulet of adornment, then carry out the following commands'. - -We then say call the function [[[[[Binven_item_increase()] which places an object in -the inventory. It takes two arguments, the first being what object to put in -the inventory and the second being how many of that type of objects to put in -the inventory. You can see that by placing -1 as the second argument it fairly -obviously subtracts that item from the inventory. The [[[[[Binven_item_optimize()] -function checks that there are no empty inventory slots, and if there are, -erases them. - -The quest is then completed, and the stairs are revealed using the -[[[[[Bcave_set_feat()] function. This function takes three arguments, the first is the -x co-ordinate of the cave square you wish to change (counted from top left) the -second is the y co-ordinate, and the third is the index number of the feature -you wish the square to become as defined in f_info.txt. - -We then set about rewarding the player. As you can see we call [[[[[Bcreate_object()] -which takes two variables: the first is the type of object (these are all -listed in object.pkg) and the second is the sub-type of that object. I searched -k_info.txt to see how many different types of ring there were (57) and used a -randomly selected number with a maximum value of 57 as that specific sub-type. - -We then drop the object (although it's been created, it has only been created -in the game's memory, it's nowhere that the player can interact with it until -we drop it). The [[[[[Bdrop_near()] function takes 3 variables, the first being the -object that you wish to drop, the second being the chance that it disappears -(like an arrow, or mimicked creature) on drop. If you set it to -1, it won't -ever disappear. The last two are the co-ordinates at which the object will be -dropped. py and px are the global variables defined by where the player is -standing, so in this case it will drop under the player. You could do -[[[[[Binven_item_increase(reward, 1)] if you wanted, but I wanted to show a variety of -ways of handling objects. - -OK, let's take a look at the next hook: - -#####B[HOOK_CHAT] = function(m_idx) -#####B m_ptr = monster(m_idx) -#####B if (m_ptr.r_idx == test_monster_name("Hannah Cooke, a little girl")) then -#####B if (quest(AMULET_QUEST).status == QUEST_STATUS_REWARDED) then -#####B cmsg_print(TERM_YELLOW, "'Bye!'") -#####B else -#####B cmsg_print(TERM_YELLOW, "'Are the monsters too tough? -#####B Do you want to leave?'") -#####B if (get_check("Really leave and fail the quest?") == -#####B FALSE) -#####B then -#####B cmsg_print(TERM_YELLOW, "'Go and get my -#####B amulet then!'") -#####B else -#####B cmsg_print(TERM_YELLOW, "'Awww. Never -#####B mind. It was only a bit of rabbits foot'") -#####B quest(AMULET_QUEST).status = -#####B QUEST_STATUS_FAILED -#####B cave_set_feat(7, 6, 6) -#####B cave_set_feat(12, 5, 60) -#####B end -#####B end -#####B return TRUE -#####B end -#####B return FALSE -#####Bend, - -This only looks complicated because of the nested 'if' statements. It's easy to -lose your way when doing this kind of thing, always make sure you close all the -statements and put the returns in the right place. [[[[[BHOOK_CHAT] functions have one -argument - the monster you are chatting to. As you can see, we perform a check -to make sure it's the right monster and then away we go.... If the player wants -to leave the quest without completion they talk to Hannah, who gives them a -chance to change their mind! If the player asks to leave the entrance to the -corridor is blocked off (the second cave_set_feat()) so that the user can't -then go and get the amulet. Gumband or Zangband players may at this point think -they've lost out on the rabbits foot of burglary! (they haven't though as it -doesn't exist in ToME). - -#####B[HOOK_CHAR_DUMP] = function() -#####B if (quest(AMULET_QUEST).status == QUEST_STATUS_FAILED) then -#####B print_hook("\n You chickened out of rescuing a necklace and -#####B made a little girl sad. ") -#####B elseif (quest(AMULET_QUEST).status == QUEST_STATUS_COMPLETED) or -#####B (quest(AMULET_QUEST).status == QUEST_STATUS_REWARDED) or -#####B (quest(AMULET_QUEST).status == QUEST_STATUS_FINISHED) then -#####B print_hook("\n You rescued little Hannah Cooke's necklace from -#####B the nasty monsters ") -#####B end -#####B return FALSE -#####Bend, - -This quite simply and obviously prints an appropriate line in the character -dump based on the status of the quest. The [[[[[B\n] bit ensures the text goes on a -new line, so make sure you include it! Also you should return FALSE as -returning TRUE will stop executing all the other character dump lines (and you -may get other quests not having their lines printed). - -=== A word about returning TRUE and FALSE === - -As I mentioned above, you need to be careful what you return when dealing with -HOOKS as you can mess up the game a bit. Bear in mind that if you add a -function to [[[[[BHOOK_GEN_QUEST], every time a quest is generated, that function will -run. If you return TRUE, then no further functions attached to that hook will -run. If you return FALSE, it continues processing functions on that hook. - -That is pretty much it. Do take a look at the other included scripts that I -haven't gone into any detail about in the files, as you'll pick up some useful -techniques there too. Especially worthy of note is the hina.lua file which uses -hooks outside of the quest structure and also global variables and variables in -a table. If you have any questions, let me know at the email addy below. - -Back to the *****lua.hlp*0[lua help index] . - - [[[[[gThis file by fearoffours (fearoffours@moppy.co.uk)] diff --git a/lib/help/lua_skil.txt b/lib/help/lua_skil.txt deleted file mode 100644 index 87385e5d..00000000 --- a/lib/help/lua_skil.txt +++ /dev/null @@ -1,342 +0,0 @@ -|||||oy -#####R /----------------------------------------\ -#####R < Adding new skill-based powers > -#####R \----------------------------------------/ - -#####R=== Introduction === - -This is very much in the same vein as adding a racial/extra power, but has to -be tied into skills, and we're defining more than one spell at once. You should -have read the *****lua_intr.txt*0[scripting introduction] and -*****lua_pow.txt*0[racial power tutorial] before going much further. Both of the above files -contain some fairly fundamental information which you will find necessary for -full understanding of this file. - -#####R=== Getting started === - -Open construc.lua (you have downloaded the example scripts from -[[[[[Ghttp://www.moppy.co.uk/angband.htm], haven't you?). The idea behind this -script is that it adds a skill which affects you ability to build/knock down -stuff. It treats the equivalent of stone-to-mud and trap-door destruction -spells as if they were "building skills". It also adds quite a few high-level -'spells' which do funky things like carving out corridors and chambers in a -single turn, and building doors and stuff. Just think of it as if the person -who has plenty of skills in this area would be a builder-type with lots of -strength and constitution... - -In order to add these powers we're going to edit the s_info.txt file which -lives in the edit folder, and add a new skill, underneath the 'misc' tree, -called construction. The powers will then be accessed through the 'm' menu, in -a similar way to mindcraft or alchemy skills or such. (That is, no books are -needed to cast them, as we're treating them as a craft that has been learnt, -rather than spells.) Our fist line of the script file reads: - -#####BSKILL_CONSTRUCT = 57 - -This merely links the skill index that we'll be defining in s_info.txt to this -file. We'll come back to this at the end of the tutorial. - -#####Bconstructor_powers = add_magic - -In a similar way to the [[[[[Badd_power] function we called when we added the -Phoenix racial ability, this line calls a special function which we use to -define new skills. It follows a very specific, but easy to understand form. It -starts with a brace, which indicates the add_magic function will be storing -these values in a table. Don't worry about this too much, but understand that a -table starts and ends with braces [[[[[B{] and [[[[[B}] respectively. Each key -(or field name) takes the format [[[[[B"key" = value,] (the comma is -important!). - -#####B ["fail"] = function() -#####B msg_print("You decide now is a good time for a cuppa") -#####B end, -#####B ["stat"] = A_STR, -#####B ["get_level"] = function() -#####B return get_skill_scale(SKILL_CONSTRUCT, 50) -#####B end, -#####B ["spell_list"] = - -[[[[[B"fail"] is a function that is called whenever you ##fail to cast the -spells##. Here it does nothing spectacular. -[[[[[B"stat"] defines the stat used to cast the spells. Here it is strength. -Any other stat can be used, prefix it with [[[[[BA_]. -[[[[[B"get_level"] is used to determine the level of the spell. It's associated -with spells that increase in power the more points that are invested in the -associated skill. I know that's not terribly clear, I'll come back to it in a -moment. -[[[[[B"spell_list"] is just that, a list of all the spells. -Each of these four properties within the table must end with a comma. If a -function is defined in the property itself then we add the comma after the -closing [[[[[Bend]. Again compare with construct.lua to see it. Any line NOT -ending with a comma will cause a lua error on startup, probably of the type -[[[[[V'}' expected to close '{' at line .] - -#####R=== The spell list === - -Each spell, within the [[[[[B"spell_list"] key has its own set of properties -that we need to define from a sub-table so we open another set of braces to -start the spell list, and then a third set of braces to start the first spell. -So with all this, our first spell looks like: - -#####B ["spell_list"] = -#####B { -#####B { -#####B ["name"] = -#####B ["desc"] = -#####B ["mana"] = -#####B ["level"] = -#####B ["fail"] = -#####B ["spell"] = -#####B ["info"] = -#####B }, - -[[[[[B"name"] is, as you would expect, the name of the spell, as you want it to -appear in the spell list when choosing a spell. The maximum number of -characters for this is 29. -[[[[[B"desc"] is the description received when you hit the capital letter of -that spell in the menu. (i.e., press 'a' to cast the first spell, but press 'A' -to receive info about the first spell. -[[[[[B"mana"] is the amount of mana required to cast the spell. -[[[[[B"level"] is the level required to use that spell (that's level of the (in -this case construction) skill, not character level!). -[[[[[B"fail"] is base fail rate. -[[[[[B"spell"] is the function that is executed when the spell is cast. Note -that it MUST take the form [[[[[Bfunction() blah end] even if you're calling -a C function directly. If you have a look at the end of the file, you'll see -the "rebuild dungeon" spell which is identical to the "alter_reality" spell. -However, rather than reading [[[[[B"spell" = alter_reality()], it reads: - -#####B["spell"] = function() -#####B alter_reality() -#####Bend, - -which appears to be a long way round to do the same thing, but this is how it -must be done. - -In a similar way, the [[[[[B"info"] key must begin with a [[[[[Bfunction()] -and return the value of what is to be displayed alongside the spell name, -level and mana in the spell list. The maximum number of characters that can be -displayed here is dependent on the width of the user's screen, but try to keep -it under 12 if you can, as this will fit in a standard 80x24 terminal screen. -The first character will need to be a space otherwise you'll have the info line -squashed right up against the fail rate and it will look odd. If you wish to -have this part blank in the spell list, you still need to return a value, so -just a single space will do : [[[[[Breturn " "] - -All of these keys are repeated for each spell, with each spell in its own -table (therefore, it's own set of braces). Again, check the lua file for -clarification. - -When entering the spells in the "spell_list", you must take care to specify -them in the order which they are gained, otherwise they display incorrectly in -the spell list. - -You should by now be experienced enough to understand most of what's going on -in the actual spell functions (especially if you dig around in the source a -bit, and check out Chris Hadgis' excellent *****lua_spel.txt*0[spell.pkg] helper -files. I'm not going to go through the whole file line by line, as this is -something you should do yourself, figuring out what's going on. I'm going to -examine a few of the things we haven't covered before though, so pay attention. - -#####R=== The get_level() function === - -Probably one of the most important functions that you see reappearing in the -file is the [[[[[Bget_level()] function. All this does is return the numerical -value of the power that is given as the first argument. So [[[[[Bget_level] -[[[[[B(constructor_power)] will return the current level of the constructor power. -Given that the level of this is taken directly from the construction skill, (we -defined that in the [[[[[B"get_level"] key, by saying [[[[[Bget_skill_scale] -[[[[[B(SKILL_CONSTRUCT, 50)] ) it will return the value of your construction skill. -[[[[[Bconstructor_power] is the name of the whole power, we named it thus on -the second line of the script! - -[[[[[Bget_level] takes the following arguments: [[[[[Bget_level(power, max, ] -[[[[[Bmin)]. The power is obviously which power we're taking the value from, and the -max and min allow you to define boundaries for the spell. For instance the -current maximum value that [[[[[Bget_level(constructor_power)] can return is -50, as that is the maximum number of skill points you can have in that skill. -If you were using this as the basis for the damage of a low-level bolt spell, -you might decide that having a damage of 50 would be too much (unlikely, but -still possible). You could therefore define a maximum value of 20 so that when -the value of the construction skill was over 50, the maximum value for -damage of that spell would be 20. To achieve this you'd have: -[[[[[Bget_level(constructor_power, 20)]. In a similar way, you can force the -minimum value of the spell to be higher than the actual construction skill -level, with a [[[[[Bget_level(constructor_power, 50, 15)]. This would be useful -say for spells that you wanted to be available when the construction skill -level reaches 10, but for whom you wanted a (for example) base damage of 15 -right from the word go. These re-scale values rather than capping them! - -You can leave out the minimum value as I have done above. You can also leave -the maximum value out (it will default to 50). If you want to specify a minimum -value though, you MUST specify a maximum value as well. - -As you have hopefully been able to tell, the [[[[[Bget_level()] function -enables us to have spells that increase in usefulness as you gain levels. Let's -take the "Dismantle" spell. The function in the [[[[[B"spell"] key is as -follows: - -#####Bfunction() -#####B local ret, dir, dam - -#####B if (get_level(constructor_powers, 50) >= 11) then -#####B ret, dir = get_aim_dir(); -#####B if (ret == FALSE) then return end -#####B fire_beam(GF_KILL_TRAP, dir, 1) -#####B else -#####B fire_ball(GF_KILL_TRAP, 0, 1, 1) -#####B end -#####Bend, - -The [[[[[Bif] statement is obviously what really interests us here. You'll -notice that this has the amendment of an [[[[[Belse] clause, which the [[[[[Bif] -statement we used in the previous tutorial did not. As you would expect, if the -condition on the first line of this statement is met, then the instructions -immediately below it are carried out. If the condition is not met, then the -statements that follow the [[[[[Belse] are executed. - -Coming back to the [[[[[Bget_level] function, we learnt from above, that the -[[[[[Bget_level] part of this function translates as, "if the value of the -construction_power level (which happens to be identical to the construction -skill level) is greater than or equal to 11, cast a beam of trap disarming in -the specified direction. (The first part of this is all straightforward, -getting a direction, and cancelling correctly if the player presses 'ESC'.) -Otherwise, cast a ball of trap disarming with a radius of one, centred on the -player." - -In the same way, as you look at the construc.lua file, you will see that -[[[[[Bget_level()] is used many times in this way, to increase the power of -detection spells, to change bolt spells to ball spells, to keep a constantly -increasing damage going, and so on. - -#####R=== Elseif's and things === - -If you want to provide more than one alternative condition, in an -[[[[[Bif-then-else] statement, you can use [[[[[Belseif]s which do what you -might expect. Take a look at the first spell, "Survey area", for an example of -this: - -#####Bif (get_level(constructor_powers, 50) >= 28) then -#####B wiz_lite() -#####Belseif (get_level(constructor_powers, 50) >= 15) then -#####B map_area() -#####B detect_traps(DEFAULT_RADIUS) -#####Belseif (get_level(constructor_powers, 50) >= 5) then -#####B detect_traps(DEFAULT_RADIUS) -#####B detect_stairs(DEFAULT_RADIUS) -#####B detect_doors(DEFAULT_RADIUS) -#####Belse -#####B detect_stairs(DEFAULT_RADIUS) -#####B detect_doors(DEFAULT_RADIUS) -#####Bend - -If the level of constructor powers is greater or equal to 28, then the function -[[[[[Bwiz_lite()] is performed, and no other part of the if statement is -executed. [[[[[Bwiz_lite()] is just the enlightenment spell. If it is less than -28, the next condition is examined: that if the level of constructor powers is -greater than or equal to 15, then [[[[[Bmap_area()](Magic mapping) and detect -traps are called. If the level of constructor power is less than 15, it moves -onto the next condition, which says that if the level of constructor power is -greater than 5, then detect stairs, traps and doors. If none of these -conditions are met,(that is, if the level of construction skill is less than 5) -then we just detect doors and stairs. - -You'll note that each of the detection spells includes a DEFAULT_RADIUS -constant. You could change this to a numerical value, or a variable defined -somewhere else in your script. eg [[[[[Bdetect_traps(2)] would detect traps -with a radius of 2 centred on the player. - -#####R=== Registering the skill type === - -This is what we do at the end of the file, and is what ties the powers we've -defined to the action of pressing the 'm' key in game. Once more we're calling -a special function [[[[[Badd_mkey()] which takes its arguments for a table. -There are only two keys in this table though which keeps things simple. - -#####Badd_mkey -#####B{ -#####B ["mkey"] = MKEY_CONSTRUCT_POWERS, -#####B ["fct"] = function() -#####B execute_magic(constructor_powers) -#####B energy_use = energy_use + 100; -#####B end -#####B} - -[[[[[B"mkey"] must be a UNIQUE value > 1000 . Here I've defined it as a -constant, [[[[[BMKEY_CONSTRUCT_POWERS], which has the value 1004. This value -we'll call again in the s_info.txt file. -[[[[[B"fct"] is the function that's called when the user presses the key in the -'m' menu. So here, it calls the [[[[[Bexecute_magic] function which actually -displays a list of powers for the user to choose from. The argument it takes is -the powers it will use (alchemy, mindcraft, etc., or in this case constructor), -and then the [[[[[Benergy_use] line tells the game to take one game turn to do -the action. - -#####R=== Adding the skill in s_info.txt === - -Take a look in the s_info.txt file, under the Misc section. You'll see, - -#####BN:57:Construction -#####BD:Ability to use constructor powers -#####BD:Construction powers use strength -#####BA:1004:Build or knock down stuff -#####BI:1000 - -The first line is the index of the skill; again this must be unique. The second -property is the name of the skill. The [[[[[BD] lines are the lines displayed -when the skill is highlighted in the skill screen. -The first entry on the [[[[[BA] line is the value of the [[[[[B"mkey"] we -defined in the [[[[[Badd_mkey] function in our script. The second entry is the -display for selecting the construction power in the 'm' menu. -The [[[[[BI] line is currently unused, but add a 1000 there anyway. That's what -all the others have so when it's introduced, at least it will affect your -powers identically to how it affects all the other powers. - -If you scroll to the very bottom of the file now, you'll see I've placed the -skill at the bottom of the Misc branch of the skills tree. I then made a new -class, constructor, which you can see in p_info.txt. - -That is all that is NEEDED when writing a script to add a skill - defining an -mkey using add_mkey, and defining any powers that are called in the -[[[[[B"fct"] (generally using [[[[[Badd_magic] ). - -And I've added the line - -#####Btome_dofile("construc.lua") - -in init.lua so the script is loaded on start-up! - -Below I'm going to talk in depth about a few other functions that you may find -useful in your scripting. - -#####R=== fire_bolt() and fire_beam() === - -In the last help file we looked at the routine for firing a ball - -[[[[[Bfire_ball()]. Here's a quick note about beams and bolts... -[[[[[Bfire_beam()] and [[[[[Bfire_bolt()] take 2 arguments: -[[[[[B(type, direction, damage)]. So in the dismantle spell we have the -direction passed from [[[[[Bget_aim_dir()] (the function that asks the player -for a direction), the type of damage is [[[[[BGF_KILL_TRAP], which as you might -expect disarms traps. And the damage is only 1 because it's not going to hurt -monsters, just dismantle traps. - -#####R=== set_oppose_elec() === - -OK here's another thing. Wander on down to the sparky_skills spell. After the -appropriate bolt/ball is fired, we have the line: - -#####Bif player.oppose_elec == 0 then -#####B set_oppose_elec(randint(10) + 20 + get_level(constructor_powers, 20)*3) -#####Bend - -This is the bit that grants temporary resist electricity. We've called the -function [[[[[Bset_oppose_elec(turns)], which sets the player's resist -electricity to "on" for the time specified in the argument "turns". We're only -calling this if the player is not already granted temporary resist electricity, -and we've linked the number of turns it is active to the level of the -construction skill. I've limited the maximum value of get_level to 20 in this -instance. A similar idea can be used for temporarily granting levitation, -extended infravision, protection against evil, resist fire, stuns, cuts and so -on and so on. Have a look in player.pkg in the source for a full list.... - - [[[[[gThis file by fearoffours (fearoffours@moppy.co.uk)] diff --git a/lib/help/lua_spel.txt b/lib/help/lua_spel.txt deleted file mode 100644 index aa4a532b..00000000 --- a/lib/help/lua_spel.txt +++ /dev/null @@ -1,2150 +0,0 @@ -|||||oy - -#####R /----------------------------------------\ -#####R < spell.pkg functions helper file > -#####R \----------------------------------------/ - ----------------------------------------------------------------------- - -#####R=== teleport_player_directed === - -#####GDeclaration - extern void teleport_player_directed(int rad, int dir); - -#####GFile - spells1.c - -#####GComment -/* - * Teleport player, using a distance and a direction as a rough guide. - * - * This function is not at all obsessive about correctness. - * This function allows teleporting into vaults (!) - */ - -#####GDescription -Teleport a player up to "rad" grids away roughly in "dir" direction. - -#####GParameters -> "rad" must not exceed 200. The distance teleported is a minimum of a - quarter of "rad". -> "dir" must be from 0 to 9. - *****fields.txt*0[direction] - ----------------------------------------------------------------------- - -#####R=== teleport_away === - -#####GDeclaration - extern void teleport_away(int m_idx, int dis); - -#####GFile - spells1.c - -#####GComment -/* - * Teleport a monster, normally up to "dis" grids away. - * - * Attempt to move the monster at least "dis/2" grids away. - * - * But allow variation to prevent infinite loops. - */ - -#####GDescription -Teleport monster indicated by "m_idx" up to "dis" grids away. - -#####GParameters -> "m_idx" is the index of the monster in m_list[]. -> "dis" must not exceed 200. The distance teleported is a minimum of a - quarter of "dis". - ----------------------------------------------------------------------- - -#####R=== teleport_player === - -#####GDeclaration - extern void teleport_player(int dis); - -#####GFile - spells1.c - -#####GComment -/* - * Teleport the player to a location up to "dis" grids away. - * - * If no such spaces are readily available, the distance may increase. - * Try very hard to move the player at least a quarter that distance. - */ - -#####GDescription -Teleport player up to "dis" grids away. - -#####GParameters -> "dis" must not exceed 200. The distance teleported is a minimum of a - quarter of "dis". - ----------------------------------------------------------------------- - -#####R=== teleport_player_to === - -#####GDeclaration - extern void teleport_player_to(int ny, int nx); - -#####GFile - spells1.c - -#####GComment -/* - * Teleport player to a grid near the given location - * - * This function is slightly obsessive about correctness. - * This function allows teleporting into vaults (!) - */ - -#####GDescription -Teleport player to a grid near the given location ("ny", "nx"). If -the location is empty, the player goes there, otherwise they go to -a grid as close as possible to the location. - -#####GParameters -> "ny" is the y co-ordinate of the location. -> "nx" is the x co-ordinate of the location. - ----------------------------------------------------------------------- - -#####R=== teleport_monster_to === - -#####GDeclaration - extern void teleport_monster_to(int m_idx, int ny, - int nx); - -#####GFile - spells1.c - -#####GComment -/* - * Teleport a monster to a grid near the given location - * - * This function is slightly obsessive about correctness. - */ - -#####GDescription -Teleport monster indicated by "m_idx" to a grid near the given -location ("ny", "nx"). If the location is empty, the monster goes -there, otherwise they go to a grid as close as possible to the -location. - -#####GParameters -> "m_idx" is the index of the monster in m_list[]. -> "ny" is the y co-ordinate of the location. -> "nx" is the x co-ordinate of the location. - ----------------------------------------------------------------------- - -#####R=== teleport_player_level === - -#####GDeclaration - extern void teleport_player_level(void); - -#####GFile - spells1.c - -#####GComment -/* - * Teleport the player one level up or down (random when legal) - */ - -#####GDescription -Teleport the player one level up or down at random. - ----------------------------------------------------------------------- - -#####R=== recall_player === - -#####GDeclaration - extern void recall_player(void); - -#####GFile - spells1.c - -#####GComment -/* - * Recall the player to town or dungeon - */ - -#####GDescription -Recall the player to town (if in dungeon) or dungeon (if in town). - ----------------------------------------------------------------------- - -#####R=== take_hit === - -#####GDeclaration - extern void take_hit(int damage, cptr kb_str); - -#####GFile - spells1.c - -#####GComment -/* - * Decreases players hit points and sets death flag if necessary - * - * XXX XXX XXX Invulnerability needs to be changed into a "shield" - * - * XXX XXX XXX Hack -- this function allows the user to save (or quit) - * the game when he dies, since the "You die." message is shown before - * setting the player to "dead". - */ - -#####GDescription -Reduce the player's current hit points by "damage" points. If the -player dies, "kb_str" is used to record what the player was killed by -(see high-score table). - -#####GParameters -> "damage" is the amount of damage. -> "kb_str" is a string describing what killed the player. - ----------------------------------------------------------------------- - -#####R=== take_sanity_hit === - -#####GDeclaration - extern void take_sanity_hit(int damage, cptr hit_from); - -#####GFile - spells1.c - -#####GComment -/* Decrease player's sanity. This is a copy of the function above. */ - -#####GDescription -Reduce the player's current sanity points by "damage" points. If the -player dies, "hit_from" is used to record what the player was killed -by (see high-score table). - -#####GParameters -> "damage" is the amount of damage. -> "hit_from" is a string describing what killed the player. - ----------------------------------------------------------------------- - -#####R=== project === - -#####GDeclaration - extern bool project(int who, int rad, int y, int x, - int dam, int typ, int flg); - -#####GFile - spells1.c - -#####GComment -/* - * Generic "beam"/"bolt"/"ball" projection routine. - * - * Input: - * who: Index of "source" monster (negative for "player") - * jk -- -2 for traps, only used with project_jump - * rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball) - * y,x: Target location (or location to travel "towards") - * dam: Base damage roll to apply to affected monsters (or player) - * typ: Type of damage to apply to monsters (and objects) - * flg: Extra bit flags (see PROJECT_xxxx in "defines.h") - * - * Return: - * TRUE if any "effects" of the projection were observed, else FALSE - * - * Allows a monster (or player) to project a beam/bolt/ball of a given kind - * towards a given location (optionally passing over the heads of interposing - * monsters), and have it do a given amount of damage to the monsters (and - * optionally objects) within the given radius of the final location. - * - * A "bolt" travels from source to target and affects only the target grid. - * A "beam" travels from source to target, affecting all grids passed through. - * A "ball" travels from source to the target, exploding at the target, and - * affecting everything within the given radius of the target location. - * - * Traditionally, a "bolt" does not affect anything on the ground, and does - * not pass over the heads of interposing monsters, much like a traditional - * missile, and will "stop" abruptly at the "target" even if no monster is - * positioned there, while a "ball", on the other hand, passes over the heads - * of monsters between the source and target, and affects everything except - * the source monster which lies within the final radius, while a "beam" - * affects every monster between the source and target, except for the casting - * monster (or player), and rarely affects things on the ground. - * - * Two special flags allow us to use this function in special ways, the - * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while - * the "PROJECT_JUMP" flag allows us to affect a specific grid, without - * actually projecting from the source monster (or player). - * - * The player will only get "experience" for monsters killed by himself - * Unique monsters can only be destroyed by attacks from the player - * - * Only 256 grids can be affected per projection, limiting the effective - * "radius" of standard ball attacks to nine units (diameter nineteen). - * - * One can project in a given "direction" by combining PROJECT_THRU with small - * offsets to the initial location (see "line_spell()"), or by calculating - * "virtual targets" far away from the player. - * - * One can also use PROJECT_THRU to send a beam/bolt along an angled path, - * continuing until it actually hits something (useful for "stone to mud"). - * - * Bolts and Beams explode INSIDE walls, so that they can destroy doors. - * - * Balls must explode BEFORE hitting walls, or they would affect monsters - * on both sides of a wall. Some bug reports indicate that this is still - * happening in 2.7.8 for Windows, though it appears to be impossible. - * - * We "pre-calculate" the blast area only in part for efficiency. - * More importantly, this lets us do "explosions" from the "inside" out. - * This results in a more logical distribution of "blast" treasure. - * It also produces a better (in my opinion) animation of the explosion. - * It could be (but is not) used to have the treasure dropped by monsters - * in the middle of the explosion fall "outwards", and then be damaged by - * the blast as it spreads outwards towards the treasure drop location. - * - * Walls and doors are included in the blast area, so that they can be - * "burned" or "melted" in later versions. - * - * This algorithm is intended to maximise simplicity, not necessarily - * efficiency, since this function is not a bottleneck in the code. - * - * We apply the blast effect from ground zero outwards, in several passes, - * first affecting features, then objects, then monsters, then the player. - * This allows walls to be removed before checking the object or monster - * in the wall, and protects objects which are dropped by monsters killed - * in the blast, and allows the player to see all affects before he is - * killed or teleported away. The semantics of this method are open to - * various interpretations, but they seem to work well in practice. - * - * We process the blast area from ground-zero outwards to allow for better - * distribution of treasure dropped by monsters, and because it provides a - * pleasing visual effect at low cost. - * - * Note that the damage done by "ball" explosions decreases with distance. - * This decrease is rapid, grids at radius "dist" take "1/dist" damage. - * - * Notice the "napalm" effect of "beam" weapons. First they "project" to - * the target, and then the damage "flows" along this beam of destruction. - * The damage at every grid is the same as at the "centre" of a "ball" - * explosion, since the "beam" grids are treated as if they ARE at the - * centre of a "ball" explosion. - * - * Currently, specifying "beam" plus "ball" means that locations which are - * covered by the initial "beam", and also covered by the final "ball", except - * for the final grid (the epicentre of the ball), will be "hit twice", once - * by the initial beam, and once by the exploding ball. For the grid right - * next to the epicentre, this results in 150% damage being done. The centre - * does not have this problem, for the same reason the final grid in a "beam" - * plus "bolt" does not -- it is explicitly removed. Simply removing "beam" - * grids which are covered by the "ball" will NOT work, as then they will - * receive LESS damage than they should. Do not combine "beam" with "ball". - * - * The array "gy[],gx[]" with current size "grids" is used to hold the - * collected locations of all grids in the "blast area" plus "beam path". - * - * Note the rather complex usage of the "gm[]" array. First, gm[0] is always - * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the - * first blast grid (see above) with radius "N" from the blast centre. Note - * that only the first gm[1] grids in the blast area thus take full damage. - * Also, note that gm[rad+1] is always equal to "grids", which is the total - * number of blast grids. - * - * Note that once the projection is complete, (y2,x2) holds the final location - * of bolts/beams, and the "epicentre" of balls. - * - * Note also that "rad" specifies the "inclusive" radius of projection blast, - * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the - * implementation of the "distance" function. Also, a bolt can be properly - * viewed as a "ball" with a "rad" of "zero". - * - * Note that if no "target" is reached before the beam/bolt/ball travels the - * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This - * may be relevant even for bolts, since they have a "1x1" mini-blast. - * - * Note that for consistency, we "pretend" that the bolt actually takes "time" - * to move from point A to point B, even if the player cannot see part of the - * projection path. Note that in general, the player will *always* see part - * of the path, since it either starts at the player or ends on the player. - * - * Hack -- we assume that every "projection" is "self-illuminating". - * - * Hack -- when only a single monster is affected, we automatically track - * (and recall) that monster, unless "PROJECT_JUMP" is used. - * - * Note that all projections now "explode" at their final destination, even - * if they were being projected at a more distant destination. This means - * that "ball" spells will *always* explode. - * - * Note that we must call "handle_stuff()" after affecting terrain features - * in the blast radius, in case the "illumination" of the grid was changed, - * and "update_view()" and "update_monsters()" need to be called. - */ - -#####GDescription -Generate a beam/bolt/ball starting from "who" with a radius of "rad" -at target grid "y,x" for "damage" points of "typ" damage. The beam/ -bolt/ball can have various properties as denoted by "flg". - -#####GParameters -> "who" is > 0 (index of monster in m_list[]), < 0 and - not -100 or -101 (player), -100 or -101 (trap). -> "rad" is 0 for a beam/bolt and 1-9 for a ball. -> "y" is the y co-ordinate of the target grid. -> "x" is the x co-ordinate of the target grid. -> "dam" is the number of points of damage. -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "flg" is the projection effect - *****fields.txt*0[PROJECT_fields] - ----------------------------------------------------------------------- - -#####R=== corrupt_player === - -#####GDeclaration - extern void corrupt_player(void); - -#####GFile - spells1.c - -#####GComment -(none) - -#####GDescription -Swap two of the players stats at random. - ----------------------------------------------------------------------- - -#####R=== grow_trees === - -#####GDeclaration - extern void grow_trees(int rad); - -#####GFile - spells2.c - -#####GComment -/* - * Grow trees - */ - -#####GDescription -Grow up to (("rad" x "rad") + 11) trees around the player. - -#####GParameters -> "rad" is the radius of the area where trees may grow. - ----------------------------------------------------------------------- - -#####R=== hp_player === - -#####GDeclaration - extern bool hp_player(int num); - -#####GFile - spells2.c - -#####GComment -/* - * Increase players hit points, notice effects - */ - -#####GDescription -Add "num" points to the player's current hit points. The total can -not exceed the maximum. - -#####GParameters -> "num" is the number of points to add. - ----------------------------------------------------------------------- - -#####R=== heal_insanity === - -#####GDeclaration - extern bool heal_insanity(int val); - -#####GFile - spells2.c - -#####GComment -/* Heal insanity. */ - -#####GDescription -Add "val" points to the player's current sanity points. The total can -not exceed the maximum. - -#####GParameters -> "val" is the number of points to add. - ----------------------------------------------------------------------- - -#####R=== warding_glyph === - -#####GDeclaration - extern void warding_glyph(void); - -#####GFile - spells2.c - -#####GComment -/* - * Leave a "glyph of warding" which prevents monster movement - */ - -#####GDescription -Place a glyph at the player's location. The location must be bare. - ----------------------------------------------------------------------- - -#####R=== explosive_rune === - -#####GDeclaration - extern void explosive_rune(void); - -#####GFile - spells2.c - -#####GComment -(none) - -#####GDescription -Place a minor glyph (explosive rune) at the player's location. The -location must be bare. - ----------------------------------------------------------------------- - -#####R=== do_dec_stat === - -#####GDeclaration - extern bool do_dec_stat(int stat, int mode); - -#####GFile - spells2.c - -#####GComment -/* - * Lose a "point" - */ - -#####GDescription -Attempt to reduce the player's "stat" statistic by a point. - -#####GParameters -> "stat" is the statistic - *****fields.txt*0[A_fields] -> "mode" is the type of decrease: temporary, normal, or permanent - *****fields.txt*0[STAT_DEC_fields] - ----------------------------------------------------------------------- - -#####R=== do_res_stat === - -#####GDeclaration - extern bool do_res_stat(int stat); - -#####GFile - spells2.c - -#####GComment -/* - * Restore lost "points" in a stat - */ - -#####GDescription -Restore the player's "stat" statistic. - -#####GParameters -> "stat" is the statistic - *****fields.txt*0[A_fields] - ----------------------------------------------------------------------- - -#####R=== do_inc_stat === - -#####GDeclaration - extern bool do_inc_stat(int stat); - -#####GFile - spells2.c - -#####GComment -/* - * Gain a "point" in a stat - */ - -#####GDescription -Increase the player's "stat" statistic by a point. - -#####GParameters -> "stat" is the statistic - *****fields.txt*0[A_fields] - ----------------------------------------------------------------------- - -#####R=== identify_pack === - -#####GDeclaration - extern void identify_pack(void); - -#####GFile - spells2.c - -#####GComment -/* - * Identify everything being carried. - * Done by a potion of "self knowledge". - */ - -#####GDescription -Identify all items in the inventory. - ----------------------------------------------------------------------- - -#####R=== remove_curse === - -#####GDeclaration - extern bool remove_curse(void); - -#####GFile - spells2.c - -#####GComment -/* - * Remove most curses - */ - -#####GDescription -Remove all curses except for heavy curses. - ----------------------------------------------------------------------- - -#####R=== remove_all_curse === - -#####GDeclaration - extern bool remove_all_curse(void); - -#####GFile - spells2.c - -#####GComment -/* - * Remove all curses - */ - -#####GDescription -Remove all curses including heavy curses. - ----------------------------------------------------------------------- - -#####R=== restore_level === - -#####GDeclaration - extern bool restore_level(void); - -#####GFile - spells2.c - -#####GComment -/* - * Restores any drained experience - */ - -#####GDescription -Restore all drained experience points (if any). - ----------------------------------------------------------------------- - -#####R=== self_knowledge === - -#####GDeclaration - extern void self_knowledge(FILE *fff); - -#####GFile - spells2.c - -#####GComment -/* - * self-knowledge... idea from nethack. Useful for determining powers and - * resistances of items. It saves the screen, clears it, then starts listing - * attributes, a screenful at a time. (There are a LOT of attributes to - * list. It will probably take 2 or 3 screens for a powerful character whose - * using several artifacts...) -CFT - * - * It is now a lot more efficient. -BEN- - * - * See also "identify_fully()". - * - * XXX XXX XXX Use the "show_file()" method, perhaps. - */ - -#####GDescription -Show all attributes including racial powers, mutations, and equipment -effects. - -#####GParameters -> "*ffff" points to a file (write info to file) or is NULL (write info - to screen). - ----------------------------------------------------------------------- - -#####R=== lose_all_info === - -#####GDeclaration - extern bool lose_all_info(void); - -#####GFile - spells2.c - -#####GComment -/* - * Forget everything - */ - -#####GDescription -Forget about objects and the map. - ----------------------------------------------------------------------- - -#####R=== detect_traps === - -#####GDeclaration - extern bool detect_traps(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all traps on current panel - */ - -#####GDescription -Detect all traps on current panel. - ----------------------------------------------------------------------- - -#####R=== detect_doors === - -#####GDeclaration - extern bool detect_doors(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all doors on current panel - */ - -#####GDescription -Detect all doors on current panel. - ----------------------------------------------------------------------- - -#####R=== detect_stairs === - -#####GDeclaration - extern bool detect_stairs(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all stairs on current panel - */ - -#####GDescription -Detect all stairs on current panel. - ----------------------------------------------------------------------- - -#####R=== detect_treasure === - -#####GDeclaration - extern bool detect_treasure(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect any treasure on the current panel - */ - -#####GDescription -Detect any treasure on the current panel. - ----------------------------------------------------------------------- - -Field: hack_no_detect_message -Value: FALSE - ----------------------------------------------------------------------- - -#####R=== detect_objects_gold === - -#####GDeclaration - extern bool detect_objects_gold(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all "gold" objects on the current panel - */ - -#####GDescription -Detect all objects with the TV_GOLD flag. - ----------------------------------------------------------------------- - -#####R=== detect_objects_normal === - -#####GDeclaration - extern bool detect_objects_normal(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all "normal" objects on the current panel - */ - -#####GDescription -Detect all objects without the TV_GOLD flag. - ----------------------------------------------------------------------- - -#####R=== detect_objects_magic === - -#####GDeclaration - extern bool detect_objects_magic(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all "magic" objects on the current panel. - * - * This will light up all spaces with "magic" items, including artifacts, - * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings, - * and "enchanted" items of the "good" variety. - * - * It can probably be argued that this function is now too powerful. - */ - -#####GDescription -Detect all "magic" objects which are artefacts, ego items, or have one -of the following flags - TV_AMULET, TV_RING, TV_BATERIE, TV_STAFF, -TV_WAND, TV_ROD, TV_ROD_MAIN, TV_SCROLL, TV_POTION, TV_POTION2, -TV_VALARIN_BOOK, TV_MAGERY_BOOK, TV_SHADOW_BOOK, TV_CHAOS_BOOK, -TV_SPIRIT_BOOK, TV_NETHER_BOOK, TV_DAEMON_BOOK, TV_CRUSADE_BOOK, -TV_SIGALDRY_BOOK, TV_SYMBIOTIC_BOOK, TV_MUSIC_BOOK. - ----------------------------------------------------------------------- - -#####R=== detect_monsters_normal === - -#####GDeclaration - extern bool detect_monsters_normal(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all "normal" monsters on the current panel - */ - -#####GDescription -Detect all non-invisible monsters (without RF2_INVISIBLE). - ----------------------------------------------------------------------- - -#####R=== detect_monsters_invis === - -#####GDeclaration - extern bool detect_monsters_invis(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all "invisible" monsters on current panel - */ - -#####GDescription -Detect all invisible monsters (with RF2_INVISIBLE). - ----------------------------------------------------------------------- - -#####R=== detect_monsters_evil === - -#####GDeclaration - extern bool detect_monsters_evil(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all "evil" monsters on current panel - */ - -#####GDescription -Detect all evil monsters (with RF3_EVIL). - ----------------------------------------------------------------------- - -#####R=== detect_monsters_good === - -#####GDeclaration - extern bool detect_monsters_good(void); - -#####GFile - spells2.c - -#####GComment -/* Detect good monsters */ - -#####GDescription -Detect all good monsters (with RF3_GOOD). - ----------------------------------------------------------------------- - -#####R=== detect_monsters_xxx === - -#####GDeclaration - extern bool detect_monsters_xxx(u32b match_flag); - -#####GFile - spells2.c - -#####GComment -/* - * A "generic" detect monsters routine, tagged to flags3 - */ - -#####GDescription -Detect all monsters with "match_flag" flag. - -#####GParameters -> "match_flag" can be any RF3_ flag (see defines.h) but only - RF3_DEMON, RF3_UNDEAD, RF3_GOOD work. - ----------------------------------------------------------------------- - -#####R=== detect_monsters_string === - -#####GDeclaration - extern bool detect_monsters_string(cptr); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all (string) monsters on current panel - */ - -#####GDescription -Detect all monsters whose default monster character matches a -character pointed to by "cptr". - -#####GParameters -> "cptr" is a pointer to a single character, eg 'Z' for hounds. For - available characters, see the "symbol" field of the graphics (G) - line of r_info.txt. - ----------------------------------------------------------------------- - -#####R=== detect_monsters_nonliving === - -#####GDeclaration - extern bool detect_monsters_nonliving(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all "nonliving", "undead" or "demonic" monsters on current panel - */ - -#####GDescription -Detect all non-living monsters (with RF3_NONLIVING, RF3_UNDEAD, or -RF3_DEMON). - ----------------------------------------------------------------------- - -#####R=== detect_all === - -#####GDeclaration - extern bool detect_all(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect everything - */ - -#####GDescription -Detects traps, doors, stairs, treasure, gold objects, normal objects, -invisible monsters, normal (visible) monsters. - ----------------------------------------------------------------------- - -#####R=== stair_creation === - -#####GDeclaration - extern void stair_creation(void); - -#####GFile - spells2.c - -#####GComment -/* - * Create stairs at the player location - */ - -#####GDescription -Create stairs at the player location. This is not allowed if the grid -is not empty, the player is not in a dungeon, the player is on a -special level, the player is in an arena or quest. If the player is -in the town or wilderness the stairs will go down. If the player is -on a quest level or at the bottom of a dungeon, the stairs will go up. -Otherwise there is an even chance the stairs will go up or down. - ----------------------------------------------------------------------- - -#####R=== wall_stone === - -#####GDeclaration - extern bool wall_stone(void); - -#####GFile - spells2.c - -#####GComment -(none) - -#####GDescription -Create a stone wall on the player's grid. This function uses the -project() function to create the stone wall. Apparently zero can be -used as the "who" parameter for the player. See details for the -project() function elsewhere in this document. - ----------------------------------------------------------------------- - -#####R=== create_artifact === - -#####GDeclaration - extern bool create_artifact(object_type *o_ptr, - bool a_scroll, bool get_name); - -#####GFile - randart.c - -#####GComment -(none) - -#####GDescription -Create an artifact from object "*optr". - -#####GParameters -> "*optr* is a pointer to an object -> "a_scroll" is true if the artifact is created by reading a scroll -> "get_name" is true if the artifact is to be named by the player (if - a_scroll is true) or created randomly (a_scroll is false), or false - if an inscription is used. - ----------------------------------------------------------------------- - -#####R=== ident_spell === - -#####GDeclaration - extern bool ident_spell(void); - -#####GFile - spells2.c - -#####GComment -/* - * Identify an object in the inventory (or on the floor) - * This routine does *not* automatically combine objects. - * Returns TRUE if something was identified, else FALSE. - */ - -#####GDescription -Identify an object in the inventory (or on the floor). - ----------------------------------------------------------------------- - -#####R=== identify_fully === - -#####GDeclaration - extern bool identify_fully(void); - -#####GFile - spells2.c - -#####GComment -/* - * Fully "identify" an object in the inventory -BEN- - * This routine returns TRUE if an item was identified. - */ - -#####GDescription -Fully "identify" an object in the inventory (or on the floor). - ----------------------------------------------------------------------- - -#####R=== recharge === - -#####GDeclaration - extern bool recharge(int num); - -#####GFile - spells2.c - -#####GComment -/* - * Recharge a wand/staff/rod from the pack or on the floor. - * This function has been rewritten in Oangband. -LM- - * - * Mage -- Recharge I --> recharge(90) - * Mage -- Recharge II --> recharge(150) - * Mage -- Recharge III --> recharge(220) - * - * Priest or Necromancer -- Recharge --> recharge(140) - * - * Scroll of recharging --> recharge(130) - * Scroll of *recharging* --> recharge(200) - * - * It is harder to recharge high level, and highly charged wands, - * staffs, and rods. The more wands in a stack, the more easily and - * strongly they recharge. Staffs, however, each get fewer charges if - * stacked. - * - * XXX XXX XXX Beware of "sliding index errors". - */ - -#####GDescription -Recharge an object in the inventory (or on the floor) with "num" -power. - -#####GParameters -> "num" is the power used in recharging. It is compared to the - object's level to determine whether the item is recharged - successfully or destroyed. If it is recharged, it also determines - how many charges are added, or how much recharge time is reduced. - ----------------------------------------------------------------------- - -#####R=== aggravate_monsters === - -#####GDeclaration - extern void aggravate_monsters(int who); - -#####GFile - spells2.c - -#####GComment -/* - * Wake up all monsters, and speed up "los" monsters. - */ - -#####GDescription -Aggravate monsters, originating from "who". - -#####GParameters -> "who" is the index of monster in m_list[] (1 if it is the player) - which triggers the aggravation; - ----------------------------------------------------------------------- - -#####R=== genocide === - -#####GDeclaration - extern bool genocide(bool player_cast); - -#####GFile - spells2.c - -#####GComment -(none) - -#####GDescription -Genocide a monster race. - -#####GParameters -> "player_cast" is true if the player cast the spell so the player can - take damage. - ----------------------------------------------------------------------- - -#####R=== mass_genocide === - -#####GDeclaration - extern bool mass_genocide(bool player_cast); - -#####GFile - spells2.c - -#####GComment -/* - * Delete all nearby (non-unique) monsters - */ - -#####GDescription -Delete all nearby (non-unique) monsters. - -#####GParameters -> "player_cast" is true if the player cast the spell so the player can - take damage. - ----------------------------------------------------------------------- - -#####R=== probing === - -#####GDeclaration - extern bool probing(void); - -#####GFile - spells2.c - -#####GComment -/* - * Probe nearby monsters - */ - -#####GDescription -Probe all nearby monsters. - ----------------------------------------------------------------------- - -#####R=== banish_evil === - -#####GDeclaration - extern bool banish_evil(int dist); - -#####GFile - spells2.c - -#####GComment -/* - * Banish evil monsters - */ - -#####GDescription -Banish nearby evil monsters doing "dist" points of GF_AWAY_EVIL -damage. - -#####GParameters -> "dist" is the amount of damage done to each monster. - ----------------------------------------------------------------------- - -#####R=== dispel_evil === - -#####GDeclaration - extern bool dispel_evil(int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Dispel evil monsters - */ - -#####GDescription -Dispel nearby evil monsters doing "dam" points of GF_DISP_EVIL -damage. - -#####GParameters -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== dispel_good === - -#####GDeclaration - extern bool dispel_good(int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Dispel good monsters - */ - -#####GDescription -Dispel nearby good monsters doing "dam" points of GF_DISP_GOOD -damage. - -#####GParameters -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== dispel_undead === - -#####GDeclaration - extern bool dispel_undead(int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Dispel undead monsters - */ - -#####GDescription -Dispel nearby undead monsters doing "dam" points of GF_DISP_UNDEAD -damage. - -#####GParameters -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== dispel_monsters === - -#####GDeclaration - extern bool dispel_monsters(int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Dispel all monsters - */ - -#####GDescription -Dispel all nearby monsters doing "dam" points of GF_DISP_ALL -damage. - -#####GParameters -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== dispel_living === - -#####GDeclaration - extern bool dispel_living(int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Dispel 'living' monsters - */ - -#####GDescription -Dispel nearby living monsters doing "dam" points of GF_DISP_LIVING -damage. - -#####GParameters -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== dispel_demons === - -#####GDeclaration - extern bool dispel_demons(int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Dispel demons - */ - -#####GDescription -Dispel nearby demon monsters doing "dam" points of GF_DISP_DEMON -damage. - -#####GParameters -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== turn_undead === - -#####GDeclaration - extern bool turn_undead(void); - -#####GFile - spells2.c - -#####GComment -/* - * Turn undead - */ - -#####GDescription -Turn nearby undead monsters doing a point of GF_TURN_UNDEAD damage for -each player level. - ----------------------------------------------------------------------- - -#####R=== wipe === - -#####GDeclaration - extern void wipe(int y1, int x1, int r); - -#####GFile - spells2.c - -#####GComment -/* - * Wipe -- Empties a part of the dungeon - */ - -#####GDescription -Delete monsters and objects from an area of the dungeon centred at -grid "y1,x1" for a radius "r". This does not work on special levels or -quests. The player may be blinded. The player forgets the affected -area and it becomes dark. All grids become floor. - -#####GParameters -> "y1" is the y-coordinate of the wipe's origin. -> "x1" is the x-coordinate of the wipe's origin. -> "r" is the radius of the wipe. - ----------------------------------------------------------------------- - -#####R=== destroy_area === - -#####GDeclaration - extern void destroy_area(int y1, int x1, int r, - bool full); - -#####GFile - spells2.c - -#####GComment -/* - * The spell of destruction - * - * This spell "deletes" monsters (instead of "killing" them). - * - * Later we may use one function for both "destruction" and - * "earthquake" by using the "full" to select "destruction". - */ - -#####GDescription -Delete monsters and objects from an area of the dungeon centred at -grid "y1,x1" for a radius "r". This does not work on special levels or -quests. The epicentre is NOT affected. The player may be blinded. The -player forgets the affected area and it becomes dark. The grids can -become granite, quartz, magma, or floor. - -#####GParameters -> "y1" is the y-coordinate of the destruction's origin. -> "x1" is the x-coordinate of the destruction's origin. -> "r" is the radius of the destruction. -> "full" is currently unused. - ----------------------------------------------------------------------- - -#####R=== earthquake === - -#####GDeclaration - extern void earthquake(int cy, int cx, int r); - -#####GFile - spells2.c - -#####GComment -/* - * Induce an "earthquake" of the given radius at the given location. - * - * This will turn some walls into floors and some floors into walls. - * - * The player will take damage and "jump" into a safe grid if possible, - * otherwise, he will "tunnel" through the rubble instantaneously. - * - * Monsters will take damage, and "jump" into a safe grid if possible, - * otherwise they will be "buried" in the rubble, disappearing from - * the level in the same way that they do when genocided. - * - * Note that thus the player and monsters (except eaters of walls and - * passers through walls) will never occupy the same grid as a wall. - * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even - * for a single turn, unless that monster can pass_walls or kill_walls. - * This has allowed massive simplification of the "monster" code. - */ - -#####GDescription -Create an earthquake centred on grid "cy,cx" with a radius of "r". -This does not work on quest levels. The epicentre is NOT affected. -Only about 15% of the grids are affected. The player takes 300 points -of damage if they can't be moved to a safe grid, otherwise damage is -from 10 to 40 points. The player forgets the affected area and it -becomes dark. The grids can become granite, quartz, magma, or floor. - -#####GParameters -Parameters: -> "cy" is the y-coordinate of the earthquake origin. -> "cx" is the x-coordinate of the earthquake origin. -> "r" is the radius of the earthquake. - ----------------------------------------------------------------------- - -#####R=== map_area === - -#####GDeclaration - extern void map_area(void); - -#####GFile - cave.c - -#####GComment -/* - * Hack -- map the current panel (plus some) ala "magic mapping" - */ - -#####GDescription -Map the current panel plus up to 10 grids up and down, and up to 20 -grids left and right. - ----------------------------------------------------------------------- - -#####R=== wiz_lite === - -#####GDeclaration - extern void wiz_lite(void); - -#####GFile - cave.c - -#####GComment -/* - * Light up the dungeon using "clairvoyance" - * - * This function "illuminates" every grid in the dungeon, memorises all - * "objects", memorises all grids as with magic mapping, and, under the - * standard option settings (view_perma_grids but not view_torch_grids) - * memorises all floor grids too. - * - * Note that if "view_perma_grids" is not set, we do not memorise floor - * grids, since this would defeat the purpose of "view_perma_grids", not - * that anyone seems to play without this option. - * - * Note that if "view_torch_grids" is set, we do not memorise floor grids, - * since this would prevent the use of "view_torch_grids" as a method to - * keep track of what grids have been observed directly. - */ - -#####GDescription -Light up the entire dungeon and show all monsters and objects. - ----------------------------------------------------------------------- - -#####R=== wiz_lite_extra === - -#####GDeclaration - extern void wiz_lite_extra(void); - -#####GFile - cave.c - -#####GComment -(none) - -#####GDescription -Light up the entire dungeon and show all monsters and objects. All -squares are lit and remembered. - ----------------------------------------------------------------------- - -#####R=== wiz_dark === - -#####GDeclaration - extern void wiz_dark(void); - -#####GFile - cave.c - -#####GComment -/* - * Forget the dungeon map (ala "Thinking of Maud..."). - */ - -#####GDescription -Forget all grids and objects. All grids become dark. - ----------------------------------------------------------------------- - -#####R=== lite_room === - -#####GDeclaration - extern void lite_room(int y1, int x1); - -#####GFile - spells2.c - -#####GComment -/* - * Illuminate any room containing the given location. - */ - -#####GDescription -Light up the room (if any) of grid "y1,x1". - -#####GParameters -> "y1" is the y-coordinate of the grid. -> "x1" is the x-coordinate of the grid. - ----------------------------------------------------------------------- - -#####R=== unlite_room === - -#####GDeclaration - extern void unlite_room(int y1, int x1); - -#####GFile - spells2.c - -#####GComment -/* - * Darken all rooms containing the given location - */ - -#####GDescription -Darken all rooms (if any) of grid "y1,x1". - -#####GParameters -> "y1" is the y-coordinate of the grid. -> "x1" is the x-coordinate of the grid. - ----------------------------------------------------------------------- - -#####R=== lite_area === - -#####GDeclaration - extern bool lite_area(int dam, int rad); - -#####GFile - spells2.c - -#####GComment -/* - * Hack -- call light around the player - * Affect all monsters in the projection radius - */ - -#####GDescription -Light up the room (if any) of the player's grid. Monsters take "dam" -points of GF_LITE_WEAK damage if they are within "r" grids of the -player. - -#####GParameters -> "dam" is the number of points of damage. -> "rad" is the radius of the effect of the damage. - ----------------------------------------------------------------------- - -#####R=== unlite_area === - -#####GDeclaration - extern bool unlite_area(int dam, int rad); - -#####GFile - spells2.c - -#####GComment -/* - * Hack -- call darkness around the player - * Affect all monsters in the projection radius - */ - -#####GDescription -Darken the room (if any) of the player's grid. Monsters take "dam" -points of GF_DARK_WEAK damage if they are within "r" grids of the -player. - -#####GParameters -> "dam" is the number of points of damage. -> "rad" is the radius of the effect of the damage. - ----------------------------------------------------------------------- - -#####R=== fire_ball_beam === - -#####GDeclaration - extern bool fire_ball_beam(int typ, int dir, int dam, - int rad); - -#####GFile - spells2.c - -#####GComment -/* - * Cast a ball-beamed spell - * Stop if we hit a monster, act as a "ball" - * Allow "target" mode to pass over monsters - * Affect grids, objects, and monsters - */ - -#####GDescription -Cast a ball-beamed spell of type "typ" in direction "dir" for damage -"dam" points with a radius of "rad" grids. - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9. - *****fields.txt*0[direction] -> "dam" is the number of points of damage. -> "rad" is the radius of the effect of the damage (must be <= 16). - ----------------------------------------------------------------------- - -#####R=== fire_ball === - -#####GDeclaration - extern bool fire_ball(int typ, int dir, int dam, int rad); - -#####GFile - spells2.c - -#####GComment -/* - * Cast a ball spell - * Stop if we hit a monster, act as a "ball" - * Allow "target" mode to pass over monsters - * Affect grids, objects, and monsters - */ - -#####GDescription -Cast a ball spell of type "typ" in direction "dir" for "dam" points of -damage. The ball has a radius of "rad" grids. - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9. - *****fields.txt*0[direction] -> "dam" is the number of points of damage. -> "rad" is the radius of the effect of the damage (must be <= 16). - ----------------------------------------------------------------------- - -#####R=== fire_bolt === - -#####GDeclaration - extern bool fire_bolt(int typ, int dir, int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Cast a bolt spell - * Stop if we hit a monster, as a "bolt" - * Affect monsters (not grids or objects) - */ - -#####GDescription -Cast a bolt spell of type "typ" in direction "dir" for "dam" points of -damage. - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9 - *****fields.txt*0[direction] -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== fire_beam === - -#####GDeclaration - extern bool fire_beam(int typ, int dir, int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Cast a beam spell - * Pass through monsters, as a "beam" - * Affect monsters (not grids or objects) - */ - -#####GDescription -Cast a beam spell of type "typ" in direction "dir" for "dam" points of -damage. - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9. - *****fields.txt*0[direction] -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== fire_druid_ball === - -#####GDeclaration - extern bool fire_druid_ball(int typ, int dir, int dam, - int rad); - -#####GFile - spells2.c - -#####GComment -/* - * Cast a druidic ball spell - * Stop if we hit a monster, act as a "ball" - * Allow "target" mode to pass over monsters - * Affect grids, objects, and monsters - */ - -#####GDescription -Cast a ball spell of type "typ" in direction "dir" for "dam" points of -damage. The ball has a radius of "rad" grids. The spell follows a mana -path. - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9. - *****fields.txt*0[direction] -> "dam" is the number of points of damage. -> "rad" is the radius of the effect of the damage (must be <= 16). - ----------------------------------------------------------------------- - -#####R=== fire_druid_bolt === - -#####GDeclaration - extern bool fire_druid_bolt(int typ, int dir, int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Cast a druidic bolt spell - * Stop if we hit a monster, as a "bolt" - * Affect monsters (not grids or objects) - */ - -#####GDescription -Cast a bolt spell of type "typ" in direction "dir" for "dam" points of -damage. The spell follows a mana path. - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9. - *****fields.txt*0[direction] -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== fire_druid_beam === - -#####GDeclaration - extern bool fire_druid_beam(int typ, int dir, int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Cast a druidistic beam spell - * Pass through monsters, as a "beam" - * Affect monsters (not grids or objects) - */ - -#####GDescription -Cast a beam spell of type "typ" in direction "dir" for "dam" points of -damage. The spell follows a mana path. - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9. - *****fields.txt*0[direction] -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== fire_bolt_or_beam === - -#####GDeclaration - extern bool fire_bolt_or_beam(int prob, int typ, int dir, - int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Cast a bolt spell, or rarely, a beam spell - */ - -#####GDescription -Cast a beam (chance of "prob" in 100) or bolt spell of type "typ" in -direction "dir" for "dam" points of damage. - -#####GParameters -> "prob" is the number of times out of 100 that the bolt will actually - be a beam. Obviously this value should range from 1 to 99 (0 will - always give a beam, 100 or higher will always give a beam. There are - separate functions for these cases). -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9. - *****fields.txt*0[direction] -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== alchemy === - -#####GDeclaration - extern bool alchemy(void); - -#####GFile - spells2.c - -#####GComment -/* Turns an object into gold, gain some of its value in a shop */ - -#####GDescription -The player selects an object (and quantity if it applies) from the -inventory or the floor and attempts to turn it into gold. If the -price of the item is < 0 then the player gains nothing (fool's gold), -otherwise the player gets a third of the price in gold. Artifacts are -not affected. - ----------------------------------------------------------------------- - -#####R=== alter_reality === - -#####GDeclaration - extern void alter_reality(void); - -#####GFile - spells2.c - -#####GComment -(none) - -#####GDescription -The player leaves the level immediately. - ----------------------------------------------------------------------- - -#####R=== teleport_swap === - -#####GDeclaration - extern void teleport_swap(int dir); - -#####GFile - spells2.c - -#####GComment -(none) - -#####GDescription -Player swaps places with target in direction "dir". The target must be -a monster. It will not work if the space-time continuum can not be -disrupted or if the monster resists teleportation. - ----------------------------------------------------------------------- - -#####R=== project_meteor === - -#####GDeclaration - extern void project_meteor(int radius, int typ, int dam, - u32b flg); - -#####GFile - spells2.c - -#####GComment -/* - * Apply a "project()" a la meteor shower - */ - -#####GDescription -Generate between "rad" and "rad" x 2 ball spells of type "typ" for -"dam" points of damage. The ball can have various properties as -denoted by "flg". - -#####GParameters -> "rad" is the minimum number of balls created. "rad" + randint("rad") - balls are created. Each ball has a radius of 2 grids. Each target - grid is within 5 grids of the player. -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dam" is the number of points of damage. -> "flg" is the projection effect - *****fields.txt*0[PROJECT_fields] - ----------------------------------------------------------------------- - -#####R=== passwall === - -#####GDeclaration - extern bool passwall(int dir, bool safe); - -#####GFile - spells2.c - -#####GComment -/* - * Send the player shooting through walls in the given direction until - * they reach a non-wall space, or a monster, or a permanent wall. - */ - -#####GDescription -Move the player through walls in direction "dir". if "safe" then the -player can not end up in a wall - if they do, the wall is replaced by -a floor. This does not work in the wilderness, on quest levels, or if -teleport is not allowed. Stopping on monsters or inside vaults is not -allowed. - -#####GParameters -> "dir" must be from 0 to 9. It can not be 5. - *****fields.txt*0[direction] -> "safe" must be true if the player is not to be trapped in a wall - when the movement is finished. - ----------------------------------------------------------------------- - -#####R=== project_hook === - -#####GDeclaration - extern bool project_hook(int typ, int dir, int dam, - int flg); - -#####GFile - spells2.c - -#####GComment -/* - * Hack -- apply a "projection()" in a direction (or at the target) - */ - -#####GDescription -Generate a beam/bolt of type "typ" in direction "dir" (or at a target) -for "dam" points of damage. The beam/bolt can have various properties -as denoted by "flg". - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9. 5 means use the current target. - *****fields.txt*0[direction] -> "dam" is the number of points of damage. -> "flg" is the projection effect - *****fields.txt*0[PROJECT_fields] - ----------------------------------------------------------------------- - -#####R=== reset_recall === - -#####GDeclaration - extern bool reset_recall(void); - -#####GFile - spells2.c - -#####GComment -(none) - -#####GDescription -Ask the player for a dungeon and appropriate level within the dungeon. -The player can not specify a dungeon they have not gone to yet. If the -player chooses levels 99 or 100, the level is set to 98. - ----------------------------------------------------------------------- - -#####R=== get_aim_dir === - -#####GDeclaration - extern bool get_aim_dir(int *dp = 0); - -#####GFile - xtra2.c - -#####GComment -/* - * Get an "aiming direction" from the user. - * - * The "dir" is loaded with 1,2,3,4,6,7,8,9 for "actual direction", and - * "0" for "current target", and "-1" for "entry aborted". - * - * Note that "Force Target", if set, will pre-empt user interaction, - * if there is a usable target already set. - * - * Note that confusion over-rides any (explicit?) user choice. - */ - -#####GDescription -Get an aiming direction from the user and store it in "dp". A target -can be selected. If the player is confused, the direction will be -random. - -#####GParameters -> "dp" = player direction. - ----------------------------------------------------------------------- - -#####R=== project_hack === - -#####GDeclaration - extern bool project_hack(int typ, int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Apply a "project()" directly to all viewable monsters - * - * Note that affected monsters are NOT auto-tracked by this usage. - */ - -#####GDescription -Generate beam/bolt spells of type "typ" for "dam" points of damage to -all viewable monsters in line of site. - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - - -Back to the *****lua.hlp*0[lua help index] . - - [[[[[gThis file by Chris Hadgis] diff --git a/lib/help/lua_util.txt b/lib/help/lua_util.txt deleted file mode 100644 index 8886a2b4..00000000 --- a/lib/help/lua_util.txt +++ /dev/null @@ -1,898 +0,0 @@ -|||||oy - -#####R /----------------------------------------\ -#####R < util.pkg functions helper file > -#####R \----------------------------------------/ - ----------------------------------------------------------------------- - -#####R=== bst === - -#####GDeclaration - s32b bst(s32b what, s32b t); - -#####GFile - util.c - -#####GComment -/* - * Break scalar time - */ - -#####GDescription -Return the minute, hour, day, or year for turn "t". One turn takes 7.5 -seconds. - -#####GParameters -> "what" is the unit to be returned and must be one of - MINUTE (number of turns per minute, which is 8) - HOUR (number of turns per hour, which is 480) - DAY (number of turns per day, which is 11,520) - YEAR (number of turns per year, which is 4,204,800) -> "t" is the number of turns. - ----------------------------------------------------------------------- - -#####R=== path_build === - -#####GDeclaration - errr path_build(char *buf, int max, cptr path, cptr file); - -#####GFile - util.c - -#####GComment -/* -* Create a new path by appending a file (or directory) to a path -* -* This requires no special processing on simple machines, except -* for verifying the size of the filename, but note the ability to -* bypass the given "path" with certain special file-names. -* -* Note that the "file" may actually be a "sub-path", including -* a path and a file. -* -* Note that this function yields a path which must be "parsed" -* using the "parse" function above. -*/ - -#####GDescription -Append file "file" to path "path" and return the result in "buf". The -length of "buf" is a maximum of "max" characters. If "file" starts -with '~' then return "file". If "file" starts with the path separator -and the path separator is not blank then return "file". If there is no -path then return "file". Otherwise return "path" + path separator + -"file". The path separator is defined in "H-config.h". - -#####GParameters -> "buf" contains the new path. -> "max" is the maximum number of characters allowed in "buf". -> "path" is the original path. -> "file" is the original file. - ----------------------------------------------------------------------- - -#####R=== move_cursor === - -#####GDeclaration - void move_cursor(int row, int col); - -#####GFile - util.c - -#####GComment -/* -* Move the cursor -*/ - -#####GDescription -Move the cursor to row "row" and column "col". - -#####GParameters -> "row" is the row the cursor is to be moved to. -> "col" is the column the cursor is to be moved to. - ----------------------------------------------------------------------- - -#####R=== inkey === - -#####GDeclaration - char inkey(void); - -#####GFile - util.c - -#####GComment -/* -* Get a keypress from the user. -* -* This function recognises a few "global parameters". These are variables -* which, if set to TRUE before calling this function, will have an effect -* on this function, and which are always reset to FALSE by this function -* before this function returns. Thus they function just like normal -* parameters, except that most calls to this function can ignore them. -* -* If "inkey_xtra" is TRUE, then all pending keypresses will be flushed, -* and any macro processing in progress will be aborted. This flag is -* set by the "flush()" function, which does not actually flush anything -* itself, but rather, triggers delayed input flushing via "inkey_xtra". -* -* If "inkey_scan" is TRUE, then we will immediately return "zero" if no -* keypress is available, instead of waiting for a keypress. -* -* If "inkey_base" is TRUE, then all macro processing will be bypassed. -* If "inkey_base" and "inkey_scan" are both TRUE, then this function will -* not return immediately, but will wait for a keypress for as long as the -* normal macro matching code would, allowing the direct entry of macro -* triggers. The "inkey_base" flag is extremely dangerous! -* -* If "inkey_flag" is TRUE, then we will assume that we are waiting for a -* normal command, and we will only show the cursor if "hilite_player" is -* TRUE (or if the player is in a store), instead of always showing the -* cursor. The various "main-xxx.c" files should avoid saving the game -* in response to a "menu item" request unless "inkey_flag" is TRUE, to -* prevent savefile corruption. -* -* If we are waiting for a keypress, and no keypress is ready, then we will -* refresh (once) the window which was active when this function was called. -* -* Note that "back-quote" is automatically converted into "escape" for -* convenience on machines with no "escape" key. This is done after the -* macro matching, so the user can still make a macro for "backquote". -* -* Note the special handling of "ascii 30" (ctrl-caret, aka ctrl-shift-six) -* and "ascii 31" (ctrl-underscore, aka ctrl-shift-minus), which are used to -* provide support for simple keyboard "macros". These keys are so strange -* that their loss as normal keys will probably be noticed by nobody. The -* "ascii 30" key is used to indicate the "end" of a macro action, which -* allows recursive macros to be avoided. The "ascii 31" key is used by -* some of the "main-xxx.c" files to introduce macro trigger sequences. -* -* Hack -- we use "ascii 29" (ctrl-right-bracket) as a special "magic" key, -* which can be used to give a variety of "sub-commands" which can be used -* any time. These sub-commands could include commands to take a picture of -* the current screen, to start/stop recording a macro action, etc. -* -* If "angband_term[0]" is not active, we will make it active during this -* function, so that the various "main-xxx.c" files can assume that input -* is only requested (via "Term_inkey()") when "angband_term[0]" is active. -* -* Mega-Hack -- This function is used as the entry point for clearing the -* "signal_count" variable, and of the "character_saved" variable. -* -* Hack -- Note the use of "inkey_next" to allow "keymaps" to be processed. -* -* Mega-Hack -- Note the use of "inkey_hack" to allow the "Borg" to steal -* control of the keyboard from the user. -*/ - -#####GDescription -Get a keypress from the user. - ----------------------------------------------------------------------- - -#####R=== cmsg_print === - -#####GDeclaration - void cmsg_print(byte color, cptr msg); - -#####GFile - util.c - -#####GComment -/* -* Output a message to the top line of the screen. -* -* Break long messages into multiple pieces (40-72 chars). -* -* Allow multiple short messages to "share" the top line. -* -* Prompt the user to make sure he has a chance to read them. -* -* These messages are memorised for later reference (see above). -* -* We could do "Term_fresh()" to provide "flicker" if needed. -* -* The global "msg_flag" variable can be cleared to tell us to -* "erase" any "pending" messages still on the screen. -* -* XXX XXX XXX Note that we must be very careful about using the -* "msg_print()" functions without explicitly calling the special -* "msg_print(NULL)" function, since this may result in the loss -* of information if the screen is cleared, or if anything is -* displayed on the top line. -* -* XXX XXX XXX Note that "msg_print(NULL)" will clear the top line -* even if no messages are pending. This is probably a hack. -*/ - -#####GDescription -In color "color", output message "msg" to the top line of the screen. -If the message is blank or has more than 1000 characters, nothing is -printed. Long messages are split after the 40th character and before -the 72nd character. - -#####GParameters -> "color" is the color of the message. - *****fields.txt*0[colors] -> "msg" is the message. - ----------------------------------------------------------------------- - -#####R=== msg_print === - -#####GDeclaration - void msg_print(cptr msg); - -#####GFile - util.c - -#####GComment -/* Hack -- for compatibility and easy sake */ - -#####GDescription -Print message "msg" in white (see cmsg_print() above). - -#####GParameters -> "msg" is the message. - ----------------------------------------------------------------------- - -#####R=== screen_save === - -#####GDeclaration - void screen_save(void); - -#####GFile - util.c - -#####GComment -/* - * Save the screen, and increase the "icky" depth. - * - * This function must match exactly one call to "screen_load()". - */ - -#####GDescription -Save a screen shot. - ----------------------------------------------------------------------- - -#####R=== screen_load === - -#####GDeclaration - void screen_load(void); - -#####GFile - util.c - -#####GComment -/* - * Load the screen, and decrease the "icky" depth. - * - * This function must match exactly one call to "screen_save()". - */ - -#####GDescription -Load a previously saved screen shot. - ----------------------------------------------------------------------- - -#####R=== c_put_str === - -#####GDeclaration - void c_put_str(byte attr, cptr str, int row, int col); - -#####GFile - util.c - -#####GComment -/* -* Display a string on the screen using an attribute. -* -* At the given location, using the given attribute, if allowed, -* add the given string. Do not clear the line. -*/ - -#####GDescription -Put string "str" at row "row" and column "col" with attribute "attr". - -#####GParameters -> "attr" is the color of the message. - *****fields.txt*0[colors] -> "msg" is the message. -> "row" is the row the message is to be printed at. -> "col" is the column the message is to be printed at. - ----------------------------------------------------------------------- - -#####R=== c_prt === - -#####GDeclaration - void c_prt(byte attr, cptr str, int row, int col); - -#####GFile - util.c - -#####GComment -/* -* Display a string on the screen using an attribute, and clear -* to the end of the line. -*/ - -#####GDescription -Clear row "row" from column "col". Put string "str" at "row", "col" -with attribute "attr". - -#####GParameters -> "attr" is the color of the message. - *****fields.txt*0[colors] -> "msg" is the message. -> "row" is the row the message is to be printed at. -> "col" is the column the message is to be printed at. - ----------------------------------------------------------------------- - -#####R=== clear_from === - -#####GDeclaration - void clear_from(int row); - -#####GFile - util.c - -#####GComment -/* -* Clear part of the screen -*/ - -#####GDescription -Clear the screen from row "row" onwards. - -#####GParameters -> "row" is the first row of the screen to be cleared. - ----------------------------------------------------------------------- - -#####R=== askfor_aux === - -#####GDeclaration - bool askfor_aux(char *buf, int len); - -#####GFile - util.c - -#####GComment -/* -* Get some input at the cursor location. -* Assume the buffer is initialized to a default string. -* Note that this string is often "empty" (see below). -* The default buffer is displayed in yellow until cleared. -* Pressing RETURN right away accepts the default entry. -* Normal chars clear the default and append the char. -* Backspace clears the default or deletes the final char. -* ESCAPE clears the buffer and the window and returns FALSE. -* RETURN accepts the current buffer contents and returns TRUE. -*/ - -#####GDescription -Get string "buf" from the screen. "buf" is to be no more than "len" -bytes. The string starts at the current cursor position. The length -can not exceed the number of bytes from the cursor to the end of the -line. Accept user input until the escape or return key is pressed. - -#####GParameters -> "buf" is the string returned from the screen. -> "len" is the length of the string. If it is <1 it is forced to 1. - ----------------------------------------------------------------------- - -#####R=== get_string === - -#####GDeclaration - bool get_string(cptr prompt, char *buf, int len); - -#####GFile - util.c - -#####GComment -/* -* Get a string from the user -* -* The "prompt" should take the form "Prompt: " -* -* Note that the initial contents of the string is used as -* the default response, so be sure to "clear" it if needed. -* -* We clear the input, and return FALSE, on "ESCAPE". -*/ - -#####GDescription -Print prompt "prompt" at the top-left corner of the screen and return -response "buf" which will have a maximum length "length". If ESCAPE -is entered, the function returns FALSE, otherwise it returns TRUE. - -#####GParameters -> "prompt" is the prompt for input. -> "buf" is the returned response. -> "len" is the maximum length of the string. - ----------------------------------------------------------------------- - -#####R=== get_check === - -#####GDeclaration - bool get_check(cptr prompt); - -#####GFile - util.c - -#####GComment -/* -* Verify something with the user -* -* The "prompt" should take the form "Query? " -* -* Note that "[y/n]" is appended to the prompt. -*/ - -#####GDescription -Ask the user question "prompt" which requires a yes/no answer. The -prompt appears in the top-left corner of the screen. A response of -'Y' (either case) returns TRUE. A response of 'N' (either case) or -ESCAPE returns FALSE. - -#####GParameters -> "prompt" is the question asked. It has a maximum length of 70 - characters. - ----------------------------------------------------------------------- - -#####R=== get_com_lua === - -#####GDeclaration - bool get_com_lua @ get_com(cptr promtp, int *com); - -#####GFile - util.c - -#####GComment -/* -* Prompts for a keypress -* -* The "prompt" should take the form "Command: " -* -* Returns TRUE unless the character is "Escape" -*/ - -#####GDescription -Ask the user for command "prompt" and return the key press "com". A -response of ESCAPE returns FALSE. All other responses return TRUE. - -#####GParameters -> "prompt" is the prompt for the key press. -> "com" is the returned key press. - ----------------------------------------------------------------------- - -#####R=== get_quantity === - -#####GDeclaration - s32b get_quantity(cptr prompt, s32b max); - -#####GFile - util.c - -#####GComment -/* -* Request a "quantity" from the user -* -* Hack -- allow "command_arg" to specify a quantity -*/ - -#####GDescription -Ask the user for quantity "prompt" of maximum value "max" and return -a quantity. If the user quantity is higher than the maximum then the -maximum is returned. If the response is a letter then the maximum is -returned. If the user quantity is negative then zero is returned. - -#####GParameters -> "prompt" is the prompt for a quantity. -> "max" is the maximum value allowed. - ----------------------------------------------------------------------- - -#####R=== test_monster_name === - -#####GDeclaration - int test_monster_name(cptr name); - -#####GFile - util.c - -#####GComment -/* - * Given monster name as string, return the index in r_info array. Name - * must exactly match (look out for commas and the like!), or else 0 is - * returned. Case doesn't matter. -GSN- - */ - -#####GDescription -Return the monster index for monster with name "name". If no match is -found then zero is returned. - -#####GParameters -> "name" is the monster name. - ----------------------------------------------------------------------- - -#####R=== test_item_name === - -#####GDeclaration - int test_item_name(cptr name); - -#####GFile - util.c - -#####GComment -/* - * Given item name as string, return the index in k_info array. Name - * must exactly match (look out for commas and the like!), or else 0 is - * returned. Case doesn't matter. -DG- - */ - -#####GDescription -Return the item index for item with name "name". If no match is found -then zero is returned. - -#####GParameters -> "name" is the item name. - ----------------------------------------------------------------------- - -#####R=== luck === - -#####GDeclaration - int luck(int min, int max); - -#####GFile - xtra1.c - -#####GComment -/* - * Return a luck number between a certain range - */ - -#####GDescription -Return a number for luck between minimum "min" and maximum "max". The -value begins with the player's current luck. The value is forced to -be between -30 and +30. 30 is added to give a value between 0 and 60. -The value is multiplied by the range (maximum - minimum) and divided -by 60. The value is increased by the minimum. The value is returned. - -For example, if the player's current luck is 15, the minimum is -10, -and the maximum is 10 (range 20), then the value returned is -(45 * 20) / 60 which is 900 / 60 which is 15 + the minimum -10 gives -a returned value of 5. - -#####GParameters -> "min" is the minimum luck. -> "max" is the maximum luck. Beware: this should be greater than the - minimum but it is not checked! - ----------------------------------------------------------------------- - -#####R=== get_player_race_name === - -#####GDeclaration - cptr get_player_race_name(int pr, int ps); - -#####GFile - util.c - -#####GComment -(none) - -#####GDescription -Return the name for player race "pr" and player sub-race "ps". - -#####GParameters -> "pr" is the index for player race. -> "ps" is the index for player sub-race. - ----------------------------------------------------------------------- - -#####R=== quit === - -#####GDeclaration - void quit(cptr str); - -#####GFile - z-util.c - -#####GComment -/* - * Exit (ala "exit()"). If 'str' is NULL, do "exit(0)". - * If 'str' begins with "+" or "-", do "exit(atoi(str))". - * Otherwise, plog() 'str' and exit with an error code of -1. - * But always use 'quit_aux', if set, before anything else. - */ - -#####GDescription -Quit the game. If "str" is a string then write the string to the -error file or screen. If "str" is a number then exit with the -number as the exit code. - -#####GParameters -> "str" is an error message or exit code. - ----------------------------------------------------------------------- - -#####R=== dump_hooks === - -#####GDeclaration - void dump_hooks(); - -#####GFile - plots.c - -#####GComment -(none) - -#####GDescription -Print the name and type (C or Lua) of hooks in the hook list. - ----------------------------------------------------------------------- - -#####R=== add_hook_script === - -#####GDeclaration - void add_hook_script(int h_idx, char *script, cptr name); - -#####GFile - plots.c - -#####GComment -(none) - -#####GDescription -To hook list with index "h_idx", add a script with script file -"script" and name "name" as a Lua hook if a hook with that name -does not already exist. - -#####GParameters -> "h_idx" is the index of the hook list in the array of hook lists. -> "script" is the name of the script file. -> "name" is the name of the hook to be added. - ----------------------------------------------------------------------- - -#####R=== del_hook_name === - -#####GDeclaration - void del_hook_name(int h_idx, cptr name); - -#####GFile - plots.c - -#####GComment -(none) - -#####GDescription -Search hook list with index "h_idx" and remove the hook with name -"name". - -#####GParameters -> "h_idx" is the index of the hook list in the array of hook lists. -> "name" is the name of the hook to be removed. - ----------------------------------------------------------------------- - -#####R=== pern_dofile === - -#####GDeclaration - bool pern_dofile(char *file); - -#####GFile - script.c - -#####GComment -(none) - -#####GDescription -Parse the Lua script file "file". - -#####GParameters -> "file" is the Lua script file to be parsed. - ----------------------------------------------------------------------- - -#####R=== intMod === - -#####GDeclaration - s32b intMod(s32b a, s32b b); - -#####GFile - script.c - -#####GComment -(none) - -#####GDescription -Return the result of operation "a" mod "b" (a % b). - -#####GParameters -> "a" is a number. -> "b" is a number. - ----------------------------------------------------------------------- - -#####R=== intAnd === - -#####GDeclaration - s32b intAnd(s32b a, s32b b); - -#####GFile - script.c - -#####GComment -(none) - -#####GDescription -Return the result of bitwise operation "a" AND "b" (a & b). - -#####GParameters -> "a" is a number. -> "b" is a number. - ----------------------------------------------------------------------- - -#####R=== intOr === - -#####GDeclaration - s32b intOr(s32b a, s32b b); - -#####GFile - script.c - -#####GComment -(none) - -#####GDescription -Return the result of bitwise operation "a" OR "b" (a | b). - -#####GParameters -> "a" is a number. -> "b" is a number. - ----------------------------------------------------------------------- - -#####R=== intXor === - -#####GDeclaration - s32b intXor(s32b a, s32b b); - -#####GFile - script.c - -#####GComment -(none) - -#####GDescription -Return the result of bitwise operation "a" XOR "b" (a ^ b). - -#####GParameters -> "a" is a number. -> "b" is a number. - ----------------------------------------------------------------------- - -#####R=== intShiftl === - -#####GDeclaration - s32b intShiftl(s32b a, s32b b); - -#####GFile - script.c - -#####GComment -(none) - -#####GDescription -Return the result of bitwise operation "a" << "b". - -#####GParameters -> "a" is a number. -> "b" is a number. - ----------------------------------------------------------------------- - -#####R=== intShiftr === - -#####GDeclaration - s32b intShiftr(s32b a, s32b b); - -#####GFile - script.c - -#####GComment -(none) - -#####GDescription -Return the result of bitwise operation "a" >> "b". - -#####GParameters -> "a" is a number. -> "b" is a number. - ----------------------------------------------------------------------- - -#####R=== intBitNot === - -#####GDeclaration - s32b intBitNot(s32b b); - -#####GFile - script.c - -#####GComment -(none) - -#####GDescription -Return the result of bitwise operation NOT "b" (~ b). - -#####GParameters -> "b" is a number. - ----------------------------------------------------------------------- - -#####R=== register_savefile === - -#####GDeclaration - void register_savefile(int num); - -#####GFile - loadsave.c - -#####GComment -/* - * Add num slots to the savefile - */ - -#####GDescription -Add "num" slots to the save file. - -#####GParameters -> "num" is the number of slots to add to the savefile. If num is <0 - then "num" is forced to zero. - ----------------------------------------------------------------------- - -#####R=== save_number_key === - -#####GDeclaration - void save_number_key(char *key, s32b val); - -#####GFile - util.c - -#####GComment -(none) - -#####GDescription -Save the length of key "key", the key itself, and the value "val" as -bytes in the savefile. - -#####GParameters -> "key" is the key string for the value. -> "val" is the value to be saved. - ----------------------------------------------------------------------- - - - -Back to the *****lua.hlp*0[lua help index] . - - - [[[[[gThis file by Chris Hadgis] - diff --git a/lib/mods/theme/help/advanced.hlp b/lib/mods/theme/help/advanced.hlp index 3f6fe4bd..8595712b 100644 --- a/lib/mods/theme/help/advanced.hlp +++ b/lib/mods/theme/help/advanced.hlp @@ -7,9 +7,8 @@ Please choose one of the following help files: *****/aoption.txt*0[(a) Options] *****/bmacrofaq.txt*0[(b) Macros] *****/cautomat.txt*0[(c) Automatizer help] - (d) Lua scripting help - coming soon - *****/edebug.txt*0[(e) Debug commands] - *****/fversion.txt*0[(f) Version information] A history of ToME's roots + *****/ddebug.txt*0[(d) Debug commands] + *****/eversion.txt*0[(e) Version information] A history of ToME's roots *****/zhelp.hlp*0[(z) Main Help menu] diff --git a/lib/mods/theme/help/lua.hlp b/lib/mods/theme/help/lua.hlp deleted file mode 100644 index ba61676a..00000000 --- a/lib/mods/theme/help/lua.hlp +++ /dev/null @@ -1,34 +0,0 @@ -|||||oy -~~~~~01|Help|Lua scripting for ToME -#####R Welcome to the ToME Lua Help System. -#####R============================================= - -Please choose one of the following help files: - - *****/alua_intr.txt*0[(a) An Introduction to scripting] - *****/blua_pow.txt*0[(b) Adding a racial power (the 'U' menu)] - *****/clua_skil.txt*0[(c) Adding new skills (the 'm' menu)] - *****/dlua_ques.txt*0[(d) Adding a quest] - - - *****/elua_mon.txt*0[(e) Useful functions in monster.pkg] - *****/flua_play.txt*0[(f) Useful functions in player.pkg] - *****/glua_spel.txt*0[(g) Useful functions in spell.pkg] - *****/hlua_util.txt*0[(h) Useful functions in util.pkg] - - *****/ilua_gf.txt*0[(g) A list of GF_FOO flags] - - - *****/zhelp.hlp*0[(z) Main Help menu] - - - - - - - - - - - - diff --git a/lib/mods/theme/help/lua_gf.txt b/lib/mods/theme/help/lua_gf.txt deleted file mode 100644 index 000f4af5..00000000 --- a/lib/mods/theme/help/lua_gf.txt +++ /dev/null @@ -1,45 +0,0 @@ -|||||oy -#####R /--------------------------\ -#####R< A partial list of GF_FLAGS > -#####R \--------------------------/ - -GF_ARROW: arrows -GF_MISSILE: magic missiles -GF_MANA: mana -GF_LITE_WEAK: light -GF_DARK_WEAK: dark -GF_WATER: water -GF_PLASMA: plasma -GF_METEOR: meteors -GF_ICE: ice -GF_GRAVITY: gravity -GF_INERTIA: inertia -GF_FORCE: force -GF_TIME: pure time -GF_ACID: acid -GF_ELEC: lightning -GF_FIRE: flames -GF_COLD: cold -GF_POIS: poison -GF_LITE: pure light -GF_DARK: pure dark -GF_CONFUSION: confusion -GF_SOUND: sound -GF_SHARDS: shards -GF_NEXUS: nexus -GF_NETHER: nether -GF_CHAOS: chaos -GF_DISENCHANT: disenchantment -GF_KILL_WALL: wall destruction -GF_KILL_DOOR: door destruction -GF_KILL_TRAP: trap destruction -GF_STONE_WALL: wall creation -GF_MAKE_DOOR: door creation -GF_MAKE_TRAP: trap creation -GF_DESTRUCTION: destruction - -Back to the *****lua.hlp*0[lua help index] . - - [[[[[gThis file by fearoffours (fearoffours@moppy.co.uk)] - - diff --git a/lib/mods/theme/help/lua_intr.txt b/lib/mods/theme/help/lua_intr.txt deleted file mode 100644 index ccb87067..00000000 --- a/lib/mods/theme/help/lua_intr.txt +++ /dev/null @@ -1,133 +0,0 @@ -|||||oy -#####R /----------------------------------------\ -#####R < Scripting for ToME with lua > -#####R \----------------------------------------/ - -So, you want to patch ToME eh? Maybe you've had a look at how the edit files -work, maybe even added your own race/class, but want to go further and add -new racial (U) or magic (m) powers. Well these help files will show a little -bit of how to do that. - -I am not a master at this kind of thing. I wrote a small script, with much -help from DarkGod, and he subsequently asked me to write these help files. I -was looking forward to when the lua help files came out so that I could look -at them myself. Little did I know I'd be asked to write them. Therefore I -apologise for any inaccuracies or errors that you find, and if you care to let -me know of any improvements which could be made (especially if you're an -experienced programmer/scripter), I'd love to know. Email me at -[[[[[gfearoffours@moppy.co.uk]. - -#####R=== The example scripts === - -These help files take the form of a tutorial, adding a line at a time to a -script, and explaining important concepts along the way. To see it all in -action, I strongly suggest that you download my example script pack from -[[[[[Ghttp://www.moppy.co.uk/angband.htm]. As well as including all the -scripts covered in these help files, they also include the addition of my -"hina" race which has a Lua scripted racial power which you might like to look -at. There's also a quest which I will be including documentation for as a -tutorial soon. Plus there's all the other lua scripts in the lib\scpt -directory to look at. Most of what you see in these files has been learned from -those files anyway! - -The source code is invaluable as well. There's a searchable and browsable -version of the latest ToME source code available online at -[[[[[Ghttp://www.t-o-m-e.net/cvs.php]. Use it! - -If you don't want to download and install the example scripts, then just -follow the tutorials with a text editor open! But I'll say it again, it's a lot -easier if you download and install the example scripts. - -This file goes on to explain the concepts of scripting, programming, -variables and functions. If you're familiar with these concepts, you might -as well take a look at how to add a power to the U menu in the -*****lua_pow.txt*0[Scripting a racial power] file. - - -#####R=== Defining some basic stuff === - -Computers don't do anything that they're not told to do. When we script, or -program, we must assume they know nothing. We have to tell them each little -bit of information from the ground up. - -A program, or a script (we'll talk about exact differences later) is like a -set of instructions. Let's imagine that people responded to programs, and -that we had a program called "Housework". Its series of instructions might -look something like this: - -#####BDo the Washing up. -#####BClean the kitchen. -#####BDust the shelves. -#####BHoover the lounge. - -Each step above could be called a function, as they are all actions that -need to be carried out. Now to you and me, we'd understand that program just -fine, but if someone didn't know HOW to wash, or what hoovering was, they'd -soon run into problems. For those people we'd need to define each function -clearly. Thus "do the washing up" might be - - -#####BRun hot water into bowl. -#####BAdd washing up liquid. -#####BPut dirty plates into bowl -#####BScrub plates till clean -#####BPlace clean plates on rack to dry, - -There's still plenty of problems here though. We've not said to turn the tap -off, or what the bowl is, or to wash any dirty cutlery, mugs, saucepans, etc., -etc. Whilst this might seem fairly obvious to a person, this is how we need -to think when writing programs for computers. - -Lets look now at some of the terms we're going to be using, in the rest of -these help files, and what they mean... - -#####R=== Variables and Constants === -A variable is a way to store information in a computer. Just as you store -things in your own memory, you can store things in the computer's memory. And -just as things change in your memory, so things can change in the computer's -memory. This factor of change is why they're called "variables" and not -"statics". - -For instance, you may have a friend's email address committed to memory, but -things change over time, they get a new ISP or domain, and so their email -address changes. You commit this new address to memory, and eventually -forget the old one. The thing you have stored in your memory is the same -(your friend's address) but the value (property) of what you have stored has -changed (from friend@old-address.com to friend@new-address.com). - -Variables are the building blocks out of which you will create your patch. - -A variable which will *never* change its value is called a constant. - -#####R===Functions=== - -A function is a series of steps or statements, grouped together and given -one name. When you want to carry out those steps, you simply ask the -computer to carry out that function. To go back to our original example, -rather than saying, "I'd like you to run some hot water into a bowl, add the -washing up liquid, put the dirty plates into it, and then scrub them till -they're clean", we just say "do the washing up". - -This is where we come to the difference between scripting and programming. -With scripting we can use the functions and variables that exist in the -ToME code. Maintainers like DarkGod have already made sure that the -computer knows how to "do the washing up", including turning the tap off and -what the bowl is. All we need to do in our script is say "do the washing -up". Or to look at it in a more relevant way, the game has been coded so -that when a magic missile is fired, a bolt or beam spell with a black line -of asterisks will be drawn in the direction indicated by the player, the -mana of that spell will be used up, the monster will take the appropriate -amount of damage, and so on. All we need to do in our script is say "fire a -magic missile". - -As you script, you will still be designing your own functions, and -variables, but the hardest parts have been done for you! - -Not every function and global variable in the source-code has been exported to -use in your scripting. But the ones that have are easily identifiable by -looking in any source files with the extension .pkg . Chris Hadgis has written -some excellent documentation which outline the use of the most important -functions in some of these files. They outline the functions from the - -OK, the first tutorial proper is on *****lua_pow.txt*0[adding a racial power] . - - [[[[[gThis file by fearoffours (fearoffours@moppy.co.uk)] diff --git a/lib/mods/theme/help/lua_mon.txt b/lib/mods/theme/help/lua_mon.txt deleted file mode 100644 index 9bb363c0..00000000 --- a/lib/mods/theme/help/lua_mon.txt +++ /dev/null @@ -1,535 +0,0 @@ -|||||oy - -#####R /----------------------------------------\ -#####R < monster.pkg functions helper file > -#####R \----------------------------------------/ - - ----------------------------------------------------------------------- - -#####R=== race_info_idx === - -#####GDeclaration - extern monster_race* race_info_idx(int r_idx, int ego); - -#####GFile - monster2.c - -#####GComment -/* - * Return a (monster_race*) with the combinations of the monster - * properties and the ego type - */ - -#####GDescription -Get monster info and ego info for monster with monster index "r_idx" -and monster ego "ego". The ego information is applied to the monster -information and the new monster information is returned. - -For example, race_info_idx(141,7) will create a brown yeek (monster) -shaman (ego). - -#####GParameters -> "r_idx" is an entry from the "r_info.txt" file. Beware: there is no - range checking. -> "ego" is an entry from the "re_info.txt". Beware: there is no range - checking. - ----------------------------------------------------------------------- - -#####R=== delete_monster_idx === - -#####GDeclaration - extern void delete_monster_idx(int i); - -#####GFile - monster2.c - -#####GComment -/* - * Delete a monster by index. - * - * When a monster is deleted, all of its objects are deleted. - */ - -#####GDescription -Delete monster "i" from the monster array. - -#####GParameters -> "i" is the index for the monster list (m_list[]). Beware: there is - no range checking. - ----------------------------------------------------------------------- - -#####R=== m_pop === - -#####GDeclaration - extern s16b m_pop(void); - -#####GFile - monsters2.c - -#####GComment -/* - * Acquires and returns the index of a "free" monster. - * - * This routine should almost never fail, but it *can* happen. - */ - -#####GDescription -Get an empty slot in the monster list (m_list[]). If there are no -empty slots, a slot will be reclaimed from a "dead" monster. If all -slots are full, 0 is returned, which means the function has failed -("Too many monsters!"). - ----------------------------------------------------------------------- - -#####R=== get_mon_num_prep === - -#####GDeclaration - extern errr get_mon_num_prep(void); - -#####GFile - monster2.c - -#####GComment -/* - * Apply a "monster restriction function" to the "monster allocation table" - */ - -#####GDescription -There are no parameters, but there are some other variables which will -need to be set. They are get_mon_num_hook and get_mon_num2_hook. They -are pointers to functions. - -For example, get_mon_num_hook = monster_volcano means when -get_mon_num_hook is called (*get_mon_num_hook)(index), the actual -function called is monster_volcano(index). This particular function -returns TRUE if the monster indicated by "index" has the -RF8_WILD_VOLCANO flag set. - -It is a good idea to store the old value of get_mon_num_hook before -setting a new one, and restoring it when your function is finished. - -Following is a list of functions which can be assigned to -get_mon_num_hook: - -create_molds_hook -create_townpeople_hook -mon_hook_bounty -monster_dungeon -monster_grass -monster_mountain -monster_ocean -monster_quest -monster_shore -monster_town -monster_volcano -monster_waste -monster_wood -mutate_monster_okay -place_monster_okay -summon_specific_okay -vault_aux_animal -vault_aux_chapel -vault_aux_clone -vault_aux_demon -vault_aux_dragon -vault_aux_giant -vault_aux_jelly -vault_aux_kennel -vault_aux_orc -vault_aux_symbol -vault_aux_treasure -vault_aux_troll -vault_aux_undead - -Or you can write your own. The function must take an integer (index) -as a parameter and return boolean (TRUE if the monster is selected, -or FALSE if it is not). - ----------------------------------------------------------------------- - -#####R=== get_mon_num === - -#####GDeclaration - extern s16b get_mon_num(int level); - -#####GFile - monster2.c - -#####GComment -/* - * Choose a monster race that seems "appropriate" to the given level - * - * This function uses the "prob2" field of the "monster allocation table", - * and various local information, to calculate the "prob3" field of the - * same table, which is then used to choose an "appropriate" monster, in - * a relatively efficient manner. - * - * Note that "town" monsters will *only* be created in the town, and - * "normal" monsters will *never* be created in the town, unless the - * "level" is "modified", for example, by polymorph or summoning. - * - * There is a small chance (1/50) of "boosting" the given depth by - * a small amount (up to four levels), except in the town. - * - * It is (slightly) more likely to acquire a monster of the given level - * than one of a lower level. This is done by choosing several monsters - * appropriate to the given level and keeping the "hardest" one. - * - * Note that if no monsters are "appropriate", then this function will - * fail, and return zero, but this should *almost* never happen. - */ - -Description: -For the given level "level", return the index of an appropriate -monster race. - -#####GParameters -> "level" is a dungeon level - ----------------------------------------------------------------------- - -#####R=== monster_desc === - -#####GDeclaration - extern void monster_desc(char *desc, monster_type *m_ptr, - int mode); - -#####GFile - monster2.c - -#####GComment -/* - * Build a string describing a monster in some way. - * - * We can correctly describe monsters based on their visibility. - * We can force all monsters to be treated as visible or invisible. - * We can build nominatives, objectives, possessives, or reflexives. - * We can selectively pronominalize hidden, visible, or all monsters. - * We can use definite or indefinite descriptions for hidden monsters. - * We can use definite or indefinite descriptions for visible monsters. - * - * Pronominalization involves the gender whenever possible and allowed, - * so that by cleverly requesting pronominalization / visibility, you - * can get messages like "You hit someone. She screams in agony!". - * - * Reflexives are acquired by requesting Objective plus Possessive. - * - * If no m_ptr arg is given (?), the monster is assumed to be hidden, - * unless the "Assume Visible" mode is requested. - * - * If no r_ptr arg is given, it is extracted from m_ptr and r_info - * If neither m_ptr nor r_ptr is given, the monster is assumed to - * be neuter, singular, and hidden (unless "Assume Visible" is set), - * in which case you may be in trouble... :-) - * - * I am assuming that no monster name is more than 70 characters long, - * so that "char desc[80];" is sufficiently large for any result. - * - * Mode Flags: - * 0x01 --> Objective (or Reflexive) - * 0x02 --> Possessive (or Reflexive) - * 0x04 --> Use indefinites for hidden monsters ("something") - * 0x08 --> Use indefinites for visible monsters ("a kobold") - * 0x10 --> Pronominalize hidden monsters - * 0x20 --> Pronominalize visible monsters - * 0x40 --> Assume the monster is hidden - * 0x80 --> Assume the monster is visible - * - * Useful Modes: - * 0x00 --> Full nominative name ("the kobold") or "it" - * 0x04 --> Full nominative name ("the kobold") or "something" - * 0x80 --> Genocide resistance name ("the kobold") - * 0x88 --> Killing name ("a kobold") - * 0x22 --> Possessive, genderized if visible ("his") or "its" - * 0x23 --> Reflexive, genderized if visible ("himself") or "itself" - */ - -#####GDescription -Return a monster description "desc" for monster "monster_type" using -flag "mode". The modes are described above. - -#####GParameters -> "desc" is the returned description. -> "monster type" is the monster (monster pointer). -> "mode" is one of the modes described in the comments. - ----------------------------------------------------------------------- - -#####R=== monster_race_desc === - -#####GDeclaration - extern void monster_race_desc(char *desc, int r_idx, - int ego); - -#####GFile - monster2.c - -#####GComment -(none) - -#####GDescription -Return the monster description "desc" for monster with monster index -"r_idx" and monster ego "ego". The monster description is made up of -the ego name (if any) and monster name, or the unique name. - -#####GParameters -> "desc" is the returned description. -> "r_idx" is an entry from the "r_info.txt" file. Beware: there is no - range checking. -> "ego" is an entry from the "re_info.txt". Beware: there is no range - checking. - ----------------------------------------------------------------------- - -#####R=== place_monster_aux === - -#####GDeclaration - extern bool place_monster_aux(int y, int x, int r_idx, - bool slp, bool grp, int status); - -#####GFile - monster2.c - -#####GComment -/* - * Attempt to place a monster of the given race at the given location - * - * Note that certain monsters are now marked as requiring "friends". - * These monsters, if successfully placed, and if the "grp" parameter - * is TRUE, will be surrounded by a "group" of identical monsters. - * - * Note that certain monsters are now marked as requiring an "escort", - * which is a collection of monsters with similar "race" but lower - * level. - * - * Some monsters induce a fake "group" flag on their escorts. - * - * Note the "bizarre" use of non-recursion to prevent annoying output - * when running a code profiler. - * - * Note the use of the new "monster allocation table" code to restrict - * the "get_mon_num()" function to "legal" escort types. - */ - -#####GDescription -Attempt to place a monster at grid "y", "x". The monster has monster -index "m_idx". The monster may be asleep ("slp"). The monster may be -surrounded by a group of identical monsters ("grp"). The monster has -a status of "status" (see below). The function returns TRUE if the -monster is placed successfully, otherwise FALSE. - -#####GParameters -> "y" is the y co-ordinate of the target grid. -> "x" is the x co-ordinate of the target grid. -> "r_idx" is an entry from the "r_info.txt" file. Beware: there is no - range checking. -> "slp" is TRUE if the monster is asleep, otherwise FALSE. -> "grp" is TRUE if the monster is surrounded by a group, otherwise - FALSE. -> "status" is the status of the monster - *****fields.txt*0[status] - ----------------------------------------------------------------------- - -#####R=== place_monster === - -#####GDeclaration - extern bool place_monster(int y, int x, bool slp, - bool grp); - -#####GFile - monster2.c - -#####GComment -/* - * Hack -- attempt to place a monster at the given location - * - * Attempt to find a monster appropriate to the "monster_level" - */ - -#####GDescription -Attempt to place a monster at grid "y", "x". The monster may be asleep -("slp"). The monster may be surrounded by a group of identical -monsters ("grp"). The monster is of the appropriate monster level. The -function returns TRUE if the monster is placed successfully, otherwise -FALSE. - -#####GParameters -> "y" is the y co-ordinate of the target grid. -> "x" is the x co-ordinate of the target grid. -> "slp" is TRUE if the monster is asleep, otherwise FALSE. -> "grp" is TRUE if the monster is surrounded by a group, otherwise - FALSE. - ----------------------------------------------------------------------- - -#####R=== place_monster_one === - -#####GDeclaration - extern s16b place_monster_one(int y, int x, int r_idx, - int ego, bool slp, int status); - -#####GFile - monster2.c - -#####GComment -/* - * Attempt to place a monster of the given race at the given location. - * - * To give the player a sporting chance, any monster that appears in - * line-of-sight and is extremely dangerous can be marked as - * "FORCE_SLEEP", which will cause them to be placed with low energy, - * which often (but not always) lets the player move before they do. - * - * This routine refuses to place out-of-depth "FORCE_DEPTH" monsters. - * - * XXX XXX XXX Use special "here" and "dead" flags for unique monsters, - * remove old "cur_num" and "max_num" fields. - * - * XXX XXX XXX Actually, do something similar for artifacts, to simplify - * the "preserve" mode, and to make the "what artifacts" flag more useful. - * - * This is the only function which may place a monster in the dungeon, - * except for the savefile loading code. - */ - -#####GDescription -Attempt to place a monster at grid "y", "x". The monster has monster -index "m_idx". The monster may be asleep ("slp"). The monster may have -an ego type ("ego"). The monster has a status of "status" (see below). -The function returns TRUE if the monster is placed successfully, -otherwise FALSE. - -#####GParameters -> "y" is the y co-ordinate of the target grid. -> "x" is the x co-ordinate of the target grid. -> "r_idx" is an entry from the "r_info.txt" file. Beware: there is no - range checking. -> "slp" is TRUE if the monster is asleep, otherwise FALSE. -> "ego" is an entry from the "re_info.txt". Beware: there is no range - checking. -> "status" is the status of the monster - *****fields.txt*0[status] - ----------------------------------------------------------------------- - -#####R=== is_friend === - -#####GDeclaration - extern int is_friend(monster_type *m_ptr); - -#####GFile - monster3.c - -#####GComment -/* - * Is the monster in friendly state(pet, friend, ..) - * -1 = enemy, 0 = neutral, 1 = friend - */ - -#####GDescription -Return a value to indicate the status of monster "m_ptr". - *****fields.txt*0[status] - -#####GParameters -> "m_ptr" is a pointer to a monster. - ----------------------------------------------------------------------- - -#####R=== is_enemy === - -#####GDeclaration - extern bool is_enemy(monster_type *m_ptr, - monster_type *t_ptr); - -#####GFile - monster3.c - -#####GComment -/* Should they attack each others */ - -#####GDescription -Return TRUE if monster "m_ptr" should attack monster "t_ptr". If -"m_ptr" is stupid and "r_ptr" is a different type of monster then the -function will return TRUE. If "m_ptr" is not neutral and "r_ptr" is a -breeder, and "r_ptr" is a different type of monster then the function -will return TRUE (and vice versa). If both monsters are not neutral -and one is friendly and the other isn't then the function will return -TRUE. Otherwise the function returns FALSE. - -#####GParameters -> "m_ptr" is a pointer to a monster. -> "t_ptr" is a pointer to a monster (target). - ----------------------------------------------------------------------- - -#####R=== change_side === - -#####GDeclaration - extern bool change_side(monster_type *m_ptr); - -#####GFile - monster3.c - -#####GComment -(none) - -#####GDescription -Change the status of monster "m_ptr" from friendly to unfriendly and -vice versa. Friends and pets become enemies. Neutral Ms become -neutral Ps and vice versa. Companions are unaffected. The -function returns TRUE if the status changed, otherwise FALSE. - -#####GParameters -> "m_ptr" is a pointer to a monster. - ----------------------------------------------------------------------- - -#####R=== find_position === - -#####GDeclaration - extern void find_position(int y, int x, int *yy = 0, - int *xx = 0); - -#####GFile - lua_bind.c - -#####GComment -(none) - -#####GDescription -Find a new grid "yy", "xx" within 6 grids of target grid "y", "x". -The new grid must be within line-of-sight of the target grid. A -maximum of 5000 attempts is made. - -#####GParameters -> "y" is the y co-ordinate of the target grid. -> "x" is the x co-ordinate of the target grid. -> "yy" is the y co-ordinate of the new grid. -> "xx" is the x co-ordinate of the new grid. - ----------------------------------------------------------------------- - -#####R=== can_create_companion === - -#####GDeclaration - extern bool can_create_companion(); - -#####GFile - monster3.c - -#####GComment -/* Returns if a new companion is allowed */ - -#####GDescription -Return TRUE if a companion can be created, otherwise FALSE. - ----------------------------------------------------------------------- - -Back to the *****lua.hlp*0[lua help index] . - - - [[[[[gThis file by Chris Hadgis] diff --git a/lib/mods/theme/help/lua_play.txt b/lib/mods/theme/help/lua_play.txt deleted file mode 100644 index 6ab64ddb..00000000 --- a/lib/mods/theme/help/lua_play.txt +++ /dev/null @@ -1,1225 +0,0 @@ -|||||oy - -#####R /----------------------------------------\ -#####R < player.pkg functions helper file > -#####R \----------------------------------------/ - ----------------------------------------------------------------------- - -#####RFunction: set_parasite - -#####GDeclaration: bool set_parasite(int v, int r); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->parasite" and "p_ptr->parasite_r_idx" -* notice observable changes -*/ - -#####GDescription: -Set time "v" until parasite with monster index "r" is created. The -player gets the message "You feel something growing in you" if "v" -is > 0. Otherwise the player gets the message "Your body convulse -and spawn " if the monster is created (80% chance) or -"The hideous thing growing in you seems to die" if the monster dies. - -#####GParameters: ->v is the time until the parasite gestates (must be between 0 and - 10000). ->r is the monster index of parasite to be created. - ----------------------------------------------------------------------- - -#####RFunction: set_disrupt_shield - -#####GDeclaration: bool set_disrupt_shield(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->disrupt_shield" -* notice observable changes -*/ - -#####GDescription: -Set time "v" until shield of invulnerability expires. The player gets -the message "You feel invulnerable" if "v" is > 0. Otherwise the -player gets the message "You are more vulnerable". - -#####GParameters: ->v is the time until the shield expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_prob_travel - -#####GDeclaration: bool set_prob_travel(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->prob_travel" -* notice observable changes -*/ - -#####GDescription: -Set time "v" until random teleportation expires. The player gets -the message "You feel instable" if "v" is > 0. Otherwise the -player gets the message "You are more stable". - -#####GParameters: ->v is the time until random teleportation expires (must be between 0 - and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_tim_deadly - -#####GDeclaration: bool set_tim_deadly(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_deadly" -*/ - -#####GDescription: -Set time "v" until deadly accuracy expires. The player gets the -message "You feel extremely accurate" if "v" is > 0. Otherwise the -player gets the message "You are suddenly much less accurate". - -#####GParameters: ->v is the time until deadly accuracy expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_tim_res_time - -#####GDeclaration: bool set_tim_res_time(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_res_time" -*/ - -#####GDescription: -Set time "v" until space-time distortions expire. The player gets the -message "You are now protected against the space-time distortions" if -"v" is > 0. Otherwise the player gets the message "You are no longer -protected against the space-time distortions". - -#####GParameters: ->v is the time until space-time distortions expire (must be between - 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_tim_reflect - -#####GDeclaration: bool set_tim_reflect(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_reflect" -*/ - -#####GDescription: -Set time "v" until reflection expire. The player gets the message -"You start reflecting the world around you" if "v" is > 0. Otherwise -the player gets the message "You stop reflecting". - -#####GParameters: ->v is the time until reflection expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_meditation - -#####GDeclaration: bool set_meditation(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->meditation" -*/ - -#####GDescription: -Set time "v" until meditation expire. The player gets the message -"You start meditating on yourself" if "v" is > 0. Otherwise the -player gets the message "You stop your self meditation". - -#####GParameters: ->v is the time until meditation expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_strike - -#####GDeclaration: bool set_strike(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->strike" -*/ - -#####GDescription: -Set time "v" until accurate strikes expire. The player gets the -message "You feel very accurate" if "v" is > 0. Otherwise the player -gets the message "You are no longer very accurate". - -#####GParameters: ->v is the time until accurate strikes expire (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_walk_water - -#####GDeclaration: bool set_walk_water(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->walk_water", notice observable changes -*/ - -#####GDescription: -Set time "v" until walking on water expires. The player gets the -message "You feel strangely insubmersible" if "v" is > 0. Otherwise -the player gets the message "You are no longer insubmersible". - -#####GParameters: ->v is the time until walking on water expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_tim_ffall - -#####GDeclaration: bool set_tim_ffall(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_ffall" -*/ - -#####GDescription: -Set time "v" until feather-fall expires. The player gets the message -"You feel very light" if "v" is > 0. Otherwise the player gets the -message "You are suddenly heavier". - -#####GParameters: ->v is the time until feather-fall expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_tim_fire_aura - -#####GDeclaration: bool set_tim_fire_aura(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_fire_aura" -*/ - -#####GDescription: -Set time "v" until fiery aura expires. The player gets the message -"You are enveloped in flames" if "v" is > 0. Otherwise the player -gets the message "You are no longer enveloped in flames". - -#####GParameters: ->v is the time until fiery aura expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_holy - -#####GDeclaration: bool set_holy(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->holy", notice observable changes -*/ - -#####GDescription: -Set time "v" until holiness expires. The player gets the message -"You feel a holy aura around you" if "v" is > 0. Otherwise the -player gets the message "The holy aura vanishes". - -#####GParameters: ->v is the time until holiness expires (must be between 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_grace - -#####GDeclaration: void set_grace(s32b v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->grace", notice observable changes -*/ - -#####GDescription: -Set grace to value "v". Don't allow grace to fall below -30000 or -rise above 30000. - -#####GParameters: ->v is the value of grace. - ----------------------------------------------------------------------- - -#####RFunction: set_mimic - -#####GDeclaration: bool set_mimic(int v, int p); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_mimic", and "p_ptr->mimic_form", -* notice observable changes -*/ - -#####GDescription: -Set time "v" until morph into monster with monster index "p" expires. -The player gets the message "You feel your body change" if "v" is > 0. -Otherwise the player gets the message "You are no longer transformed". - -#####GParameters: ->v is the time until transformation expires (must be between 0 and - 10000). ->p is the monster index of the monster the player wants to mimic. - ----------------------------------------------------------------------- - -#####RFunction: set_no_breeders - -#####GDeclaration: bool set_no_breeders(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "no_breeds" -*/ - -#####GDescription: -Set time "v" until breeders can breed again. The player gets the -message "You feel an anti-sexual aura" if "v" is > 0. Otherwise the -player gets the message "You no longer feel an anti-sexual aura". -Okay... - -#####GParameters: ->v is the time until breeders can breed again (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_invis - -#####GDeclaration: bool set_invis(int v,int p); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_invis", and "p_ptr->tim_inv_pow", -* notice observable changes -*/ - -#####GDescription: -Set time "v" until invisibility expires. The player gets the message -"You feel your body fade away" if "v" is > 0. Otherwise the player -gets the message "You are no longer invisible". - -#####GParameters: ->v is the time until invisibility expires (must be between 0 and - 10000). ->p is the power of timed invisibility. - ----------------------------------------------------------------------- - -#####RFunction: set_lite - -#####GDeclaration: bool set_lite(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_lite", notice observable changes -* -* Note the use of "PU_VIEW", which is needed to -* memorise any terrain features which suddenly become "visible". -* Note that blindness is currently the only thing which can affect -* "player_can_see_bold()". -*/ - -#####GDescription: -Set time "v" until brightness expires. The player gets the message -"You suddenly seem brighter" if "v" is > 0. Otherwise the player -gets the message "You are no longer bright". - -#####GParameters: ->v is the time until brightness expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_blind - -#####GDeclaration: bool set_blind(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->blind", notice observable changes -* -* Note the use of "PU_UN_VIEW", which is needed to memorise any terrain -* features which suddenly become "visible". -* Note that blindness is currently the only thing which can affect -* "player_can_see_bold()". -*/ - -#####GDescription: -Set time "v" until blindness expires. The player gets the message "You -are blind" if "v" is > 0. Otherwise the player gets the message "You -can see again". - -#####GParameters: ->v is the time until blindness expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_confused - -#####GDeclaration: bool set_confused(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->confused", notice observable changes -*/ - -#####GDescription: -Set time "v" until confusion expires. The player gets the message "You -are confused" if "v" is > 0. Otherwise the player gets the message -"You feel less confused now". - -#####GParameters: ->v is the time until confusion expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_poisoned - -#####GDeclaration: bool set_poisoned(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->poisoned", notice observable changes -*/ - -#####GDescription: -Set time "v" until poison expires. The player gets the message "You -are poisoned" if "v" is > 0. Otherwise the player gets the message -"You are no longer poisoned". - -#####GParameters: ->v is the time until poison expires (must be between 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_afraid - -#####GDeclaration: bool set_afraid(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->afraid", notice observable changes -*/ - -#####GDescription: -Set time "v" until fear expires. The player gets the message "You are -terrified" if "v" is > 0. Otherwise the player gets the message "You -feel bolder now". - -#####GParameters: ->v is the time until fear expires (must be between 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_paralyzed - -#####GDeclaration: bool set_paralyzed(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->paralyzed", notice observable changes -*/ - -#####GDescription: -Set time "v" until paralysis expires. The player gets the message "You -are paralyzed" if "v" is > 0. Otherwise the player gets the message -"You can move again". - -#####GParameters: ->v is the time until paralysis expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_image - -#####GDeclaration: bool set_image(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->image", notice observable changes -* -* Note that we must redraw the map when hallucination changes. -*/ - -#####GDescription: -Set time "v" until hallucination expires. The player gets the message -"Oh, wow! Everything looks so cosmic now" if "v" is > 0. Otherwise -the player gets the message "You can see clearly again". - -#####GParameters: ->v is the time until hallucination expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_fast - -#####GDeclaration: bool set_fast(int v, int p); - -#####GFile: xtra2.c - -#####GComment: -(none) - -#####GDescription: -Set time "v" until speed of speed factor "p" expires. The player gets -the message "You feel yourself moving faster" if "v" is > 0. Otherwise -the player gets the message "You feel yourself slow down". - -#####GParameters: ->v is the time until speed expires (must be between 0 and 10000). ->p is the speed factor. - ----------------------------------------------------------------------- - -#####RFunction: set_light_speed - -#####GDeclaration: bool set_light_speed(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->lightspeed", notice observable changes -*/ - -#####GDescription: -Set time "v" until light-speed expires. The player gets the message -"You feel as if time has stopped" if "v" is > 0. Otherwise the player -gets the message "You feel time returning to its normal rate". - -#####GParameters: ->v is the time until light-speed expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_slow - -#####GDeclaration: bool set_slow(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->slow", notice observable changes -*/ - -#####GDescription: -Set time "v" until slowness expires. The player gets the message "You -feel yourself moving slower" if "v" is > 0. Otherwise the player gets -the message "You feel yourself speed up". - -#####GParameters: ->v is the time until slowness expires (must be between 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_shield - -#####GDeclaration: bool set_shield(int v, int p, s16b o, s16b d1, s16b d2); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->shield", notice observable changes -*/ - -#####GDescription: -Set time "v" until stone-shield expires. The player gets the message -"Your skin turns to stone" if "v" is > 0. Otherwise the player gets -the message "Your skin returns to normal". Stone-shield has spell -power "p", spell option "o", and power options "d1" and "d2". - -#####GParameters: ->v is the time until stone-shield expires (must be between 0 and - 10000). ->p is the power of the stone-shield spell. ->o is the option of the stone-shield spell. ->d1 is the power for option 1 of the stone-shield spell. ->d2 is the power for option 2 of the stone-shield spell. - ----------------------------------------------------------------------- - -#####RFunction: set_blessed - -#####GDeclaration: bool set_blessed(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->blessed", notice observable changes -*/ - -#####GDescription: -Set time "v" until blessing expires. The player gets the message "You -feel righteous" if "v" is > 0. Otherwise the player gets the message -"The prayer has expired". - -#####GParameters: ->v is the time until blessing expires (must be between 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_hero - -#####GDeclaration: bool set_hero(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->hero", notice observable changes -*/ - -#####GDescription: -Set time "v" until heroism expires. The player gets the message "You -feel like a hero" if "v" is > 0. Otherwise the player gets the -message "The heroism wears off". - -#####GParameters: ->v is the time until heroism expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_shero - -#####GDeclaration: bool set_shero(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->shero", notice observable changes -*/ - -#####GDescription: -Set time "v" until berserk expires. The player gets the message "You -feel like a killing machine" if "v" is > 0. Otherwise the player gets -the message "You feel less Berserk". - -#####GParameters: ->v is the time until berserk expires (must be between 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_protevil - -#####GDeclaration: bool set_protevil(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->protevil", notice observable changes -*/ - -#####GDescription: -Set time "v" until protection from evil expires. The player gets the -message "You feel safe from evil" if "v" is > 0. Otherwise the player -gets the message "You no longer feel safe from evil". - -#####GParameters: ->v is the time until protection from evil expires (must be between 0 - and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_protgood - -#####GDeclaration: bool set_protgood(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->protgood", notice observable changes -*/ - -#####GDescription: -Set time "v" until protection from good expires. The player gets the -message "You feel safe from good" if "v" is > 0. Otherwise the player -gets the message "You no longer feel safe from good". - -#####GParameters: ->v is the time until protection from evil expires (must be between 0 - and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_protundead - -#####GDeclaration: bool set_protundead(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->protundead", notice observable changes -*/ - -#####GDescription: -Set time "v" until protection from undead expires. The player gets the -message "You feel safe from undead" if "v" is > 0. Otherwise the -player gets the message "You no longer feel safe from undead". - -#####GParameters: ->v is the time until protection from undead expires (must be between - 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_invuln - -#####GDeclaration: bool set_invuln(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->invuln", notice observable changes -*/ - -#####GDescription: -Set time "v" until invulnerability expires. The player gets the -message "Invulnerability" if "v" is > 0. Otherwise the player gets -the message "The invulnerability wears off". - -#####GParameters: ->v is the time until invulnerability expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_tim_invis - -#####GDeclaration: bool set_tim_invis(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_invis", notice observable changes -*/ - -#####GDescription: -Set time "v" until see invisible expires. The player gets the message -"Your eyes feel very sensitive" if "v" is > 0. Otherwise the player -gets the message "Your eyes feel less sensitive". - -#####GParameters: ->v is the time until see invisible expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_tim_infra - -#####GDeclaration: bool set_tim_infra(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_infra", notice observable changes -*/ - -#####GDescription: -Set time "v" until infravision expires. The player gets the message -"Your eyes begin to tingle" if "v" is > 0. Otherwise the player gets -the message "Your eyes stop tingling". - -#####GParameters: ->v is the time until infravision expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_mental_barrier - -#####GDeclaration: bool set_mental_barrier(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->tim_mental_barrier", notice observable changes -*/ - -#####GDescription: -Set time "v" until mental barrier expires. The player gets the message -"Your mind grows stronger" if "v" is > 0. Otherwise the player gets -the message "Your mind is no longer especially strong". - -#####GParameters: ->v is the time until mental barrier expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_acid - -#####GDeclaration: bool set_oppose_acid(int v); - -#####GFile: xtra2.c - -#####GComment: - -#####GDescription: -Set time "v" until feather-fall expires. The player gets the message -"You feel very light" if "v" is > 0. Otherwise the player gets the -message "You are suddenly heavier". - -#####GParameters: ->v is the time until feather-fall expires (must be between 0 and - 10000). ->v is the time until feather-fall expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_elec - -#####GDeclaration: bool set_oppose_elec(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->oppose_elec", notice observable changes -*/ - -#####GDescription: -Set time "v" until electricity resistance expires. The player gets -the message "You feel resistant to electricity" if "v" is > 0. -Otherwise the player gets the message "You feel less resistant to -electricity". - -#####GParameters: ->v is the time until electricity resistance expires (must be between - 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_fire - -#####GDeclaration: bool set_oppose_fire(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->oppose_fire", notice observable changes -*/ - -#####GDescription: -Set time "v" until fire resistance expires. The player gets the -message "You feel resistant to fire" if "v" is > 0. Otherwise the -player gets the message "You feel less resistant to fire". - -#####GParameters: ->v is the time until fire resistance expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_cold - -#####GDeclaration: bool set_oppose_cold(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->oppose_cold", notice observable changes -*/ - -#####GDescription: -Set time "v" until cold resistance expires. The player gets the -message "You feel resistant to cold" if "v" is > 0. Otherwise the -player gets the message "You feel less resistant to cold". - -#####GParameters: ->v is the time until cold resistance expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_pois - -#####GDeclaration: bool set_oppose_pois(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->oppose_pois", notice observable changes -*/ - -#####GDescription: -Set time "v" until poison resistance expires. The player gets the -message "You feel resistant to poison" if "v" is > 0. Otherwise the -player gets the message "You feel less resistant to poison". - -#####GParameters: ->v is the time until poison resistance expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_ld - -#####GDeclaration: bool set_oppose_ld(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->oppose_ld" -*/ - -#####GDescription: -Set time "v" until light and dark resistance expires. The player gets -the message "You feel protected against the light's fluctuation" if -"v" is > 0. Otherwise the player gets the message "You are no longer -protected against the light's fluctuation". - -#####GParameters: ->v is the time until light and dark resistance expires (must be - between 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_cc - -#####GDeclaration: bool set_oppose_cc(int v); - -#####GFile: xtra2.c -/* -* Set "p_ptr->oppose_cc" -*/ - -#####GComment: - -#####GDescription: -Set time "v" until chaos resistance expires. The player gets the -message "You feel protected against raw chaos" if "v" is > 0. -Otherwise the player gets the message "You are no longer protected -against chaos". - -#####GParameters: ->v is the time until chaos resistance expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_ss - -#####GDeclaration: bool set_oppose_ss(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->oppose_ss" -*/ - -#####GDescription: -Set time "v" until sound and shard resistance expires. The player gets -the message "You feel protected against the ravages of sound and -shards" if "v" is > 0. Otherwise the player gets the message "You are -no longer protected against the ravages of sound and shards". - -#####GParameters: ->v is the time until sound and shard resistance expires (must be - between 0 and 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_oppose_nex - -#####GDeclaration: bool set_oppose_nex(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->oppose_nex" -*/ - -#####GDescription: -Set time "v" until nexus resistance expires. The player gets the -message "You feel protected against the strange forces of nexus" if -"v" is > 0. Otherwise the player gets the message "You are no longer -protected against the strange forces of nexus". - -#####GParameters: ->v is the time until nexus resistance expires (must be between 0 and - 10000). - ----------------------------------------------------------------------- - -#####RFunction: set_stun - -#####GDeclaration: bool set_stun(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->stun", notice observable changes -* -* Note the special code to only notice "range" changes. -*/ - -#####GDescription: -Set stun level "v". If the player race can't be stunned then the level -is forced to 0. A value > 100 means the player is knocked out. A value ->50 is a heavy stun. A value > 0 is a stun. If the stun level has -increased, a message is printed. There is a small chance of stun level -in 1000, or a 1 in 16 chance of a vicious blow which decreases -intelligence and/or wisdom for a while. - -#####GParameters: ->v is the stun level. - ----------------------------------------------------------------------- - -#####RFunction: set_cut - -#####GDeclaration: bool set_cut(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->cut", notice observable changes -* -* Note the special code to only notice "range" changes. -*/ - -#####GDescription: -Set cut level "v". If the player race can't be cut then the time is -forced to 0. A value > 1000 is a mortal wound. A value > 200 is a deep -gash. A value > 100 is a severe cut. A value > 50 is a nasty cut. A -value > 25 is a bad cut. A value > 10 is a light cut. A value > 0 is a -graze. If the cut level has increased, a message is printed. There is -a small chance of stun level in 1000, or a 1 in 16 chance of scarring -which decreases charisma for a while. - -#####GParameters: ->v is the cut level. - ----------------------------------------------------------------------- - -#####RFunction: set_food - -#####GDeclaration: bool set_food(int v); - -#####GFile: xtra2.c - -#####GComment: -/* -* Set "p_ptr->food", notice observable changes -* -* The "p_ptr->food" variable can get as large as 20000, allowing the -* addition of the most "filling" item, Elvish Waybread, which adds -* 7500 food units, without overflowing the 32767 maximum limit. -* -* Perhaps we should disturb the player with various messages, -* especially messages about hunger status changes. XXX XXX XXX -* -* Digestion of food is handled in "dungeon.c", in which, normally, -* the player digests about 20 food units per 100 game turns, more -* when "fast", more when "regenerating", less with "slow digestion", -* but when the player is "gorged", he digests 100 food units per 10 -* game turns, or a full 1000 food units per 100 game turns. -* -* Note that the player's speed is reduced by 10 units while gorged, -* so if the player eats a single food ration (5000 food units) when -* full (15000 food units), he will be gorged for (5000/100)*10 = 500 -* game turns, or 500/(100/5) = 25 player turns (if nothing else is -* affecting the player speed). -*/ - -#####GDescription: -Set hunger level "v". A value < 500 is fainting. A value < 1000 is -weak. A value < 2000 is weak. A value < 10000 is full. A value -< 15000 is bloated. A value < 20000 is gorged. If one of these -levels is crossed a message is printed. - -#####GParameters: ->v is the hunger level (must be between 0 and 20000). - ----------------------------------------------------------------------- - -#####RFunction: check_experience - -#####GDeclaration: void check_experience(void); - -#####GFile: xtra2.c - -#####GComment: -/* -* Advance experience levels and print experience -*/ - -#####GDescription: -Check if player experience level has changed. If a player has achieved -a level for the first time, give reward or corruption (1 chance in 3) -if they apply, and increase skill points. - ----------------------------------------------------------------------- - -#####RFunction: check_experience_obj - -#####GDeclaration: void check_experience_obj(object_type *o_ptr); - -#####GFile: xtra2.c - -#####GComment: -/* -* Advance experience levels and print experience -*/ - -#####GDescription: -Check if object "o_ptr" experience level has changed. If an object has -achieved a level for the first time, apply gains. - -#####GParameters: ->o_ptr is the pointer to the object gaining experience. - ----------------------------------------------------------------------- - -#####RFunction: gain_exp - -#####GDeclaration: void gain_exp(s32b amount); - -#####GFile: xtra2.c - -#####GComment: -/* -* Gain experience (share it to objects if needed) -*/ - -#####GDescription: -Gain "amount" of experience. Count the number of objects which will -gain experience. The objects share equally 2/3 of "amount". Give -corruption if it applies. Gain experience. If experience is less -than maximum, then increase maximum experience by 20% of "amount". -Check for level change and print experience (check_experience). - -#####GParameters: ->amount is the amount of experience to share. - ----------------------------------------------------------------------- - -#####RFunction: lose_exp - -#####GDeclaration: void lose_exp(s32b amount); - -#####GFile: xtra2.c - -#####GComment: -/* -* Lose experience -*/ - -#####GDescription: -Decrease experience by "amount". Experience can not fall below zero. -Check for level change and print experience (check_experience). - -#####GParameters: ->amount is the amount of experience to lose. - ----------------------------------------------------------------------- - - -Back to the *****lua.hlp*0[lua help index] . - - - [[[[[gThis file by Chris Hadgis] - - diff --git a/lib/mods/theme/help/lua_pow.txt b/lib/mods/theme/help/lua_pow.txt deleted file mode 100644 index c221a664..00000000 --- a/lib/mods/theme/help/lua_pow.txt +++ /dev/null @@ -1,266 +0,0 @@ -|||||oy -#####R /----------------------------------------\ -#####R < Adding new racial powers > -#####R \----------------------------------------/ - -#####R=== Introduction === - -You *must* download and install my lua example files from -[[[[[Ghttp://www.moppy.co.uk/angband.htm]. And also you should read the -*****lua_intr.txt*0[scripting introduction] file if you haven't already done -so. - -The (commented) accompanying script file for this tutorial is -lib\scpt\pheonix.lua. Open it in your text editor! - -#####R=== The Racial Power === - -Let's start with something simple. Let's say you wanted your new race (let's -call it "Pheonix") to be able to cast fire balls as their racial power. - -#####R=== Starting off === - -If you have a look at pheonix.lua you'll note the first lines are comments. -I'll talk a bit more about comments later, but it's worth pointing out that any -lines of text preceded by a double hyphen ([[[[[B--]) will be ignored by the -scripting engine, and are therefore comments. -After the comments, the first 10 lines of code are as follows: - -#####BPHEONIX_POWER = add_power -#####B{ -#####B ["name"] = "Fire Breath", -#####B ["desc"] = "You are able to cast fireballs", -#####B ["desc_get"] = "Your beak glows red", -#####B ["desc_lose"] = "Your beak goes cold again", -#####B ["level"] = 10, -#####B ["cost"] = 11, -#####B ["stat"] = A_INT, -#####B ["fail"] = 14, - -So, [[[[[BPHEONIX_POWER = add_power] is registering our power. We're giving it -a name (PHEONIX_POWER) and saying that it is defined by calling the special -function [[[[[Badd_power]. This special function is only used to define lua- -scripted -powers, and has attributes which are identified by their inclusion in square -brackets. -Note the following: -- Lua is case sensitive. The name of our power is a constant, will never change -so that's been named with capitals. variables and functions are named all in -lower case. Technically speaking, Lua does not support constants, but we can -emulate them by variables in this way. They don't have to be capitalised, but -if you capitalise all your constants, it makes things easier to read, and -you'll be following normal programming protocol. -- There are no spaces in the name of the power. Use an underscore for spaces -if you need to improve legibility. - -[[[[[B"name" = "Fire Breath",] This is the name of the power as it is -displayed in the -U menu, and as you will define it in p_info.txt (more about that later). - -[[[[[B"desc" = "You are able to cast fireballs",] This is what would -appear in the -information display list if you drank a potion of self knowledge or -similar. - -[[[[[B"desc_get" = "Your beak glows red",] This is the information displayed -when you -gain this power. - -[[[[[B"desc_lose" = "Your beak goes cold again",] This is the information -displayed when -you lose this power. Eg After a mutation/corruption. - -[[[[[B"level" = 10,] Character level which must be gained in order to use -power, - -[[[[[B"cost" = 11,] Amount of mana to cast this power. - -[[[[[B"stat" = A_INT,] stat which will define whether it works or not, - -[[[[[B"fail" = 14,] how high that stat must be. - -So our Pheonix will be able to cast PHEONIX_POWER from clvl 10, at a cost of -11 mana, providing that the player's intelligence is 14 and upwards. - -#####R=== The function === - -The next section is a lot longer, so we'll look at it line by line. I'll -strip the comments for the purpose of this helpfile. - -#####B["power"] = function() -#####B local ret, dir, damage -#####B ret, dir = get_aim_dir(); -#####B if (ret == FALSE) then -#####B return -#####B end -#####B damage = player.lev*3 -#####B msg_print("You breathe fire.") -#####B fire_ball(GF_FIRE, dir, damage, 3) -#####Bend, - -The [[[[[B"power"] bit is what actually happens when the player accesses this -power -from their 'U' menu. Every function must start with the word [[[[[Bfunction]. -Normally, we'd also declare its name at this point, but as this is contained -within the [[[[[Badd_power] function, we just use the word [[[[[Bfunction] The -empty -brackets after this denote that no arguments are passed to the function. -Lets look at the next line. - -#####B local ret, dir, damage - -The [[[[[Blocal] bit is saying that we're going to declare some local -variables. That -is, that there will be three variables used in this function , that apply -exclusively to this function, and to no others. Global variables are -variables that apply to the whole script, in multiple functions. The three -variables will be called [[[[[Bret] (return), [[[[[Bdir] (direction), and -[[[[[Bdamage]. They will be used to determine the direction the ball -will fire in, and how much damage it will do. We'll see them in use when we add -the third line: - -#####B ret, dir = get_aim_dir(); - -here we're saying that the variables will take their value from the result -of a function. The program performs the function [[[[[Bget_aim_dir] which -essentially asks the player to choose a direction or pick a target. -[[[[[Bget_aim_dir] -assigns the value [[[[[Bret] to either TRUE (if the player correctly selected a -direction) or FALSE (if the player failed to do so (maybe they changed their -mind, or hit the wrong key!)). The value [[[[[Bdir] is the direction which was -selected (or the path to the target if a target was selected). OK so let's add -the next line: - -#####B if (ret == FALSE) then return end - -This introduces another fundamental scripting concept - [[[[[Bif] statements. -They work just as you would expect them too. You say "if a certain condition is -met, then do the following things." -So in this function we're saying, "if the value of [[[[[Bret] is FALSE then -[[[[[Breturn]." -As I mentioned above, [[[[[Bret] is false if the player aborted (either -deliberately or accidentally) the spell casting whilst choosing a direction -for the spell. The double equals sign are used to mean "is equal to" as a -single equals sign is used for defining variables remember? A single equals -sign is more of a "let x be equal to y" thing. -[[[[[Breturn] means stop the current function. And [[[[[Bend] signifies the -close of the [[[[[Bif] -statement. Every [[[[[Bif] statement must begin with an [[[[[Bif] and finish -with an [[[[[Bend]. -So, what our [[[[[Bif] statement is saying is; "if the player failed to specify -a direction or target for the spell, stop the function here." -If the player has correctly specified a direction/target, the function -continues to the next line: - -#####B damage = player.lev*3 - -Here we're saying that the variable [[[[[Bdamage] has a value equal to the -players current character level, multiplied by 3. - -#####B msg_print("You breathe fire.") - -Fairly easy to see what this does - displays the message "You breathe fire." -I could have put anything there obviously, like [[[[[Bmsg_print("You open] -[[[[[Byour mouth and everyone falls over with the smell of hot curry")] or -some other such rubbish. But note that the message is enclosed within double -quotes. The quotes aren't displayed in the message on screen, but signify the -start and end of the message. - -#####B fire_ball(GF_FIRE, dir, damage, 3) - -This is the line that casts the spell. it says execute the function -[[[[[Bfire_ball]. Now, this doesn't mean a fireball, it means fire a ball. -There's an important distinction there! All it knows it is doing is firing a -ball, it doesn't know what kind of ball, or where, or how big, or how much -damage. -The [[[[[BGF_FIRE,] bit is what tell us it is a fire ball. If it was -[[[[[BGF_COLD,] - we'd have a cold ball, or [[[[[BGF_CHAOS,] it would be a chaos ball and -so on and so on. A full list of those types can be found in *****lua_gf.txt*0[lua_gf.txt]. -[[[[[B dir,] is the direction, from the [[[[[Bget_aim_dir()] bit. -[[[[[B damage,] is the damage. As we've already said, this will be clvl*3. -[[[[[B 3)] is the radius. -and finally... - -#####B end, -#####B} - -[[[[[Bend,] tells it the function has ended. Every function must finish with -[[[[[Bend]. -You should have spotted that after the end of each attribute is a comma. Make -sure you include this, and don't forget the braces at the very very end to -close the [[[[[Badd_power] function. - -#####R=== Finishing the LUA file === - -Save this as a text file 'pheonix.lua' Put it into the lib\scrpt directory -of ToME, and open the init.lua file which you'll find in the same -directory. - -Add the following line and resave the init.lua file. - -#####Btome_dofile("pheonix.lua") - -This ensures that ToME loads your file on start-up. Because you've installed -the example scripts, this has all been done for you. - -#####R=== A quick word about comments === - -One of the reasons Angband has so many variants is because the source code is -clearly commented. Almost every line of code has an accompanying comment, -explaining what that line does. It's good practice to add comments to any code -or script you write. It's helpful to others who are learning, anyone who takes -over your project, and also to yourself when you come back in a month's time -and can't remember what you did! So comment your code clearly, and well! - -You can also add multi line comments which should be enclosed by [[[[[B--[[] -and -#####B]] - -#####R=== Tying it all together === - -You'll now need to link this 'U' power to the pheonix race via the -p_info.txt file. Simply add a line within the class definition file that has -the format [[[[[BR:Z:]the name of the power as it appears in the -[[[[[B"name"] -section we did right at the beginning, remember? Seeing as there is no pheonix -race, I've gone ahead and made one up as a demonstration. If you've downloaded -and installed the example files from [[[[[Ghttp://www.moppy.co.uk/angband.htm/] -then -you'll notice you already have the pheonix race available. Printed below is -the p_info.txt entry for it. - - -#####BR:N:23:Pheonix -#####BR:D:Born from flame, these powerful bird like creatures gain fire related -#####BR:D:abilities as they grow. -#####BR:S:1:0:2:1:-3:2:-5 -#####BR:K:-8:15:20:-10:5:-1:-5:-5 -#####BR:P:8:130:5:210 -#####BR:M:255:70:2:1:20:5:2:1:18:3 -#####BR:E:1:1:1:2:1:1 -#####BR:C:Warrior | Mage | Priest | Rogue | Ranger | Paladin | Blade | -#####BR:C:Warlock | Chaos-Warrior | Monk | Mindcrafter | High-Mage | -#####BR:C:BeastMaster | Alchemist | Power-Mage | Runecrafter | -#####BR:C:Sorceror | Archer | Illusionist | Druid | Necromancer | Black-Knight -| -#####BR:C:Daemonologist | Weaponmaster | Summoner | -#####BR:Z:Fire Ball -#####BR:R:1:0 -#####BR:F:RES_FIRE | FEATHER | - -Note the [[[[[BR:Z:] line. - -If all is well, you should be able to start ToME now and breathe fire! Once -you get to lvl 10 anyhow. Don't forget, this is the kind of thing wizard mode -was invented for! Ctrl-A and confirm at the prompt, and then 'e' will allow -you to alter stats, including experience. Approx 1000 exp should do to get you -to clvl 10. - -Ready for more? How about adding a new *****lua_skil.txt*0[skill] ? - - [[[[[gThis file by fearoffours (fearoffours@moppy.co.uk)] - - - - diff --git a/lib/mods/theme/help/lua_ques.txt b/lib/mods/theme/help/lua_ques.txt deleted file mode 100644 index 1d4b9c65..00000000 --- a/lib/mods/theme/help/lua_ques.txt +++ /dev/null @@ -1,299 +0,0 @@ -|||||oy -#####R /----------------------------------------\ -#####R < Adding a new quest > -#####R \----------------------------------------/ - -#####R=== Introduction === - -Adding a quest involves a bit more work, and there is, in some ways, rather -more potential for things to go wrong! But it's a great way of showing just -WHAT can be done with lua scripting. It proves just how much a lua patch can -change the overall feel of the game. And it will give you a much better idea of -how lua interfaces with the game source. You should have read the -*****lua_intr.txt*0[scripting introduction], *****lua_pow.txt*0[racial power tutorial] -and *****lua_skil.txt*0[adding new skills tutorial] before going much -further. All of the above files contain some fairly fundamental information -which you will find necessary for full understanding of this file. - -The script we're looking at is going to create a quest entrance in the middle -of Bree. Entering the quest you see a little girl who has had her necklace -stolen. Your job is to travel down a corridor, killing some monsters on the -way, pick up the amulet and return it to the girl. Once done, she'll reveal the -stairs back to Bree, and give you a (randomly generated) ring. If you feel the -monsters are too hard, the only thing to do is talk to the little girl who will -reveal the stairs again, failing the quest for you, and also block off the -entrance to the amulet so that you can't cheat and make off with the amulet! - -#####R=== Getting started === - -Open amulet.lua (you have downloaded the example scripts from -[[[[[Ghttp://www.moppy.co.uk/angband.htm], haven't you?). The first thing you -should see is that yet again we're calling a function that takes its arguments -from a table, making it easy to read what's going on in the script. - -This time our function is add_quest and we have the following keys and values: - -#####B["global"] = "AMULET_QUEST", -#####B["name"] = "Hannahs lost amulet", -#####B["desc"] = { -#####B "Retrieve an amulet for Hannah Cooke. It's guarded!" -#####B }, -#####B["level"] = 5, -#####B["hooks"] = { - -[[[[[B"global" = ] is a constant that we set when we refer to this quest in -various places... -[[[[[B"name" = ] Obviously a long name for the quest. This will appear in the -quest screen (Ctrl-Q) and we may use in some map files too. -[[[[[B"desc" = ] This is a long description for the quest. Again this is what -will appear in the quest screen, and each line should be not more than 80 -characters. -[[[[[B"level" = ] This is a rough indicator of how hard the quest is, and again, -appears in the quest screen -[[[[[B"hooks" = ] This is the real 'meat' of the quest. Like the [[[[[B"spell_list"] key -in the [[[[[Badd_magic] function, this is another sub-table. - -To understand fully the structure of the "hooks" key it's worth taking a bit of -a detour at this point and discussing how the scripting interface works in -general. - -#####R=== How the scripts work (ish) === - -Essentially there's a list of events that happen in the game. As each of these -events happen they run a check to see if there's any functions that they need -to run at that event. When we ran the add_mkey part of adding a new skill -power, we essentially said "when the 'm' key is pressed in the game, perform -the [[[[[Bexecute_magic(constructor_powers)] function". Likewise we did a similar -thing with adding the racial power, only we hooked onto the pressing of the -'U' key. - -All of this was partly hidden because of the way that the [[[[[Badd_magic] and -[[[[[Badd_power] functions work. But here in the [[[[[Badd_quest] function it's a bit more -specific. We are going to specify what events we're going to hook onto, and -what functions we want to trigger at that event. - -A full list of hooks can be found in the source-file util.pkg. - -#####R=== The hooks === - -#####B[HOOK_BIRTH_OBJECTS] = function() -#####B quest(AMULET_QUEST).status = QUEST_STATUS_TAKEN -#####Bend, - -So here we are with our first hook. We've declared that we're adding it to the -birth of your character. That is, the function will be called when you create -your character. And what we're doing here is automatically declaring the quest -as being taken, like the Dol Guldur quest is. Each quest has 7 different -statuses: - -[[[[[BQUEST_STATUS_IGNORED -1 ] This is unused, but the quest is -ignored (will not be taken and has not been taken). -[[[[[BQUEST_STATUS_UNTAKEN 0 ] The quest has not been accepted yet -[[[[[BQUEST_STATUS_TAKEN 1 ] You have accepted the quest -[[[[[BQUEST_STATUS_COMPLETED 2 ] You have completed the quest -successfully but not been rewarded for it -[[[[[BQUEST_STATUS_REWARDED 3 ] You've completed and rewarded the quest -[[[[[BQUEST_STATUS_FAILED 4 ] You've failed the quest -[[[[[BQUEST_STATUS_FINISHED 5 ] The quest is completely finished -successfully. -[[[[[BQUEST_STATUS_FAILED_DONE 6 ] The quest is completely finished -unsuccessfully. - -You see that we've used the constant we defined in the "global" section is -passed as an argument to [[[[[Bquest.status]. - -Next hook then: - -#####B[HOOK_GEN_QUEST] = function() -#####B if (player.inside_quest ~= AMULET_QUEST) then -#####B return FALSE -#####B else -#####B load_map("amulet.map", 2, 2) -#####B return TRUE -#####B end -#####Bend, - -Ok, we're hooking onto the generation of the quest here. This is specifically -triggered in this instance by going down the quest entrance stairs in Bree. -Once you've gone down the stairs, you are technically inside the quest, which -means we can say if the person is not inside the amulet quest, then ignore this -function, otherwise load the file 'amulet.map' at co-ordinates x=2 y=2. You'll -find the amulet.map file in the edit directory, make sure you check it out. The -syntax for map files is fairly simple, though I might get round to writing a -tutorial on them some day! In the mean time holler for me at the usual email -address if you're unsure. - -#####B[HOOK_FEELING] = function() -#####B if (player.inside_quest ~= AMULET_QUEST) then -#####B return FALSE -#####B else -#####B cmsg_print(TERM_L_BLUE, "Hannah speaks to you:") -#####B cmsg_print(TERM_YELLOW, "'Some nasty monsters stole my -#####B favourite necklace.'") -#####B cmsg_print(TERM_YELLOW, "'It's hidden at the back of that -#####B corridor! Please fetch it for me'") -#####B return TRUE -#####B end -#####Bend, - -We're moving into some rather more obvious territory here, and getting into the -meat of the quest. The [[[[[BHOOK_FEELING] is triggered at the point when the level -feeling appears. It's important that this is run only if the player is inside -the amulet quest, as otherwise it will trigger EVERY time a level feeling -occurs, when you go down a level in the barrow-downs, whenever! Returning TRUE -will replace the level feeling with what's above, returning FALSE will still -perform the function but will amend the normal level feeling - so here if we'd -returned false we'd still get our custom messages, but they'd follow with -'looks like a typical quest level'. Of course returning false may cause you -other problems (see end of this file!) depending on what else you have in your -function. - -#####B[HOOK_GIVE] = function(m_idx, item) - -#####B m_ptr = monster(m_idx) -#####B o_ptr = get_object(item) - -#####B if (m_ptr.r_idx == test_monster_name("Hannah Cooke, a little girl")) -#####B and (o_ptr.tval == TV_AMULET) and (o_ptr.sval == 2) then - -#####B cmsg_print(TERM_YELLOW, "'Thank-you!'") - -#####B inven_item_increase(item, -1) -#####B inven_item_optimize(item) - -#####B quest(AMULET_QUEST).status = QUEST_STATUS_COMPLETED - -#####B cave_set_feat(7, 6, 6) - -#####B cmsg_print(TERM_YELLOW, "'Here, take this pretty ring I found -#####B as a token of gratitude!'") -#####B random_type = randint(57) -#####B reward = create_object(TV_RING, random_type) -#####B drop_near(reward, -1, py, px) -#####B quest(AMULET_QUEST).status = QUEST_STATUS_REWARDED -#####B return TRUE -#####B else -#####B return FALSE -#####B end -#####Bend, - -This is a fairly long function, but don't be intimidated. It's not really -difficult to understand. As you can see we're hooking into the giving of an -object to a monster (the 'y' key). Because of this, the function takes two -arguments - [[[[[Bm_idx] (the monster that you're giving to) and [[[[[Bitem] (the item that -you're giving). - -We then make it possible to work with the monster and item variables by -referencing them to two functions which identify them from the edit files: -[[[[[Bmonster()] and [[[[[Bget_object()]. This enables us to now say, 'if the name of the -monster is "Hannah Cooke, a little girl" and the type of item is an amulet and -that amulet is an amulet of adornment, then carry out the following commands'. - -We then say call the function [[[[[Binven_item_increase()] which places an object in -the inventory. It takes two arguments, the first being what object to put in -the inventory and the second being how many of that type of objects to put in -the inventory. You can see that by placing -1 as the second argument it fairly -obviously subtracts that item from the inventory. The [[[[[Binven_item_optimize()] -function checks that there are no empty inventory slots, and if there are, -erases them. - -The quest is then completed, and the stairs are revealed using the -[[[[[Bcave_set_feat()] function. This function takes three arguments, the first is the -x co-ordinate of the cave square you wish to change (counted from top left) the -second is the y co-ordinate, and the third is the index number of the feature -you wish the square to become as defined in f_info.txt. - -We then set about rewarding the player. As you can see we call [[[[[Bcreate_object()] -which takes two variables: the first is the type of object (these are all -listed in object.pkg) and the second is the sub-type of that object. I searched -k_info.txt to see how many different types of ring there were (57) and used a -randomly selected number with a maximum value of 57 as that specific sub-type. - -We then drop the object (although it's been created, it has only been created -in the game's memory, it's nowhere that the player can interact with it until -we drop it). The [[[[[Bdrop_near()] function takes 3 variables, the first being the -object that you wish to drop, the second being the chance that it disappears -(like an arrow, or mimicked creature) on drop. If you set it to -1, it won't -ever disappear. The last two are the co-ordinates at which the object will be -dropped. py and px are the global variables defined by where the player is -standing, so in this case it will drop under the player. You could do -[[[[[Binven_item_increase(reward, 1)] if you wanted, but I wanted to show a variety of -ways of handling objects. - -OK, let's take a look at the next hook: - -#####B[HOOK_CHAT] = function(m_idx) -#####B m_ptr = monster(m_idx) -#####B if (m_ptr.r_idx == test_monster_name("Hannah Cooke, a little girl")) then -#####B if (quest(AMULET_QUEST).status == QUEST_STATUS_REWARDED) then -#####B cmsg_print(TERM_YELLOW, "'Bye!'") -#####B else -#####B cmsg_print(TERM_YELLOW, "'Are the monsters too tough? -#####B Do you want to leave?'") -#####B if (get_check("Really leave and fail the quest?") == -#####B FALSE) -#####B then -#####B cmsg_print(TERM_YELLOW, "'Go and get my -#####B amulet then!'") -#####B else -#####B cmsg_print(TERM_YELLOW, "'Awww. Never -#####B mind. It was only a bit of rabbits foot'") -#####B quest(AMULET_QUEST).status = -#####B QUEST_STATUS_FAILED -#####B cave_set_feat(7, 6, 6) -#####B cave_set_feat(12, 5, 60) -#####B end -#####B end -#####B return TRUE -#####B end -#####B return FALSE -#####Bend, - -This only looks complicated because of the nested 'if' statements. It's easy to -lose your way when doing this kind of thing, always make sure you close all the -statements and put the returns in the right place. [[[[[BHOOK_CHAT] functions have one -argument - the monster you are chatting to. As you can see, we perform a check -to make sure it's the right monster and then away we go.... If the player wants -to leave the quest without completion they talk to Hannah, who gives them a -chance to change their mind! If the player asks to leave the entrance to the -corridor is blocked off (the second cave_set_feat()) so that the user can't -then go and get the amulet. Gumband or Zangband players may at this point think -they've lost out on the rabbits foot of burglary! (they haven't though as it -doesn't exist in ToME). - -#####B[HOOK_CHAR_DUMP] = function() -#####B if (quest(AMULET_QUEST).status == QUEST_STATUS_FAILED) then -#####B print_hook("\n You chickened out of rescuing a necklace and -#####B made a little girl sad. ") -#####B elseif (quest(AMULET_QUEST).status == QUEST_STATUS_COMPLETED) or -#####B (quest(AMULET_QUEST).status == QUEST_STATUS_REWARDED) or -#####B (quest(AMULET_QUEST).status == QUEST_STATUS_FINISHED) then -#####B print_hook("\n You rescued little Hannah Cooke's necklace from -#####B the nasty monsters ") -#####B end -#####B return FALSE -#####Bend, - -This quite simply and obviously prints an appropriate line in the character -dump based on the status of the quest. The [[[[[B\n] bit ensures the text goes on a -new line, so make sure you include it! Also you should return FALSE as -returning TRUE will stop executing all the other character dump lines (and you -may get other quests not having their lines printed). - -=== A word about returning TRUE and FALSE === - -As I mentioned above, you need to be careful what you return when dealing with -HOOKS as you can mess up the game a bit. Bear in mind that if you add a -function to [[[[[BHOOK_GEN_QUEST], every time a quest is generated, that function will -run. If you return TRUE, then no further functions attached to that hook will -run. If you return FALSE, it continues processing functions on that hook. - -That is pretty much it. Do take a look at the other included scripts that I -haven't gone into any detail about in the files, as you'll pick up some useful -techniques there too. Especially worthy of note is the hina.lua file which uses -hooks outside of the quest structure and also global variables and variables in -a table. If you have any questions, let me know at the email addy below. - -Back to the *****lua.hlp*0[lua help index] . - - [[[[[gThis file by fearoffours (fearoffours@moppy.co.uk)] diff --git a/lib/mods/theme/help/lua_skil.txt b/lib/mods/theme/help/lua_skil.txt deleted file mode 100644 index 87385e5d..00000000 --- a/lib/mods/theme/help/lua_skil.txt +++ /dev/null @@ -1,342 +0,0 @@ -|||||oy -#####R /----------------------------------------\ -#####R < Adding new skill-based powers > -#####R \----------------------------------------/ - -#####R=== Introduction === - -This is very much in the same vein as adding a racial/extra power, but has to -be tied into skills, and we're defining more than one spell at once. You should -have read the *****lua_intr.txt*0[scripting introduction] and -*****lua_pow.txt*0[racial power tutorial] before going much further. Both of the above files -contain some fairly fundamental information which you will find necessary for -full understanding of this file. - -#####R=== Getting started === - -Open construc.lua (you have downloaded the example scripts from -[[[[[Ghttp://www.moppy.co.uk/angband.htm], haven't you?). The idea behind this -script is that it adds a skill which affects you ability to build/knock down -stuff. It treats the equivalent of stone-to-mud and trap-door destruction -spells as if they were "building skills". It also adds quite a few high-level -'spells' which do funky things like carving out corridors and chambers in a -single turn, and building doors and stuff. Just think of it as if the person -who has plenty of skills in this area would be a builder-type with lots of -strength and constitution... - -In order to add these powers we're going to edit the s_info.txt file which -lives in the edit folder, and add a new skill, underneath the 'misc' tree, -called construction. The powers will then be accessed through the 'm' menu, in -a similar way to mindcraft or alchemy skills or such. (That is, no books are -needed to cast them, as we're treating them as a craft that has been learnt, -rather than spells.) Our fist line of the script file reads: - -#####BSKILL_CONSTRUCT = 57 - -This merely links the skill index that we'll be defining in s_info.txt to this -file. We'll come back to this at the end of the tutorial. - -#####Bconstructor_powers = add_magic - -In a similar way to the [[[[[Badd_power] function we called when we added the -Phoenix racial ability, this line calls a special function which we use to -define new skills. It follows a very specific, but easy to understand form. It -starts with a brace, which indicates the add_magic function will be storing -these values in a table. Don't worry about this too much, but understand that a -table starts and ends with braces [[[[[B{] and [[[[[B}] respectively. Each key -(or field name) takes the format [[[[[B"key" = value,] (the comma is -important!). - -#####B ["fail"] = function() -#####B msg_print("You decide now is a good time for a cuppa") -#####B end, -#####B ["stat"] = A_STR, -#####B ["get_level"] = function() -#####B return get_skill_scale(SKILL_CONSTRUCT, 50) -#####B end, -#####B ["spell_list"] = - -[[[[[B"fail"] is a function that is called whenever you ##fail to cast the -spells##. Here it does nothing spectacular. -[[[[[B"stat"] defines the stat used to cast the spells. Here it is strength. -Any other stat can be used, prefix it with [[[[[BA_]. -[[[[[B"get_level"] is used to determine the level of the spell. It's associated -with spells that increase in power the more points that are invested in the -associated skill. I know that's not terribly clear, I'll come back to it in a -moment. -[[[[[B"spell_list"] is just that, a list of all the spells. -Each of these four properties within the table must end with a comma. If a -function is defined in the property itself then we add the comma after the -closing [[[[[Bend]. Again compare with construct.lua to see it. Any line NOT -ending with a comma will cause a lua error on startup, probably of the type -[[[[[V'}' expected to close '{' at line .] - -#####R=== The spell list === - -Each spell, within the [[[[[B"spell_list"] key has its own set of properties -that we need to define from a sub-table so we open another set of braces to -start the spell list, and then a third set of braces to start the first spell. -So with all this, our first spell looks like: - -#####B ["spell_list"] = -#####B { -#####B { -#####B ["name"] = -#####B ["desc"] = -#####B ["mana"] = -#####B ["level"] = -#####B ["fail"] = -#####B ["spell"] = -#####B ["info"] = -#####B }, - -[[[[[B"name"] is, as you would expect, the name of the spell, as you want it to -appear in the spell list when choosing a spell. The maximum number of -characters for this is 29. -[[[[[B"desc"] is the description received when you hit the capital letter of -that spell in the menu. (i.e., press 'a' to cast the first spell, but press 'A' -to receive info about the first spell. -[[[[[B"mana"] is the amount of mana required to cast the spell. -[[[[[B"level"] is the level required to use that spell (that's level of the (in -this case construction) skill, not character level!). -[[[[[B"fail"] is base fail rate. -[[[[[B"spell"] is the function that is executed when the spell is cast. Note -that it MUST take the form [[[[[Bfunction() blah end] even if you're calling -a C function directly. If you have a look at the end of the file, you'll see -the "rebuild dungeon" spell which is identical to the "alter_reality" spell. -However, rather than reading [[[[[B"spell" = alter_reality()], it reads: - -#####B["spell"] = function() -#####B alter_reality() -#####Bend, - -which appears to be a long way round to do the same thing, but this is how it -must be done. - -In a similar way, the [[[[[B"info"] key must begin with a [[[[[Bfunction()] -and return the value of what is to be displayed alongside the spell name, -level and mana in the spell list. The maximum number of characters that can be -displayed here is dependent on the width of the user's screen, but try to keep -it under 12 if you can, as this will fit in a standard 80x24 terminal screen. -The first character will need to be a space otherwise you'll have the info line -squashed right up against the fail rate and it will look odd. If you wish to -have this part blank in the spell list, you still need to return a value, so -just a single space will do : [[[[[Breturn " "] - -All of these keys are repeated for each spell, with each spell in its own -table (therefore, it's own set of braces). Again, check the lua file for -clarification. - -When entering the spells in the "spell_list", you must take care to specify -them in the order which they are gained, otherwise they display incorrectly in -the spell list. - -You should by now be experienced enough to understand most of what's going on -in the actual spell functions (especially if you dig around in the source a -bit, and check out Chris Hadgis' excellent *****lua_spel.txt*0[spell.pkg] helper -files. I'm not going to go through the whole file line by line, as this is -something you should do yourself, figuring out what's going on. I'm going to -examine a few of the things we haven't covered before though, so pay attention. - -#####R=== The get_level() function === - -Probably one of the most important functions that you see reappearing in the -file is the [[[[[Bget_level()] function. All this does is return the numerical -value of the power that is given as the first argument. So [[[[[Bget_level] -[[[[[B(constructor_power)] will return the current level of the constructor power. -Given that the level of this is taken directly from the construction skill, (we -defined that in the [[[[[B"get_level"] key, by saying [[[[[Bget_skill_scale] -[[[[[B(SKILL_CONSTRUCT, 50)] ) it will return the value of your construction skill. -[[[[[Bconstructor_power] is the name of the whole power, we named it thus on -the second line of the script! - -[[[[[Bget_level] takes the following arguments: [[[[[Bget_level(power, max, ] -[[[[[Bmin)]. The power is obviously which power we're taking the value from, and the -max and min allow you to define boundaries for the spell. For instance the -current maximum value that [[[[[Bget_level(constructor_power)] can return is -50, as that is the maximum number of skill points you can have in that skill. -If you were using this as the basis for the damage of a low-level bolt spell, -you might decide that having a damage of 50 would be too much (unlikely, but -still possible). You could therefore define a maximum value of 20 so that when -the value of the construction skill was over 50, the maximum value for -damage of that spell would be 20. To achieve this you'd have: -[[[[[Bget_level(constructor_power, 20)]. In a similar way, you can force the -minimum value of the spell to be higher than the actual construction skill -level, with a [[[[[Bget_level(constructor_power, 50, 15)]. This would be useful -say for spells that you wanted to be available when the construction skill -level reaches 10, but for whom you wanted a (for example) base damage of 15 -right from the word go. These re-scale values rather than capping them! - -You can leave out the minimum value as I have done above. You can also leave -the maximum value out (it will default to 50). If you want to specify a minimum -value though, you MUST specify a maximum value as well. - -As you have hopefully been able to tell, the [[[[[Bget_level()] function -enables us to have spells that increase in usefulness as you gain levels. Let's -take the "Dismantle" spell. The function in the [[[[[B"spell"] key is as -follows: - -#####Bfunction() -#####B local ret, dir, dam - -#####B if (get_level(constructor_powers, 50) >= 11) then -#####B ret, dir = get_aim_dir(); -#####B if (ret == FALSE) then return end -#####B fire_beam(GF_KILL_TRAP, dir, 1) -#####B else -#####B fire_ball(GF_KILL_TRAP, 0, 1, 1) -#####B end -#####Bend, - -The [[[[[Bif] statement is obviously what really interests us here. You'll -notice that this has the amendment of an [[[[[Belse] clause, which the [[[[[Bif] -statement we used in the previous tutorial did not. As you would expect, if the -condition on the first line of this statement is met, then the instructions -immediately below it are carried out. If the condition is not met, then the -statements that follow the [[[[[Belse] are executed. - -Coming back to the [[[[[Bget_level] function, we learnt from above, that the -[[[[[Bget_level] part of this function translates as, "if the value of the -construction_power level (which happens to be identical to the construction -skill level) is greater than or equal to 11, cast a beam of trap disarming in -the specified direction. (The first part of this is all straightforward, -getting a direction, and cancelling correctly if the player presses 'ESC'.) -Otherwise, cast a ball of trap disarming with a radius of one, centred on the -player." - -In the same way, as you look at the construc.lua file, you will see that -[[[[[Bget_level()] is used many times in this way, to increase the power of -detection spells, to change bolt spells to ball spells, to keep a constantly -increasing damage going, and so on. - -#####R=== Elseif's and things === - -If you want to provide more than one alternative condition, in an -[[[[[Bif-then-else] statement, you can use [[[[[Belseif]s which do what you -might expect. Take a look at the first spell, "Survey area", for an example of -this: - -#####Bif (get_level(constructor_powers, 50) >= 28) then -#####B wiz_lite() -#####Belseif (get_level(constructor_powers, 50) >= 15) then -#####B map_area() -#####B detect_traps(DEFAULT_RADIUS) -#####Belseif (get_level(constructor_powers, 50) >= 5) then -#####B detect_traps(DEFAULT_RADIUS) -#####B detect_stairs(DEFAULT_RADIUS) -#####B detect_doors(DEFAULT_RADIUS) -#####Belse -#####B detect_stairs(DEFAULT_RADIUS) -#####B detect_doors(DEFAULT_RADIUS) -#####Bend - -If the level of constructor powers is greater or equal to 28, then the function -[[[[[Bwiz_lite()] is performed, and no other part of the if statement is -executed. [[[[[Bwiz_lite()] is just the enlightenment spell. If it is less than -28, the next condition is examined: that if the level of constructor powers is -greater than or equal to 15, then [[[[[Bmap_area()](Magic mapping) and detect -traps are called. If the level of constructor power is less than 15, it moves -onto the next condition, which says that if the level of constructor power is -greater than 5, then detect stairs, traps and doors. If none of these -conditions are met,(that is, if the level of construction skill is less than 5) -then we just detect doors and stairs. - -You'll note that each of the detection spells includes a DEFAULT_RADIUS -constant. You could change this to a numerical value, or a variable defined -somewhere else in your script. eg [[[[[Bdetect_traps(2)] would detect traps -with a radius of 2 centred on the player. - -#####R=== Registering the skill type === - -This is what we do at the end of the file, and is what ties the powers we've -defined to the action of pressing the 'm' key in game. Once more we're calling -a special function [[[[[Badd_mkey()] which takes its arguments for a table. -There are only two keys in this table though which keeps things simple. - -#####Badd_mkey -#####B{ -#####B ["mkey"] = MKEY_CONSTRUCT_POWERS, -#####B ["fct"] = function() -#####B execute_magic(constructor_powers) -#####B energy_use = energy_use + 100; -#####B end -#####B} - -[[[[[B"mkey"] must be a UNIQUE value > 1000 . Here I've defined it as a -constant, [[[[[BMKEY_CONSTRUCT_POWERS], which has the value 1004. This value -we'll call again in the s_info.txt file. -[[[[[B"fct"] is the function that's called when the user presses the key in the -'m' menu. So here, it calls the [[[[[Bexecute_magic] function which actually -displays a list of powers for the user to choose from. The argument it takes is -the powers it will use (alchemy, mindcraft, etc., or in this case constructor), -and then the [[[[[Benergy_use] line tells the game to take one game turn to do -the action. - -#####R=== Adding the skill in s_info.txt === - -Take a look in the s_info.txt file, under the Misc section. You'll see, - -#####BN:57:Construction -#####BD:Ability to use constructor powers -#####BD:Construction powers use strength -#####BA:1004:Build or knock down stuff -#####BI:1000 - -The first line is the index of the skill; again this must be unique. The second -property is the name of the skill. The [[[[[BD] lines are the lines displayed -when the skill is highlighted in the skill screen. -The first entry on the [[[[[BA] line is the value of the [[[[[B"mkey"] we -defined in the [[[[[Badd_mkey] function in our script. The second entry is the -display for selecting the construction power in the 'm' menu. -The [[[[[BI] line is currently unused, but add a 1000 there anyway. That's what -all the others have so when it's introduced, at least it will affect your -powers identically to how it affects all the other powers. - -If you scroll to the very bottom of the file now, you'll see I've placed the -skill at the bottom of the Misc branch of the skills tree. I then made a new -class, constructor, which you can see in p_info.txt. - -That is all that is NEEDED when writing a script to add a skill - defining an -mkey using add_mkey, and defining any powers that are called in the -[[[[[B"fct"] (generally using [[[[[Badd_magic] ). - -And I've added the line - -#####Btome_dofile("construc.lua") - -in init.lua so the script is loaded on start-up! - -Below I'm going to talk in depth about a few other functions that you may find -useful in your scripting. - -#####R=== fire_bolt() and fire_beam() === - -In the last help file we looked at the routine for firing a ball - -[[[[[Bfire_ball()]. Here's a quick note about beams and bolts... -[[[[[Bfire_beam()] and [[[[[Bfire_bolt()] take 2 arguments: -[[[[[B(type, direction, damage)]. So in the dismantle spell we have the -direction passed from [[[[[Bget_aim_dir()] (the function that asks the player -for a direction), the type of damage is [[[[[BGF_KILL_TRAP], which as you might -expect disarms traps. And the damage is only 1 because it's not going to hurt -monsters, just dismantle traps. - -#####R=== set_oppose_elec() === - -OK here's another thing. Wander on down to the sparky_skills spell. After the -appropriate bolt/ball is fired, we have the line: - -#####Bif player.oppose_elec == 0 then -#####B set_oppose_elec(randint(10) + 20 + get_level(constructor_powers, 20)*3) -#####Bend - -This is the bit that grants temporary resist electricity. We've called the -function [[[[[Bset_oppose_elec(turns)], which sets the player's resist -electricity to "on" for the time specified in the argument "turns". We're only -calling this if the player is not already granted temporary resist electricity, -and we've linked the number of turns it is active to the level of the -construction skill. I've limited the maximum value of get_level to 20 in this -instance. A similar idea can be used for temporarily granting levitation, -extended infravision, protection against evil, resist fire, stuns, cuts and so -on and so on. Have a look in player.pkg in the source for a full list.... - - [[[[[gThis file by fearoffours (fearoffours@moppy.co.uk)] diff --git a/lib/mods/theme/help/lua_spel.txt b/lib/mods/theme/help/lua_spel.txt deleted file mode 100644 index aa4a532b..00000000 --- a/lib/mods/theme/help/lua_spel.txt +++ /dev/null @@ -1,2150 +0,0 @@ -|||||oy - -#####R /----------------------------------------\ -#####R < spell.pkg functions helper file > -#####R \----------------------------------------/ - ----------------------------------------------------------------------- - -#####R=== teleport_player_directed === - -#####GDeclaration - extern void teleport_player_directed(int rad, int dir); - -#####GFile - spells1.c - -#####GComment -/* - * Teleport player, using a distance and a direction as a rough guide. - * - * This function is not at all obsessive about correctness. - * This function allows teleporting into vaults (!) - */ - -#####GDescription -Teleport a player up to "rad" grids away roughly in "dir" direction. - -#####GParameters -> "rad" must not exceed 200. The distance teleported is a minimum of a - quarter of "rad". -> "dir" must be from 0 to 9. - *****fields.txt*0[direction] - ----------------------------------------------------------------------- - -#####R=== teleport_away === - -#####GDeclaration - extern void teleport_away(int m_idx, int dis); - -#####GFile - spells1.c - -#####GComment -/* - * Teleport a monster, normally up to "dis" grids away. - * - * Attempt to move the monster at least "dis/2" grids away. - * - * But allow variation to prevent infinite loops. - */ - -#####GDescription -Teleport monster indicated by "m_idx" up to "dis" grids away. - -#####GParameters -> "m_idx" is the index of the monster in m_list[]. -> "dis" must not exceed 200. The distance teleported is a minimum of a - quarter of "dis". - ----------------------------------------------------------------------- - -#####R=== teleport_player === - -#####GDeclaration - extern void teleport_player(int dis); - -#####GFile - spells1.c - -#####GComment -/* - * Teleport the player to a location up to "dis" grids away. - * - * If no such spaces are readily available, the distance may increase. - * Try very hard to move the player at least a quarter that distance. - */ - -#####GDescription -Teleport player up to "dis" grids away. - -#####GParameters -> "dis" must not exceed 200. The distance teleported is a minimum of a - quarter of "dis". - ----------------------------------------------------------------------- - -#####R=== teleport_player_to === - -#####GDeclaration - extern void teleport_player_to(int ny, int nx); - -#####GFile - spells1.c - -#####GComment -/* - * Teleport player to a grid near the given location - * - * This function is slightly obsessive about correctness. - * This function allows teleporting into vaults (!) - */ - -#####GDescription -Teleport player to a grid near the given location ("ny", "nx"). If -the location is empty, the player goes there, otherwise they go to -a grid as close as possible to the location. - -#####GParameters -> "ny" is the y co-ordinate of the location. -> "nx" is the x co-ordinate of the location. - ----------------------------------------------------------------------- - -#####R=== teleport_monster_to === - -#####GDeclaration - extern void teleport_monster_to(int m_idx, int ny, - int nx); - -#####GFile - spells1.c - -#####GComment -/* - * Teleport a monster to a grid near the given location - * - * This function is slightly obsessive about correctness. - */ - -#####GDescription -Teleport monster indicated by "m_idx" to a grid near the given -location ("ny", "nx"). If the location is empty, the monster goes -there, otherwise they go to a grid as close as possible to the -location. - -#####GParameters -> "m_idx" is the index of the monster in m_list[]. -> "ny" is the y co-ordinate of the location. -> "nx" is the x co-ordinate of the location. - ----------------------------------------------------------------------- - -#####R=== teleport_player_level === - -#####GDeclaration - extern void teleport_player_level(void); - -#####GFile - spells1.c - -#####GComment -/* - * Teleport the player one level up or down (random when legal) - */ - -#####GDescription -Teleport the player one level up or down at random. - ----------------------------------------------------------------------- - -#####R=== recall_player === - -#####GDeclaration - extern void recall_player(void); - -#####GFile - spells1.c - -#####GComment -/* - * Recall the player to town or dungeon - */ - -#####GDescription -Recall the player to town (if in dungeon) or dungeon (if in town). - ----------------------------------------------------------------------- - -#####R=== take_hit === - -#####GDeclaration - extern void take_hit(int damage, cptr kb_str); - -#####GFile - spells1.c - -#####GComment -/* - * Decreases players hit points and sets death flag if necessary - * - * XXX XXX XXX Invulnerability needs to be changed into a "shield" - * - * XXX XXX XXX Hack -- this function allows the user to save (or quit) - * the game when he dies, since the "You die." message is shown before - * setting the player to "dead". - */ - -#####GDescription -Reduce the player's current hit points by "damage" points. If the -player dies, "kb_str" is used to record what the player was killed by -(see high-score table). - -#####GParameters -> "damage" is the amount of damage. -> "kb_str" is a string describing what killed the player. - ----------------------------------------------------------------------- - -#####R=== take_sanity_hit === - -#####GDeclaration - extern void take_sanity_hit(int damage, cptr hit_from); - -#####GFile - spells1.c - -#####GComment -/* Decrease player's sanity. This is a copy of the function above. */ - -#####GDescription -Reduce the player's current sanity points by "damage" points. If the -player dies, "hit_from" is used to record what the player was killed -by (see high-score table). - -#####GParameters -> "damage" is the amount of damage. -> "hit_from" is a string describing what killed the player. - ----------------------------------------------------------------------- - -#####R=== project === - -#####GDeclaration - extern bool project(int who, int rad, int y, int x, - int dam, int typ, int flg); - -#####GFile - spells1.c - -#####GComment -/* - * Generic "beam"/"bolt"/"ball" projection routine. - * - * Input: - * who: Index of "source" monster (negative for "player") - * jk -- -2 for traps, only used with project_jump - * rad: Radius of explosion (0 = beam/bolt, 1 to 9 = ball) - * y,x: Target location (or location to travel "towards") - * dam: Base damage roll to apply to affected monsters (or player) - * typ: Type of damage to apply to monsters (and objects) - * flg: Extra bit flags (see PROJECT_xxxx in "defines.h") - * - * Return: - * TRUE if any "effects" of the projection were observed, else FALSE - * - * Allows a monster (or player) to project a beam/bolt/ball of a given kind - * towards a given location (optionally passing over the heads of interposing - * monsters), and have it do a given amount of damage to the monsters (and - * optionally objects) within the given radius of the final location. - * - * A "bolt" travels from source to target and affects only the target grid. - * A "beam" travels from source to target, affecting all grids passed through. - * A "ball" travels from source to the target, exploding at the target, and - * affecting everything within the given radius of the target location. - * - * Traditionally, a "bolt" does not affect anything on the ground, and does - * not pass over the heads of interposing monsters, much like a traditional - * missile, and will "stop" abruptly at the "target" even if no monster is - * positioned there, while a "ball", on the other hand, passes over the heads - * of monsters between the source and target, and affects everything except - * the source monster which lies within the final radius, while a "beam" - * affects every monster between the source and target, except for the casting - * monster (or player), and rarely affects things on the ground. - * - * Two special flags allow us to use this function in special ways, the - * "PROJECT_HIDE" flag allows us to perform "invisible" projections, while - * the "PROJECT_JUMP" flag allows us to affect a specific grid, without - * actually projecting from the source monster (or player). - * - * The player will only get "experience" for monsters killed by himself - * Unique monsters can only be destroyed by attacks from the player - * - * Only 256 grids can be affected per projection, limiting the effective - * "radius" of standard ball attacks to nine units (diameter nineteen). - * - * One can project in a given "direction" by combining PROJECT_THRU with small - * offsets to the initial location (see "line_spell()"), or by calculating - * "virtual targets" far away from the player. - * - * One can also use PROJECT_THRU to send a beam/bolt along an angled path, - * continuing until it actually hits something (useful for "stone to mud"). - * - * Bolts and Beams explode INSIDE walls, so that they can destroy doors. - * - * Balls must explode BEFORE hitting walls, or they would affect monsters - * on both sides of a wall. Some bug reports indicate that this is still - * happening in 2.7.8 for Windows, though it appears to be impossible. - * - * We "pre-calculate" the blast area only in part for efficiency. - * More importantly, this lets us do "explosions" from the "inside" out. - * This results in a more logical distribution of "blast" treasure. - * It also produces a better (in my opinion) animation of the explosion. - * It could be (but is not) used to have the treasure dropped by monsters - * in the middle of the explosion fall "outwards", and then be damaged by - * the blast as it spreads outwards towards the treasure drop location. - * - * Walls and doors are included in the blast area, so that they can be - * "burned" or "melted" in later versions. - * - * This algorithm is intended to maximise simplicity, not necessarily - * efficiency, since this function is not a bottleneck in the code. - * - * We apply the blast effect from ground zero outwards, in several passes, - * first affecting features, then objects, then monsters, then the player. - * This allows walls to be removed before checking the object or monster - * in the wall, and protects objects which are dropped by monsters killed - * in the blast, and allows the player to see all affects before he is - * killed or teleported away. The semantics of this method are open to - * various interpretations, but they seem to work well in practice. - * - * We process the blast area from ground-zero outwards to allow for better - * distribution of treasure dropped by monsters, and because it provides a - * pleasing visual effect at low cost. - * - * Note that the damage done by "ball" explosions decreases with distance. - * This decrease is rapid, grids at radius "dist" take "1/dist" damage. - * - * Notice the "napalm" effect of "beam" weapons. First they "project" to - * the target, and then the damage "flows" along this beam of destruction. - * The damage at every grid is the same as at the "centre" of a "ball" - * explosion, since the "beam" grids are treated as if they ARE at the - * centre of a "ball" explosion. - * - * Currently, specifying "beam" plus "ball" means that locations which are - * covered by the initial "beam", and also covered by the final "ball", except - * for the final grid (the epicentre of the ball), will be "hit twice", once - * by the initial beam, and once by the exploding ball. For the grid right - * next to the epicentre, this results in 150% damage being done. The centre - * does not have this problem, for the same reason the final grid in a "beam" - * plus "bolt" does not -- it is explicitly removed. Simply removing "beam" - * grids which are covered by the "ball" will NOT work, as then they will - * receive LESS damage than they should. Do not combine "beam" with "ball". - * - * The array "gy[],gx[]" with current size "grids" is used to hold the - * collected locations of all grids in the "blast area" plus "beam path". - * - * Note the rather complex usage of the "gm[]" array. First, gm[0] is always - * zero. Second, for N>1, gm[N] is always the index (in gy[],gx[]) of the - * first blast grid (see above) with radius "N" from the blast centre. Note - * that only the first gm[1] grids in the blast area thus take full damage. - * Also, note that gm[rad+1] is always equal to "grids", which is the total - * number of blast grids. - * - * Note that once the projection is complete, (y2,x2) holds the final location - * of bolts/beams, and the "epicentre" of balls. - * - * Note also that "rad" specifies the "inclusive" radius of projection blast, - * so that a "rad" of "one" actually covers 5 or 9 grids, depending on the - * implementation of the "distance" function. Also, a bolt can be properly - * viewed as a "ball" with a "rad" of "zero". - * - * Note that if no "target" is reached before the beam/bolt/ball travels the - * maximum distance allowed (MAX_RANGE), no "blast" will be induced. This - * may be relevant even for bolts, since they have a "1x1" mini-blast. - * - * Note that for consistency, we "pretend" that the bolt actually takes "time" - * to move from point A to point B, even if the player cannot see part of the - * projection path. Note that in general, the player will *always* see part - * of the path, since it either starts at the player or ends on the player. - * - * Hack -- we assume that every "projection" is "self-illuminating". - * - * Hack -- when only a single monster is affected, we automatically track - * (and recall) that monster, unless "PROJECT_JUMP" is used. - * - * Note that all projections now "explode" at their final destination, even - * if they were being projected at a more distant destination. This means - * that "ball" spells will *always* explode. - * - * Note that we must call "handle_stuff()" after affecting terrain features - * in the blast radius, in case the "illumination" of the grid was changed, - * and "update_view()" and "update_monsters()" need to be called. - */ - -#####GDescription -Generate a beam/bolt/ball starting from "who" with a radius of "rad" -at target grid "y,x" for "damage" points of "typ" damage. The beam/ -bolt/ball can have various properties as denoted by "flg". - -#####GParameters -> "who" is > 0 (index of monster in m_list[]), < 0 and - not -100 or -101 (player), -100 or -101 (trap). -> "rad" is 0 for a beam/bolt and 1-9 for a ball. -> "y" is the y co-ordinate of the target grid. -> "x" is the x co-ordinate of the target grid. -> "dam" is the number of points of damage. -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "flg" is the projection effect - *****fields.txt*0[PROJECT_fields] - ----------------------------------------------------------------------- - -#####R=== corrupt_player === - -#####GDeclaration - extern void corrupt_player(void); - -#####GFile - spells1.c - -#####GComment -(none) - -#####GDescription -Swap two of the players stats at random. - ----------------------------------------------------------------------- - -#####R=== grow_trees === - -#####GDeclaration - extern void grow_trees(int rad); - -#####GFile - spells2.c - -#####GComment -/* - * Grow trees - */ - -#####GDescription -Grow up to (("rad" x "rad") + 11) trees around the player. - -#####GParameters -> "rad" is the radius of the area where trees may grow. - ----------------------------------------------------------------------- - -#####R=== hp_player === - -#####GDeclaration - extern bool hp_player(int num); - -#####GFile - spells2.c - -#####GComment -/* - * Increase players hit points, notice effects - */ - -#####GDescription -Add "num" points to the player's current hit points. The total can -not exceed the maximum. - -#####GParameters -> "num" is the number of points to add. - ----------------------------------------------------------------------- - -#####R=== heal_insanity === - -#####GDeclaration - extern bool heal_insanity(int val); - -#####GFile - spells2.c - -#####GComment -/* Heal insanity. */ - -#####GDescription -Add "val" points to the player's current sanity points. The total can -not exceed the maximum. - -#####GParameters -> "val" is the number of points to add. - ----------------------------------------------------------------------- - -#####R=== warding_glyph === - -#####GDeclaration - extern void warding_glyph(void); - -#####GFile - spells2.c - -#####GComment -/* - * Leave a "glyph of warding" which prevents monster movement - */ - -#####GDescription -Place a glyph at the player's location. The location must be bare. - ----------------------------------------------------------------------- - -#####R=== explosive_rune === - -#####GDeclaration - extern void explosive_rune(void); - -#####GFile - spells2.c - -#####GComment -(none) - -#####GDescription -Place a minor glyph (explosive rune) at the player's location. The -location must be bare. - ----------------------------------------------------------------------- - -#####R=== do_dec_stat === - -#####GDeclaration - extern bool do_dec_stat(int stat, int mode); - -#####GFile - spells2.c - -#####GComment -/* - * Lose a "point" - */ - -#####GDescription -Attempt to reduce the player's "stat" statistic by a point. - -#####GParameters -> "stat" is the statistic - *****fields.txt*0[A_fields] -> "mode" is the type of decrease: temporary, normal, or permanent - *****fields.txt*0[STAT_DEC_fields] - ----------------------------------------------------------------------- - -#####R=== do_res_stat === - -#####GDeclaration - extern bool do_res_stat(int stat); - -#####GFile - spells2.c - -#####GComment -/* - * Restore lost "points" in a stat - */ - -#####GDescription -Restore the player's "stat" statistic. - -#####GParameters -> "stat" is the statistic - *****fields.txt*0[A_fields] - ----------------------------------------------------------------------- - -#####R=== do_inc_stat === - -#####GDeclaration - extern bool do_inc_stat(int stat); - -#####GFile - spells2.c - -#####GComment -/* - * Gain a "point" in a stat - */ - -#####GDescription -Increase the player's "stat" statistic by a point. - -#####GParameters -> "stat" is the statistic - *****fields.txt*0[A_fields] - ----------------------------------------------------------------------- - -#####R=== identify_pack === - -#####GDeclaration - extern void identify_pack(void); - -#####GFile - spells2.c - -#####GComment -/* - * Identify everything being carried. - * Done by a potion of "self knowledge". - */ - -#####GDescription -Identify all items in the inventory. - ----------------------------------------------------------------------- - -#####R=== remove_curse === - -#####GDeclaration - extern bool remove_curse(void); - -#####GFile - spells2.c - -#####GComment -/* - * Remove most curses - */ - -#####GDescription -Remove all curses except for heavy curses. - ----------------------------------------------------------------------- - -#####R=== remove_all_curse === - -#####GDeclaration - extern bool remove_all_curse(void); - -#####GFile - spells2.c - -#####GComment -/* - * Remove all curses - */ - -#####GDescription -Remove all curses including heavy curses. - ----------------------------------------------------------------------- - -#####R=== restore_level === - -#####GDeclaration - extern bool restore_level(void); - -#####GFile - spells2.c - -#####GComment -/* - * Restores any drained experience - */ - -#####GDescription -Restore all drained experience points (if any). - ----------------------------------------------------------------------- - -#####R=== self_knowledge === - -#####GDeclaration - extern void self_knowledge(FILE *fff); - -#####GFile - spells2.c - -#####GComment -/* - * self-knowledge... idea from nethack. Useful for determining powers and - * resistances of items. It saves the screen, clears it, then starts listing - * attributes, a screenful at a time. (There are a LOT of attributes to - * list. It will probably take 2 or 3 screens for a powerful character whose - * using several artifacts...) -CFT - * - * It is now a lot more efficient. -BEN- - * - * See also "identify_fully()". - * - * XXX XXX XXX Use the "show_file()" method, perhaps. - */ - -#####GDescription -Show all attributes including racial powers, mutations, and equipment -effects. - -#####GParameters -> "*ffff" points to a file (write info to file) or is NULL (write info - to screen). - ----------------------------------------------------------------------- - -#####R=== lose_all_info === - -#####GDeclaration - extern bool lose_all_info(void); - -#####GFile - spells2.c - -#####GComment -/* - * Forget everything - */ - -#####GDescription -Forget about objects and the map. - ----------------------------------------------------------------------- - -#####R=== detect_traps === - -#####GDeclaration - extern bool detect_traps(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all traps on current panel - */ - -#####GDescription -Detect all traps on current panel. - ----------------------------------------------------------------------- - -#####R=== detect_doors === - -#####GDeclaration - extern bool detect_doors(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all doors on current panel - */ - -#####GDescription -Detect all doors on current panel. - ----------------------------------------------------------------------- - -#####R=== detect_stairs === - -#####GDeclaration - extern bool detect_stairs(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all stairs on current panel - */ - -#####GDescription -Detect all stairs on current panel. - ----------------------------------------------------------------------- - -#####R=== detect_treasure === - -#####GDeclaration - extern bool detect_treasure(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect any treasure on the current panel - */ - -#####GDescription -Detect any treasure on the current panel. - ----------------------------------------------------------------------- - -Field: hack_no_detect_message -Value: FALSE - ----------------------------------------------------------------------- - -#####R=== detect_objects_gold === - -#####GDeclaration - extern bool detect_objects_gold(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all "gold" objects on the current panel - */ - -#####GDescription -Detect all objects with the TV_GOLD flag. - ----------------------------------------------------------------------- - -#####R=== detect_objects_normal === - -#####GDeclaration - extern bool detect_objects_normal(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all "normal" objects on the current panel - */ - -#####GDescription -Detect all objects without the TV_GOLD flag. - ----------------------------------------------------------------------- - -#####R=== detect_objects_magic === - -#####GDeclaration - extern bool detect_objects_magic(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all "magic" objects on the current panel. - * - * This will light up all spaces with "magic" items, including artifacts, - * ego-items, potions, scrolls, books, rods, wands, staves, amulets, rings, - * and "enchanted" items of the "good" variety. - * - * It can probably be argued that this function is now too powerful. - */ - -#####GDescription -Detect all "magic" objects which are artefacts, ego items, or have one -of the following flags - TV_AMULET, TV_RING, TV_BATERIE, TV_STAFF, -TV_WAND, TV_ROD, TV_ROD_MAIN, TV_SCROLL, TV_POTION, TV_POTION2, -TV_VALARIN_BOOK, TV_MAGERY_BOOK, TV_SHADOW_BOOK, TV_CHAOS_BOOK, -TV_SPIRIT_BOOK, TV_NETHER_BOOK, TV_DAEMON_BOOK, TV_CRUSADE_BOOK, -TV_SIGALDRY_BOOK, TV_SYMBIOTIC_BOOK, TV_MUSIC_BOOK. - ----------------------------------------------------------------------- - -#####R=== detect_monsters_normal === - -#####GDeclaration - extern bool detect_monsters_normal(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all "normal" monsters on the current panel - */ - -#####GDescription -Detect all non-invisible monsters (without RF2_INVISIBLE). - ----------------------------------------------------------------------- - -#####R=== detect_monsters_invis === - -#####GDeclaration - extern bool detect_monsters_invis(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all "invisible" monsters on current panel - */ - -#####GDescription -Detect all invisible monsters (with RF2_INVISIBLE). - ----------------------------------------------------------------------- - -#####R=== detect_monsters_evil === - -#####GDeclaration - extern bool detect_monsters_evil(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all "evil" monsters on current panel - */ - -#####GDescription -Detect all evil monsters (with RF3_EVIL). - ----------------------------------------------------------------------- - -#####R=== detect_monsters_good === - -#####GDeclaration - extern bool detect_monsters_good(void); - -#####GFile - spells2.c - -#####GComment -/* Detect good monsters */ - -#####GDescription -Detect all good monsters (with RF3_GOOD). - ----------------------------------------------------------------------- - -#####R=== detect_monsters_xxx === - -#####GDeclaration - extern bool detect_monsters_xxx(u32b match_flag); - -#####GFile - spells2.c - -#####GComment -/* - * A "generic" detect monsters routine, tagged to flags3 - */ - -#####GDescription -Detect all monsters with "match_flag" flag. - -#####GParameters -> "match_flag" can be any RF3_ flag (see defines.h) but only - RF3_DEMON, RF3_UNDEAD, RF3_GOOD work. - ----------------------------------------------------------------------- - -#####R=== detect_monsters_string === - -#####GDeclaration - extern bool detect_monsters_string(cptr); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all (string) monsters on current panel - */ - -#####GDescription -Detect all monsters whose default monster character matches a -character pointed to by "cptr". - -#####GParameters -> "cptr" is a pointer to a single character, eg 'Z' for hounds. For - available characters, see the "symbol" field of the graphics (G) - line of r_info.txt. - ----------------------------------------------------------------------- - -#####R=== detect_monsters_nonliving === - -#####GDeclaration - extern bool detect_monsters_nonliving(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect all "nonliving", "undead" or "demonic" monsters on current panel - */ - -#####GDescription -Detect all non-living monsters (with RF3_NONLIVING, RF3_UNDEAD, or -RF3_DEMON). - ----------------------------------------------------------------------- - -#####R=== detect_all === - -#####GDeclaration - extern bool detect_all(void); - -#####GFile - spells2.c - -#####GComment -/* - * Detect everything - */ - -#####GDescription -Detects traps, doors, stairs, treasure, gold objects, normal objects, -invisible monsters, normal (visible) monsters. - ----------------------------------------------------------------------- - -#####R=== stair_creation === - -#####GDeclaration - extern void stair_creation(void); - -#####GFile - spells2.c - -#####GComment -/* - * Create stairs at the player location - */ - -#####GDescription -Create stairs at the player location. This is not allowed if the grid -is not empty, the player is not in a dungeon, the player is on a -special level, the player is in an arena or quest. If the player is -in the town or wilderness the stairs will go down. If the player is -on a quest level or at the bottom of a dungeon, the stairs will go up. -Otherwise there is an even chance the stairs will go up or down. - ----------------------------------------------------------------------- - -#####R=== wall_stone === - -#####GDeclaration - extern bool wall_stone(void); - -#####GFile - spells2.c - -#####GComment -(none) - -#####GDescription -Create a stone wall on the player's grid. This function uses the -project() function to create the stone wall. Apparently zero can be -used as the "who" parameter for the player. See details for the -project() function elsewhere in this document. - ----------------------------------------------------------------------- - -#####R=== create_artifact === - -#####GDeclaration - extern bool create_artifact(object_type *o_ptr, - bool a_scroll, bool get_name); - -#####GFile - randart.c - -#####GComment -(none) - -#####GDescription -Create an artifact from object "*optr". - -#####GParameters -> "*optr* is a pointer to an object -> "a_scroll" is true if the artifact is created by reading a scroll -> "get_name" is true if the artifact is to be named by the player (if - a_scroll is true) or created randomly (a_scroll is false), or false - if an inscription is used. - ----------------------------------------------------------------------- - -#####R=== ident_spell === - -#####GDeclaration - extern bool ident_spell(void); - -#####GFile - spells2.c - -#####GComment -/* - * Identify an object in the inventory (or on the floor) - * This routine does *not* automatically combine objects. - * Returns TRUE if something was identified, else FALSE. - */ - -#####GDescription -Identify an object in the inventory (or on the floor). - ----------------------------------------------------------------------- - -#####R=== identify_fully === - -#####GDeclaration - extern bool identify_fully(void); - -#####GFile - spells2.c - -#####GComment -/* - * Fully "identify" an object in the inventory -BEN- - * This routine returns TRUE if an item was identified. - */ - -#####GDescription -Fully "identify" an object in the inventory (or on the floor). - ----------------------------------------------------------------------- - -#####R=== recharge === - -#####GDeclaration - extern bool recharge(int num); - -#####GFile - spells2.c - -#####GComment -/* - * Recharge a wand/staff/rod from the pack or on the floor. - * This function has been rewritten in Oangband. -LM- - * - * Mage -- Recharge I --> recharge(90) - * Mage -- Recharge II --> recharge(150) - * Mage -- Recharge III --> recharge(220) - * - * Priest or Necromancer -- Recharge --> recharge(140) - * - * Scroll of recharging --> recharge(130) - * Scroll of *recharging* --> recharge(200) - * - * It is harder to recharge high level, and highly charged wands, - * staffs, and rods. The more wands in a stack, the more easily and - * strongly they recharge. Staffs, however, each get fewer charges if - * stacked. - * - * XXX XXX XXX Beware of "sliding index errors". - */ - -#####GDescription -Recharge an object in the inventory (or on the floor) with "num" -power. - -#####GParameters -> "num" is the power used in recharging. It is compared to the - object's level to determine whether the item is recharged - successfully or destroyed. If it is recharged, it also determines - how many charges are added, or how much recharge time is reduced. - ----------------------------------------------------------------------- - -#####R=== aggravate_monsters === - -#####GDeclaration - extern void aggravate_monsters(int who); - -#####GFile - spells2.c - -#####GComment -/* - * Wake up all monsters, and speed up "los" monsters. - */ - -#####GDescription -Aggravate monsters, originating from "who". - -#####GParameters -> "who" is the index of monster in m_list[] (1 if it is the player) - which triggers the aggravation; - ----------------------------------------------------------------------- - -#####R=== genocide === - -#####GDeclaration - extern bool genocide(bool player_cast); - -#####GFile - spells2.c - -#####GComment -(none) - -#####GDescription -Genocide a monster race. - -#####GParameters -> "player_cast" is true if the player cast the spell so the player can - take damage. - ----------------------------------------------------------------------- - -#####R=== mass_genocide === - -#####GDeclaration - extern bool mass_genocide(bool player_cast); - -#####GFile - spells2.c - -#####GComment -/* - * Delete all nearby (non-unique) monsters - */ - -#####GDescription -Delete all nearby (non-unique) monsters. - -#####GParameters -> "player_cast" is true if the player cast the spell so the player can - take damage. - ----------------------------------------------------------------------- - -#####R=== probing === - -#####GDeclaration - extern bool probing(void); - -#####GFile - spells2.c - -#####GComment -/* - * Probe nearby monsters - */ - -#####GDescription -Probe all nearby monsters. - ----------------------------------------------------------------------- - -#####R=== banish_evil === - -#####GDeclaration - extern bool banish_evil(int dist); - -#####GFile - spells2.c - -#####GComment -/* - * Banish evil monsters - */ - -#####GDescription -Banish nearby evil monsters doing "dist" points of GF_AWAY_EVIL -damage. - -#####GParameters -> "dist" is the amount of damage done to each monster. - ----------------------------------------------------------------------- - -#####R=== dispel_evil === - -#####GDeclaration - extern bool dispel_evil(int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Dispel evil monsters - */ - -#####GDescription -Dispel nearby evil monsters doing "dam" points of GF_DISP_EVIL -damage. - -#####GParameters -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== dispel_good === - -#####GDeclaration - extern bool dispel_good(int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Dispel good monsters - */ - -#####GDescription -Dispel nearby good monsters doing "dam" points of GF_DISP_GOOD -damage. - -#####GParameters -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== dispel_undead === - -#####GDeclaration - extern bool dispel_undead(int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Dispel undead monsters - */ - -#####GDescription -Dispel nearby undead monsters doing "dam" points of GF_DISP_UNDEAD -damage. - -#####GParameters -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== dispel_monsters === - -#####GDeclaration - extern bool dispel_monsters(int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Dispel all monsters - */ - -#####GDescription -Dispel all nearby monsters doing "dam" points of GF_DISP_ALL -damage. - -#####GParameters -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== dispel_living === - -#####GDeclaration - extern bool dispel_living(int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Dispel 'living' monsters - */ - -#####GDescription -Dispel nearby living monsters doing "dam" points of GF_DISP_LIVING -damage. - -#####GParameters -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== dispel_demons === - -#####GDeclaration - extern bool dispel_demons(int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Dispel demons - */ - -#####GDescription -Dispel nearby demon monsters doing "dam" points of GF_DISP_DEMON -damage. - -#####GParameters -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== turn_undead === - -#####GDeclaration - extern bool turn_undead(void); - -#####GFile - spells2.c - -#####GComment -/* - * Turn undead - */ - -#####GDescription -Turn nearby undead monsters doing a point of GF_TURN_UNDEAD damage for -each player level. - ----------------------------------------------------------------------- - -#####R=== wipe === - -#####GDeclaration - extern void wipe(int y1, int x1, int r); - -#####GFile - spells2.c - -#####GComment -/* - * Wipe -- Empties a part of the dungeon - */ - -#####GDescription -Delete monsters and objects from an area of the dungeon centred at -grid "y1,x1" for a radius "r". This does not work on special levels or -quests. The player may be blinded. The player forgets the affected -area and it becomes dark. All grids become floor. - -#####GParameters -> "y1" is the y-coordinate of the wipe's origin. -> "x1" is the x-coordinate of the wipe's origin. -> "r" is the radius of the wipe. - ----------------------------------------------------------------------- - -#####R=== destroy_area === - -#####GDeclaration - extern void destroy_area(int y1, int x1, int r, - bool full); - -#####GFile - spells2.c - -#####GComment -/* - * The spell of destruction - * - * This spell "deletes" monsters (instead of "killing" them). - * - * Later we may use one function for both "destruction" and - * "earthquake" by using the "full" to select "destruction". - */ - -#####GDescription -Delete monsters and objects from an area of the dungeon centred at -grid "y1,x1" for a radius "r". This does not work on special levels or -quests. The epicentre is NOT affected. The player may be blinded. The -player forgets the affected area and it becomes dark. The grids can -become granite, quartz, magma, or floor. - -#####GParameters -> "y1" is the y-coordinate of the destruction's origin. -> "x1" is the x-coordinate of the destruction's origin. -> "r" is the radius of the destruction. -> "full" is currently unused. - ----------------------------------------------------------------------- - -#####R=== earthquake === - -#####GDeclaration - extern void earthquake(int cy, int cx, int r); - -#####GFile - spells2.c - -#####GComment -/* - * Induce an "earthquake" of the given radius at the given location. - * - * This will turn some walls into floors and some floors into walls. - * - * The player will take damage and "jump" into a safe grid if possible, - * otherwise, he will "tunnel" through the rubble instantaneously. - * - * Monsters will take damage, and "jump" into a safe grid if possible, - * otherwise they will be "buried" in the rubble, disappearing from - * the level in the same way that they do when genocided. - * - * Note that thus the player and monsters (except eaters of walls and - * passers through walls) will never occupy the same grid as a wall. - * Note that as of now (2.7.8) no monster may occupy a "wall" grid, even - * for a single turn, unless that monster can pass_walls or kill_walls. - * This has allowed massive simplification of the "monster" code. - */ - -#####GDescription -Create an earthquake centred on grid "cy,cx" with a radius of "r". -This does not work on quest levels. The epicentre is NOT affected. -Only about 15% of the grids are affected. The player takes 300 points -of damage if they can't be moved to a safe grid, otherwise damage is -from 10 to 40 points. The player forgets the affected area and it -becomes dark. The grids can become granite, quartz, magma, or floor. - -#####GParameters -Parameters: -> "cy" is the y-coordinate of the earthquake origin. -> "cx" is the x-coordinate of the earthquake origin. -> "r" is the radius of the earthquake. - ----------------------------------------------------------------------- - -#####R=== map_area === - -#####GDeclaration - extern void map_area(void); - -#####GFile - cave.c - -#####GComment -/* - * Hack -- map the current panel (plus some) ala "magic mapping" - */ - -#####GDescription -Map the current panel plus up to 10 grids up and down, and up to 20 -grids left and right. - ----------------------------------------------------------------------- - -#####R=== wiz_lite === - -#####GDeclaration - extern void wiz_lite(void); - -#####GFile - cave.c - -#####GComment -/* - * Light up the dungeon using "clairvoyance" - * - * This function "illuminates" every grid in the dungeon, memorises all - * "objects", memorises all grids as with magic mapping, and, under the - * standard option settings (view_perma_grids but not view_torch_grids) - * memorises all floor grids too. - * - * Note that if "view_perma_grids" is not set, we do not memorise floor - * grids, since this would defeat the purpose of "view_perma_grids", not - * that anyone seems to play without this option. - * - * Note that if "view_torch_grids" is set, we do not memorise floor grids, - * since this would prevent the use of "view_torch_grids" as a method to - * keep track of what grids have been observed directly. - */ - -#####GDescription -Light up the entire dungeon and show all monsters and objects. - ----------------------------------------------------------------------- - -#####R=== wiz_lite_extra === - -#####GDeclaration - extern void wiz_lite_extra(void); - -#####GFile - cave.c - -#####GComment -(none) - -#####GDescription -Light up the entire dungeon and show all monsters and objects. All -squares are lit and remembered. - ----------------------------------------------------------------------- - -#####R=== wiz_dark === - -#####GDeclaration - extern void wiz_dark(void); - -#####GFile - cave.c - -#####GComment -/* - * Forget the dungeon map (ala "Thinking of Maud..."). - */ - -#####GDescription -Forget all grids and objects. All grids become dark. - ----------------------------------------------------------------------- - -#####R=== lite_room === - -#####GDeclaration - extern void lite_room(int y1, int x1); - -#####GFile - spells2.c - -#####GComment -/* - * Illuminate any room containing the given location. - */ - -#####GDescription -Light up the room (if any) of grid "y1,x1". - -#####GParameters -> "y1" is the y-coordinate of the grid. -> "x1" is the x-coordinate of the grid. - ----------------------------------------------------------------------- - -#####R=== unlite_room === - -#####GDeclaration - extern void unlite_room(int y1, int x1); - -#####GFile - spells2.c - -#####GComment -/* - * Darken all rooms containing the given location - */ - -#####GDescription -Darken all rooms (if any) of grid "y1,x1". - -#####GParameters -> "y1" is the y-coordinate of the grid. -> "x1" is the x-coordinate of the grid. - ----------------------------------------------------------------------- - -#####R=== lite_area === - -#####GDeclaration - extern bool lite_area(int dam, int rad); - -#####GFile - spells2.c - -#####GComment -/* - * Hack -- call light around the player - * Affect all monsters in the projection radius - */ - -#####GDescription -Light up the room (if any) of the player's grid. Monsters take "dam" -points of GF_LITE_WEAK damage if they are within "r" grids of the -player. - -#####GParameters -> "dam" is the number of points of damage. -> "rad" is the radius of the effect of the damage. - ----------------------------------------------------------------------- - -#####R=== unlite_area === - -#####GDeclaration - extern bool unlite_area(int dam, int rad); - -#####GFile - spells2.c - -#####GComment -/* - * Hack -- call darkness around the player - * Affect all monsters in the projection radius - */ - -#####GDescription -Darken the room (if any) of the player's grid. Monsters take "dam" -points of GF_DARK_WEAK damage if they are within "r" grids of the -player. - -#####GParameters -> "dam" is the number of points of damage. -> "rad" is the radius of the effect of the damage. - ----------------------------------------------------------------------- - -#####R=== fire_ball_beam === - -#####GDeclaration - extern bool fire_ball_beam(int typ, int dir, int dam, - int rad); - -#####GFile - spells2.c - -#####GComment -/* - * Cast a ball-beamed spell - * Stop if we hit a monster, act as a "ball" - * Allow "target" mode to pass over monsters - * Affect grids, objects, and monsters - */ - -#####GDescription -Cast a ball-beamed spell of type "typ" in direction "dir" for damage -"dam" points with a radius of "rad" grids. - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9. - *****fields.txt*0[direction] -> "dam" is the number of points of damage. -> "rad" is the radius of the effect of the damage (must be <= 16). - ----------------------------------------------------------------------- - -#####R=== fire_ball === - -#####GDeclaration - extern bool fire_ball(int typ, int dir, int dam, int rad); - -#####GFile - spells2.c - -#####GComment -/* - * Cast a ball spell - * Stop if we hit a monster, act as a "ball" - * Allow "target" mode to pass over monsters - * Affect grids, objects, and monsters - */ - -#####GDescription -Cast a ball spell of type "typ" in direction "dir" for "dam" points of -damage. The ball has a radius of "rad" grids. - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9. - *****fields.txt*0[direction] -> "dam" is the number of points of damage. -> "rad" is the radius of the effect of the damage (must be <= 16). - ----------------------------------------------------------------------- - -#####R=== fire_bolt === - -#####GDeclaration - extern bool fire_bolt(int typ, int dir, int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Cast a bolt spell - * Stop if we hit a monster, as a "bolt" - * Affect monsters (not grids or objects) - */ - -#####GDescription -Cast a bolt spell of type "typ" in direction "dir" for "dam" points of -damage. - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9 - *****fields.txt*0[direction] -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== fire_beam === - -#####GDeclaration - extern bool fire_beam(int typ, int dir, int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Cast a beam spell - * Pass through monsters, as a "beam" - * Affect monsters (not grids or objects) - */ - -#####GDescription -Cast a beam spell of type "typ" in direction "dir" for "dam" points of -damage. - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9. - *****fields.txt*0[direction] -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== fire_druid_ball === - -#####GDeclaration - extern bool fire_druid_ball(int typ, int dir, int dam, - int rad); - -#####GFile - spells2.c - -#####GComment -/* - * Cast a druidic ball spell - * Stop if we hit a monster, act as a "ball" - * Allow "target" mode to pass over monsters - * Affect grids, objects, and monsters - */ - -#####GDescription -Cast a ball spell of type "typ" in direction "dir" for "dam" points of -damage. The ball has a radius of "rad" grids. The spell follows a mana -path. - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9. - *****fields.txt*0[direction] -> "dam" is the number of points of damage. -> "rad" is the radius of the effect of the damage (must be <= 16). - ----------------------------------------------------------------------- - -#####R=== fire_druid_bolt === - -#####GDeclaration - extern bool fire_druid_bolt(int typ, int dir, int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Cast a druidic bolt spell - * Stop if we hit a monster, as a "bolt" - * Affect monsters (not grids or objects) - */ - -#####GDescription -Cast a bolt spell of type "typ" in direction "dir" for "dam" points of -damage. The spell follows a mana path. - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9. - *****fields.txt*0[direction] -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== fire_druid_beam === - -#####GDeclaration - extern bool fire_druid_beam(int typ, int dir, int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Cast a druidistic beam spell - * Pass through monsters, as a "beam" - * Affect monsters (not grids or objects) - */ - -#####GDescription -Cast a beam spell of type "typ" in direction "dir" for "dam" points of -damage. The spell follows a mana path. - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9. - *****fields.txt*0[direction] -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== fire_bolt_or_beam === - -#####GDeclaration - extern bool fire_bolt_or_beam(int prob, int typ, int dir, - int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Cast a bolt spell, or rarely, a beam spell - */ - -#####GDescription -Cast a beam (chance of "prob" in 100) or bolt spell of type "typ" in -direction "dir" for "dam" points of damage. - -#####GParameters -> "prob" is the number of times out of 100 that the bolt will actually - be a beam. Obviously this value should range from 1 to 99 (0 will - always give a beam, 100 or higher will always give a beam. There are - separate functions for these cases). -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9. - *****fields.txt*0[direction] -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - -#####R=== alchemy === - -#####GDeclaration - extern bool alchemy(void); - -#####GFile - spells2.c - -#####GComment -/* Turns an object into gold, gain some of its value in a shop */ - -#####GDescription -The player selects an object (and quantity if it applies) from the -inventory or the floor and attempts to turn it into gold. If the -price of the item is < 0 then the player gains nothing (fool's gold), -otherwise the player gets a third of the price in gold. Artifacts are -not affected. - ----------------------------------------------------------------------- - -#####R=== alter_reality === - -#####GDeclaration - extern void alter_reality(void); - -#####GFile - spells2.c - -#####GComment -(none) - -#####GDescription -The player leaves the level immediately. - ----------------------------------------------------------------------- - -#####R=== teleport_swap === - -#####GDeclaration - extern void teleport_swap(int dir); - -#####GFile - spells2.c - -#####GComment -(none) - -#####GDescription -Player swaps places with target in direction "dir". The target must be -a monster. It will not work if the space-time continuum can not be -disrupted or if the monster resists teleportation. - ----------------------------------------------------------------------- - -#####R=== project_meteor === - -#####GDeclaration - extern void project_meteor(int radius, int typ, int dam, - u32b flg); - -#####GFile - spells2.c - -#####GComment -/* - * Apply a "project()" a la meteor shower - */ - -#####GDescription -Generate between "rad" and "rad" x 2 ball spells of type "typ" for -"dam" points of damage. The ball can have various properties as -denoted by "flg". - -#####GParameters -> "rad" is the minimum number of balls created. "rad" + randint("rad") - balls are created. Each ball has a radius of 2 grids. Each target - grid is within 5 grids of the player. -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dam" is the number of points of damage. -> "flg" is the projection effect - *****fields.txt*0[PROJECT_fields] - ----------------------------------------------------------------------- - -#####R=== passwall === - -#####GDeclaration - extern bool passwall(int dir, bool safe); - -#####GFile - spells2.c - -#####GComment -/* - * Send the player shooting through walls in the given direction until - * they reach a non-wall space, or a monster, or a permanent wall. - */ - -#####GDescription -Move the player through walls in direction "dir". if "safe" then the -player can not end up in a wall - if they do, the wall is replaced by -a floor. This does not work in the wilderness, on quest levels, or if -teleport is not allowed. Stopping on monsters or inside vaults is not -allowed. - -#####GParameters -> "dir" must be from 0 to 9. It can not be 5. - *****fields.txt*0[direction] -> "safe" must be true if the player is not to be trapped in a wall - when the movement is finished. - ----------------------------------------------------------------------- - -#####R=== project_hook === - -#####GDeclaration - extern bool project_hook(int typ, int dir, int dam, - int flg); - -#####GFile - spells2.c - -#####GComment -/* - * Hack -- apply a "projection()" in a direction (or at the target) - */ - -#####GDescription -Generate a beam/bolt of type "typ" in direction "dir" (or at a target) -for "dam" points of damage. The beam/bolt can have various properties -as denoted by "flg". - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dir" must be from 0 to 9. 5 means use the current target. - *****fields.txt*0[direction] -> "dam" is the number of points of damage. -> "flg" is the projection effect - *****fields.txt*0[PROJECT_fields] - ----------------------------------------------------------------------- - -#####R=== reset_recall === - -#####GDeclaration - extern bool reset_recall(void); - -#####GFile - spells2.c - -#####GComment -(none) - -#####GDescription -Ask the player for a dungeon and appropriate level within the dungeon. -The player can not specify a dungeon they have not gone to yet. If the -player chooses levels 99 or 100, the level is set to 98. - ----------------------------------------------------------------------- - -#####R=== get_aim_dir === - -#####GDeclaration - extern bool get_aim_dir(int *dp = 0); - -#####GFile - xtra2.c - -#####GComment -/* - * Get an "aiming direction" from the user. - * - * The "dir" is loaded with 1,2,3,4,6,7,8,9 for "actual direction", and - * "0" for "current target", and "-1" for "entry aborted". - * - * Note that "Force Target", if set, will pre-empt user interaction, - * if there is a usable target already set. - * - * Note that confusion over-rides any (explicit?) user choice. - */ - -#####GDescription -Get an aiming direction from the user and store it in "dp". A target -can be selected. If the player is confused, the direction will be -random. - -#####GParameters -> "dp" = player direction. - ----------------------------------------------------------------------- - -#####R=== project_hack === - -#####GDeclaration - extern bool project_hack(int typ, int dam); - -#####GFile - spells2.c - -#####GComment -/* - * Apply a "project()" directly to all viewable monsters - * - * Note that affected monsters are NOT auto-tracked by this usage. - */ - -#####GDescription -Generate beam/bolt spells of type "typ" for "dam" points of damage to -all viewable monsters in line of site. - -#####GParameters -> "typ" is the type of damage - *****fields.txt*0[GF_fields] -> "dam" is the number of points of damage. - ----------------------------------------------------------------------- - - -Back to the *****lua.hlp*0[lua help index] . - - [[[[[gThis file by Chris Hadgis] diff --git a/lib/mods/theme/help/lua_util.txt b/lib/mods/theme/help/lua_util.txt deleted file mode 100644 index 8886a2b4..00000000 --- a/lib/mods/theme/help/lua_util.txt +++ /dev/null @@ -1,898 +0,0 @@ -|||||oy - -#####R /----------------------------------------\ -#####R < util.pkg functions helper file > -#####R \----------------------------------------/ - ----------------------------------------------------------------------- - -#####R=== bst === - -#####GDeclaration - s32b bst(s32b what, s32b t); - -#####GFile - util.c - -#####GComment -/* - * Break scalar time - */ - -#####GDescription -Return the minute, hour, day, or year for turn "t". One turn takes 7.5 -seconds. - -#####GParameters -> "what" is the unit to be returned and must be one of - MINUTE (number of turns per minute, which is 8) - HOUR (number of turns per hour, which is 480) - DAY (number of turns per day, which is 11,520) - YEAR (number of turns per year, which is 4,204,800) -> "t" is the number of turns. - ----------------------------------------------------------------------- - -#####R=== path_build === - -#####GDeclaration - errr path_build(char *buf, int max, cptr path, cptr file); - -#####GFile - util.c - -#####GComment -/* -* Create a new path by appending a file (or directory) to a path -* -* This requires no special processing on simple machines, except -* for verifying the size of the filename, but note the ability to -* bypass the given "path" with certain special file-names. -* -* Note that the "file" may actually be a "sub-path", including -* a path and a file. -* -* Note that this function yields a path which must be "parsed" -* using the "parse" function above. -*/ - -#####GDescription -Append file "file" to path "path" and return the result in "buf". The -length of "buf" is a maximum of "max" characters. If "file" starts -with '~' then return "file". If "file" starts with the path separator -and the path separator is not blank then return "file". If there is no -path then return "file". Otherwise return "path" + path separator + -"file". The path separator is defined in "H-config.h". - -#####GParameters -> "buf" contains the new path. -> "max" is the maximum number of characters allowed in "buf". -> "path" is the original path. -> "file" is the original file. - ----------------------------------------------------------------------- - -#####R=== move_cursor === - -#####GDeclaration - void move_cursor(int row, int col); - -#####GFile - util.c - -#####GComment -/* -* Move the cursor -*/ - -#####GDescription -Move the cursor to row "row" and column "col". - -#####GParameters -> "row" is the row the cursor is to be moved to. -> "col" is the column the cursor is to be moved to. - ----------------------------------------------------------------------- - -#####R=== inkey === - -#####GDeclaration - char inkey(void); - -#####GFile - util.c - -#####GComment -/* -* Get a keypress from the user. -* -* This function recognises a few "global parameters". These are variables -* which, if set to TRUE before calling this function, will have an effect -* on this function, and which are always reset to FALSE by this function -* before this function returns. Thus they function just like normal -* parameters, except that most calls to this function can ignore them. -* -* If "inkey_xtra" is TRUE, then all pending keypresses will be flushed, -* and any macro processing in progress will be aborted. This flag is -* set by the "flush()" function, which does not actually flush anything -* itself, but rather, triggers delayed input flushing via "inkey_xtra". -* -* If "inkey_scan" is TRUE, then we will immediately return "zero" if no -* keypress is available, instead of waiting for a keypress. -* -* If "inkey_base" is TRUE, then all macro processing will be bypassed. -* If "inkey_base" and "inkey_scan" are both TRUE, then this function will -* not return immediately, but will wait for a keypress for as long as the -* normal macro matching code would, allowing the direct entry of macro -* triggers. The "inkey_base" flag is extremely dangerous! -* -* If "inkey_flag" is TRUE, then we will assume that we are waiting for a -* normal command, and we will only show the cursor if "hilite_player" is -* TRUE (or if the player is in a store), instead of always showing the -* cursor. The various "main-xxx.c" files should avoid saving the game -* in response to a "menu item" request unless "inkey_flag" is TRUE, to -* prevent savefile corruption. -* -* If we are waiting for a keypress, and no keypress is ready, then we will -* refresh (once) the window which was active when this function was called. -* -* Note that "back-quote" is automatically converted into "escape" for -* convenience on machines with no "escape" key. This is done after the -* macro matching, so the user can still make a macro for "backquote". -* -* Note the special handling of "ascii 30" (ctrl-caret, aka ctrl-shift-six) -* and "ascii 31" (ctrl-underscore, aka ctrl-shift-minus), which are used to -* provide support for simple keyboard "macros". These keys are so strange -* that their loss as normal keys will probably be noticed by nobody. The -* "ascii 30" key is used to indicate the "end" of a macro action, which -* allows recursive macros to be avoided. The "ascii 31" key is used by -* some of the "main-xxx.c" files to introduce macro trigger sequences. -* -* Hack -- we use "ascii 29" (ctrl-right-bracket) as a special "magic" key, -* which can be used to give a variety of "sub-commands" which can be used -* any time. These sub-commands could include commands to take a picture of -* the current screen, to start/stop recording a macro action, etc. -* -* If "angband_term[0]" is not active, we will make it active during this -* function, so that the various "main-xxx.c" files can assume that input -* is only requested (via "Term_inkey()") when "angband_term[0]" is active. -* -* Mega-Hack -- This function is used as the entry point for clearing the -* "signal_count" variable, and of the "character_saved" variable. -* -* Hack -- Note the use of "inkey_next" to allow "keymaps" to be processed. -* -* Mega-Hack -- Note the use of "inkey_hack" to allow the "Borg" to steal -* control of the keyboard from the user. -*/ - -#####GDescription -Get a keypress from the user. - ----------------------------------------------------------------------- - -#####R=== cmsg_print === - -#####GDeclaration - void cmsg_print(byte color, cptr msg); - -#####GFile - util.c - -#####GComment -/* -* Output a message to the top line of the screen. -* -* Break long messages into multiple pieces (40-72 chars). -* -* Allow multiple short messages to "share" the top line. -* -* Prompt the user to make sure he has a chance to read them. -* -* These messages are memorised for later reference (see above). -* -* We could do "Term_fresh()" to provide "flicker" if needed. -* -* The global "msg_flag" variable can be cleared to tell us to -* "erase" any "pending" messages still on the screen. -* -* XXX XXX XXX Note that we must be very careful about using the -* "msg_print()" functions without explicitly calling the special -* "msg_print(NULL)" function, since this may result in the loss -* of information if the screen is cleared, or if anything is -* displayed on the top line. -* -* XXX XXX XXX Note that "msg_print(NULL)" will clear the top line -* even if no messages are pending. This is probably a hack. -*/ - -#####GDescription -In color "color", output message "msg" to the top line of the screen. -If the message is blank or has more than 1000 characters, nothing is -printed. Long messages are split after the 40th character and before -the 72nd character. - -#####GParameters -> "color" is the color of the message. - *****fields.txt*0[colors] -> "msg" is the message. - ----------------------------------------------------------------------- - -#####R=== msg_print === - -#####GDeclaration - void msg_print(cptr msg); - -#####GFile - util.c - -#####GComment -/* Hack -- for compatibility and easy sake */ - -#####GDescription -Print message "msg" in white (see cmsg_print() above). - -#####GParameters -> "msg" is the message. - ----------------------------------------------------------------------- - -#####R=== screen_save === - -#####GDeclaration - void screen_save(void); - -#####GFile - util.c - -#####GComment -/* - * Save the screen, and increase the "icky" depth. - * - * This function must match exactly one call to "screen_load()". - */ - -#####GDescription -Save a screen shot. - ----------------------------------------------------------------------- - -#####R=== screen_load === - -#####GDeclaration - void screen_load(void); - -#####GFile - util.c - -#####GComment -/* - * Load the screen, and decrease the "icky" depth. - * - * This function must match exactly one call to "screen_save()". - */ - -#####GDescription -Load a previously saved screen shot. - ----------------------------------------------------------------------- - -#####R=== c_put_str === - -#####GDeclaration - void c_put_str(byte attr, cptr str, int row, int col); - -#####GFile - util.c - -#####GComment -/* -* Display a string on the screen using an attribute. -* -* At the given location, using the given attribute, if allowed, -* add the given string. Do not clear the line. -*/ - -#####GDescription -Put string "str" at row "row" and column "col" with attribute "attr". - -#####GParameters -> "attr" is the color of the message. - *****fields.txt*0[colors] -> "msg" is the message. -> "row" is the row the message is to be printed at. -> "col" is the column the message is to be printed at. - ----------------------------------------------------------------------- - -#####R=== c_prt === - -#####GDeclaration - void c_prt(byte attr, cptr str, int row, int col); - -#####GFile - util.c - -#####GComment -/* -* Display a string on the screen using an attribute, and clear -* to the end of the line. -*/ - -#####GDescription -Clear row "row" from column "col". Put string "str" at "row", "col" -with attribute "attr". - -#####GParameters -> "attr" is the color of the message. - *****fields.txt*0[colors] -> "msg" is the message. -> "row" is the row the message is to be printed at. -> "col" is the column the message is to be printed at. - ----------------------------------------------------------------------- - -#####R=== clear_from === - -#####GDeclaration - void clear_from(int row); - -#####GFile - util.c - -#####GComment -/* -* Clear part of the screen -*/ - -#####GDescription -Clear the screen from row "row" onwards. - -#####GParameters -> "row" is the first row of the screen to be cleared. - ----------------------------------------------------------------------- - -#####R=== askfor_aux === - -#####GDeclaration - bool askfor_aux(char *buf, int len); - -#####GFile - util.c - -#####GComment -/* -* Get some input at the cursor location. -* Assume the buffer is initialized to a default string. -* Note that this string is often "empty" (see below). -* The default buffer is displayed in yellow until cleared. -* Pressing RETURN right away accepts the default entry. -* Normal chars clear the default and append the char. -* Backspace clears the default or deletes the final char. -* ESCAPE clears the buffer and the window and returns FALSE. -* RETURN accepts the current buffer contents and returns TRUE. -*/ - -#####GDescription -Get string "buf" from the screen. "buf" is to be no more than "len" -bytes. The string starts at the current cursor position. The length -can not exceed the number of bytes from the cursor to the end of the -line. Accept user input until the escape or return key is pressed. - -#####GParameters -> "buf" is the string returned from the screen. -> "len" is the length of the string. If it is <1 it is forced to 1. - ----------------------------------------------------------------------- - -#####R=== get_string === - -#####GDeclaration - bool get_string(cptr prompt, char *buf, int len); - -#####GFile - util.c - -#####GComment -/* -* Get a string from the user -* -* The "prompt" should take the form "Prompt: " -* -* Note that the initial contents of the string is used as -* the default response, so be sure to "clear" it if needed. -* -* We clear the input, and return FALSE, on "ESCAPE". -*/ - -#####GDescription -Print prompt "prompt" at the top-left corner of the screen and return -response "buf" which will have a maximum length "length". If ESCAPE -is entered, the function returns FALSE, otherwise it returns TRUE. - -#####GParameters -> "prompt" is the prompt for input. -> "buf" is the returned response. -> "len" is the maximum length of the string. - ----------------------------------------------------------------------- - -#####R=== get_check === - -#####GDeclaration - bool get_check(cptr prompt); - -#####GFile - util.c - -#####GComment -/* -* Verify something with the user -* -* The "prompt" should take the form "Query? " -* -* Note that "[y/n]" is appended to the prompt. -*/ - -#####GDescription -Ask the user question "prompt" which requires a yes/no answer. The -prompt appears in the top-left corner of the screen. A response of -'Y' (either case) returns TRUE. A response of 'N' (either case) or -ESCAPE returns FALSE. - -#####GParameters -> "prompt" is the question asked. It has a maximum length of 70 - characters. - ----------------------------------------------------------------------- - -#####R=== get_com_lua === - -#####GDeclaration - bool get_com_lua @ get_com(cptr promtp, int *com); - -#####GFile - util.c - -#####GComment -/* -* Prompts for a keypress -* -* The "prompt" should take the form "Command: " -* -* Returns TRUE unless the character is "Escape" -*/ - -#####GDescription -Ask the user for command "prompt" and return the key press "com". A -response of ESCAPE returns FALSE. All other responses return TRUE. - -#####GParameters -> "prompt" is the prompt for the key press. -> "com" is the returned key press. - ----------------------------------------------------------------------- - -#####R=== get_quantity === - -#####GDeclaration - s32b get_quantity(cptr prompt, s32b max); - -#####GFile - util.c - -#####GComment -/* -* Request a "quantity" from the user -* -* Hack -- allow "command_arg" to specify a quantity -*/ - -#####GDescription -Ask the user for quantity "prompt" of maximum value "max" and return -a quantity. If the user quantity is higher than the maximum then the -maximum is returned. If the response is a letter then the maximum is -returned. If the user quantity is negative then zero is returned. - -#####GParameters -> "prompt" is the prompt for a quantity. -> "max" is the maximum value allowed. - ----------------------------------------------------------------------- - -#####R=== test_monster_name === - -#####GDeclaration - int test_monster_name(cptr name); - -#####GFile - util.c - -#####GComment -/* - * Given monster name as string, return the index in r_info array. Name - * must exactly match (look out for commas and the like!), or else 0 is - * returned. Case doesn't matter. -GSN- - */ - -#####GDescription -Return the monster index for monster with name "name". If no match is -found then zero is returned. - -#####GParameters -> "name" is the monster name. - ----------------------------------------------------------------------- - -#####R=== test_item_name === - -#####GDeclaration - int test_item_name(cptr name); - -#####GFile - util.c - -#####GComment -/* - * Given item name as string, return the index in k_info array. Name - * must exactly match (look out for commas and the like!), or else 0 is - * returned. Case doesn't matter. -DG- - */ - -#####GDescription -Return the item index for item with name "name". If no match is found -then zero is returned. - -#####GParameters -> "name" is the item name. - ----------------------------------------------------------------------- - -#####R=== luck === - -#####GDeclaration - int luck(int min, int max); - -#####GFile - xtra1.c - -#####GComment -/* - * Return a luck number between a certain range - */ - -#####GDescription -Return a number for luck between minimum "min" and maximum "max". The -value begins with the player's current luck. The value is forced to -be between -30 and +30. 30 is added to give a value between 0 and 60. -The value is multiplied by the range (maximum - minimum) and divided -by 60. The value is increased by the minimum. The value is returned. - -For example, if the player's current luck is 15, the minimum is -10, -and the maximum is 10 (range 20), then the value returned is -(45 * 20) / 60 which is 900 / 60 which is 15 + the minimum -10 gives -a returned value of 5. - -#####GParameters -> "min" is the minimum luck. -> "max" is the maximum luck. Beware: this should be greater than the - minimum but it is not checked! - ----------------------------------------------------------------------- - -#####R=== get_player_race_name === - -#####GDeclaration - cptr get_player_race_name(int pr, int ps); - -#####GFile - util.c - -#####GComment -(none) - -#####GDescription -Return the name for player race "pr" and player sub-race "ps". - -#####GParameters -> "pr" is the index for player race. -> "ps" is the index for player sub-race. - ----------------------------------------------------------------------- - -#####R=== quit === - -#####GDeclaration - void quit(cptr str); - -#####GFile - z-util.c - -#####GComment -/* - * Exit (ala "exit()"). If 'str' is NULL, do "exit(0)". - * If 'str' begins with "+" or "-", do "exit(atoi(str))". - * Otherwise, plog() 'str' and exit with an error code of -1. - * But always use 'quit_aux', if set, before anything else. - */ - -#####GDescription -Quit the game. If "str" is a string then write the string to the -error file or screen. If "str" is a number then exit with the -number as the exit code. - -#####GParameters -> "str" is an error message or exit code. - ----------------------------------------------------------------------- - -#####R=== dump_hooks === - -#####GDeclaration - void dump_hooks(); - -#####GFile - plots.c - -#####GComment -(none) - -#####GDescription -Print the name and type (C or Lua) of hooks in the hook list. - ----------------------------------------------------------------------- - -#####R=== add_hook_script === - -#####GDeclaration - void add_hook_script(int h_idx, char *script, cptr name); - -#####GFile - plots.c - -#####GComment -(none) - -#####GDescription -To hook list with index "h_idx", add a script with script file -"script" and name "name" as a Lua hook if a hook with that name -does not already exist. - -#####GParameters -> "h_idx" is the index of the hook list in the array of hook lists. -> "script" is the name of the script file. -> "name" is the name of the hook to be added. - ----------------------------------------------------------------------- - -#####R=== del_hook_name === - -#####GDeclaration - void del_hook_name(int h_idx, cptr name); - -#####GFile - plots.c - -#####GComment -(none) - -#####GDescription -Search hook list with index "h_idx" and remove the hook with name -"name". - -#####GParameters -> "h_idx" is the index of the hook list in the array of hook lists. -> "name" is the name of the hook to be removed. - ----------------------------------------------------------------------- - -#####R=== pern_dofile === - -#####GDeclaration - bool pern_dofile(char *file); - -#####GFile - script.c - -#####GComment -(none) - -#####GDescription -Parse the Lua script file "file". - -#####GParameters -> "file" is the Lua script file to be parsed. - ----------------------------------------------------------------------- - -#####R=== intMod === - -#####GDeclaration - s32b intMod(s32b a, s32b b); - -#####GFile - script.c - -#####GComment -(none) - -#####GDescription -Return the result of operation "a" mod "b" (a % b). - -#####GParameters -> "a" is a number. -> "b" is a number. - ----------------------------------------------------------------------- - -#####R=== intAnd === - -#####GDeclaration - s32b intAnd(s32b a, s32b b); - -#####GFile - script.c - -#####GComment -(none) - -#####GDescription -Return the result of bitwise operation "a" AND "b" (a & b). - -#####GParameters -> "a" is a number. -> "b" is a number. - ----------------------------------------------------------------------- - -#####R=== intOr === - -#####GDeclaration - s32b intOr(s32b a, s32b b); - -#####GFile - script.c - -#####GComment -(none) - -#####GDescription -Return the result of bitwise operation "a" OR "b" (a | b). - -#####GParameters -> "a" is a number. -> "b" is a number. - ----------------------------------------------------------------------- - -#####R=== intXor === - -#####GDeclaration - s32b intXor(s32b a, s32b b); - -#####GFile - script.c - -#####GComment -(none) - -#####GDescription -Return the result of bitwise operation "a" XOR "b" (a ^ b). - -#####GParameters -> "a" is a number. -> "b" is a number. - ----------------------------------------------------------------------- - -#####R=== intShiftl === - -#####GDeclaration - s32b intShiftl(s32b a, s32b b); - -#####GFile - script.c - -#####GComment -(none) - -#####GDescription -Return the result of bitwise operation "a" << "b". - -#####GParameters -> "a" is a number. -> "b" is a number. - ----------------------------------------------------------------------- - -#####R=== intShiftr === - -#####GDeclaration - s32b intShiftr(s32b a, s32b b); - -#####GFile - script.c - -#####GComment -(none) - -#####GDescription -Return the result of bitwise operation "a" >> "b". - -#####GParameters -> "a" is a number. -> "b" is a number. - ----------------------------------------------------------------------- - -#####R=== intBitNot === - -#####GDeclaration - s32b intBitNot(s32b b); - -#####GFile - script.c - -#####GComment -(none) - -#####GDescription -Return the result of bitwise operation NOT "b" (~ b). - -#####GParameters -> "b" is a number. - ----------------------------------------------------------------------- - -#####R=== register_savefile === - -#####GDeclaration - void register_savefile(int num); - -#####GFile - loadsave.c - -#####GComment -/* - * Add num slots to the savefile - */ - -#####GDescription -Add "num" slots to the save file. - -#####GParameters -> "num" is the number of slots to add to the savefile. If num is <0 - then "num" is forced to zero. - ----------------------------------------------------------------------- - -#####R=== save_number_key === - -#####GDeclaration - void save_number_key(char *key, s32b val); - -#####GFile - util.c - -#####GComment -(none) - -#####GDescription -Save the length of key "key", the key itself, and the value "val" as -bytes in the savefile. - -#####GParameters -> "key" is the key string for the value. -> "val" is the value to be saved. - ----------------------------------------------------------------------- - - - -Back to the *****lua.hlp*0[lua help index] . - - - [[[[[gThis file by Chris Hadgis] - -- cgit v1.2.3