Difference between revisions of "Prog Section 7"
(→Item related) |
|||
(59 intermediate revisions by 8 users not shown) | |||
Line 1: | Line 1: | ||
− | + | =If Checks= | |
− | + | <i>Imagine all the things that had to occur, not only in his life, but in</i> | |
− | + | <i>everybody else's, to arrange it so on that particular night, the Big Bopper</i> | |
− | + | <i>would be in a position to live or die depending on a flipping coin. I</i> | |
− | + | <i>became so obsessed with that idea that I gradually became capable of seeing</i> | |
− | + | <i>the specifics of everybody's death."</i> | |
− | + | -- Clyde Bruckman, The X-files: Clyde Bruckman's Final Repose | |
+ | '''not''' | ||
+ | : All if checks may take an optional 'not' operator to invert their logic | ||
+ | : Example: if not ispc(var) | ||
− | + | ==CHARACTER ATTRIBUTE CHECKS== | |
− | + | : If you're trying to find out something about an actor in your prog, from their | |
− | + | : sex to the size of their wallet, this is the place to look. Pretty much every | |
− | + | : check that looks at an actor should be in here. | |
− | + | ===Basic PC Attributes (i.e. stats)=== | |
− | + | <b>if ispc(var)</b> | |
− | + | : Returns true if the target is a PC, false if not. | |
− | + | <b>if isnpc(var)</b> | |
− | + | : Returns true if the target is a NPC, false if not. | |
− | + | <b>if name(var) == Name</b> | |
− | + | : Does a straight comparison check between the name field value of the var and | |
− | + | : the provided name. Returns true if they're equal, and false if not. Other | |
− | + | : string operators can be used, such a /, which will cause the check to return true | |
− | + | : if the "Name" specified is a substring of the name field. | |
+ | : <b>NOTE:</b> As of March 2014 you can now use this with vars on the right-hand-side, just like valname. | ||
− | + | <b>if valname(var) == var2</b> | |
− | + | : Returns true if the name field value of the var is the same as the name value | |
− | + | : of var2. | |
− | + | <b>if ismale(var)</b> | |
− | + | ||
− | + | ||
− | + | ||
− | + | <b>if isfemale(var)</b> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | <b>if isneuter(var)</b> | |
− | + | : Returns true if the var is of the specified gender, and false if not. | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | <b>if sex(var) == #</b> | |
− | + | : Returns true if the var is of the sex associated with the #, and false if not. | |
− | + | : Different numeric operators may also be used. | |
− | + | : Numbers corresponding to sexes: | |
− | + | : Sexless: 0 | |
− | + | : Male: 1 | |
− | + | : Female: 2 | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | <b>if strength(var) == #</b> | |
− | + | ||
− | + | ||
− | + | ||
− | + | <b>if dexterity(var) == #</b> | |
− | + | ||
− | + | ||
− | + | ||
− | + | <b>if intelligence(var) == #</b> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | <b>if constitution(var) == #</b> | |
− | + | ||
− | + | ||
− | + | <b>if wisdom(var) == #</b> | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | <b>if charisma(var) == #</b> | |
− | + | : Returns true if the var's stat is equal to the #, false otherwise. Other numeric | |
− | + | : operators can be substituted in at will. | |
− | + | ||
− | + | ||
− | + | <b>if majorsphere(var) == [#][name]</b> | |
− | + | ||
− | + | <b>if minorsphere(var) == [#][name]</b> | |
− | + | : Can supply either a sphere number or a sphere name, such as 'spirit' | |
− | + | : Returns true if the var's major or minor sphere matches the argument. | |
+ | : Other numeric operators will also technically work, even if a name is supplied, | ||
+ | : but this is probably indicative of a hacky prog. | ||
+ | |||
+ | <b>if chosenpath(var) == [#][name]</b> | ||
+ | : Can supply either a path number or a path name, such as 'raging inferno' or 'none' | ||
+ | : Returns true if the var's chosen path matches the argument | ||
+ | : Other numeric operators will also technically work, even if a name is supplied, | ||
+ | : but this is probably indicative of a hacky prog. | ||
+ | |||
+ | <b>if auragrade(var) == #</b> | ||
+ | : Returns true if the var's aura grade matches the given criteria. | ||
+ | : Silver aura -4 | ||
+ | : Bright gold aura -3 | ||
+ | : Gold aura -2 | ||
+ | : Pale gold aura -1 | ||
+ | : No aura 0 | ||
+ | : Faint red aura 1 | ||
+ | : Red aura 2 | ||
+ | : Dark red aura 3 | ||
+ | : Black aura 4 | ||
− | + | <b>if luck(var) == {lucky|normal|unlucky} [vs var]</b> | |
− | + | : Performs an in-game luck check for the specified var, and tests whether the result came back lucky, normal, or unlucky. You may also use other operators, but in practice only == or != make sense. | |
− | + | : The result type (e.g., 'lucky') is just spelled out normally. | |
− | + | : May optionally make an opposed luck check by adding 'vs' plus a var after the normal check. This follows the normal opposed luck check rules. | |
− | + | : Example 1: if luck($n) == unlucky | |
+ | : Example 2: if luck($i) == lucky vs $n | ||
− | + | <b> if savesX(var) == #</b> | |
− | + | : Performs an in-game saves check, just like any spell. "X" is the type of effect, from the list below. # is : the level of the effect being saved against. | |
− | + | : Returns true if var makes their save, false if they don't | |
− | + | : [[DAM_NONE]] 0 | |
− | + | : [[DAM_BASH]] 1 | |
− | + | : [[DAM_PIERCE]] 2 | |
− | + | : [[DAM_SLASH]] 3 | |
− | + | : [[DAM_FIRE]] 4 | |
− | + | : [[DAM_COLD]] 5 | |
− | + | : [[DAM_LIGHTNING]] 6 | |
− | + | : [[DAM_ACID]] 7 | |
− | + | : [[DAM_POISON]] 8 | |
+ | : [[DAM_NEGATIVE]] 9 | ||
+ | : [[DAM_HOLY]] 10 | ||
+ | : [[DAM_ENERGY]] 11 | ||
+ | : [[DAM_MENTAL]] 12 | ||
+ | : [[DAM_DISEASE]] 13 | ||
+ | : [[DAM_DROWNING]] 14 | ||
+ | : [[DAM_LIGHT]] 15 | ||
+ | : [[DAM_OTHER]] 16 | ||
+ | : [[DAM_FEAR]] 17 | ||
+ | : [[DAM_CHARM]] 18 | ||
+ | : [[DAM_SOUND]] 19 | ||
+ | : [[DAM_ILLUSION]] 20 | ||
+ | : [[DAM_DEFILEMENT]] 21 | ||
− | + | <b>if isgood(var)</b> | |
− | + | ||
− | + | ||
− | + | <b>if isneutral(var)</b> | |
− | + | ||
− | + | ||
− | + | ||
+ | <b>if isevil(var)</b> | ||
+ | : Returns true if the var's alignment is of the specified type, and false if not. | ||
− | + | <b>if islawful(var)</b> | |
− | + | <b>if isbalanced(var)</b> | |
− | + | ||
− | + | ||
− | + | <b>if ischaotic(var)</b> | |
− | + | : Returns true if the var's ethos is of the specified type, and false if not. | |
− | + | ||
− | + | <b>if size(var) == # or size</b> | |
− | + | : Returns true if the var's is the specified size. The right hand argument can | |
− | + | : be either a word or a number. The word (tiny, small, medium, large, huge, giant) | |
+ | : will be translated into a number, so all numeric operators can be substituted at | ||
+ | : will. | ||
− | + | <b>if israce(var) == Race</b> | |
− | + | : Returns true if the var is of the specified race, and false if not. Race names | |
− | + | : should not be abbrieviated. | |
− | + | <b>if class(var) == #</b> | |
− | + | : Returns true if the var is of the class which is associated with the number. Other | |
− | + | : numeric operators can also be used. Class Numbers: | |
− | + | : Water scholar: 0 | |
+ | : Earth scholar: 1 | ||
+ | : Void scholar: 2 | ||
+ | : Spirit scholar: 3 | ||
+ | : Air scholar: 4 | ||
+ | : Fire scholar: 5 | ||
+ | : Water templar: 6 | ||
+ | : Earth templar: 7 | ||
+ | : Void Templar: 8 | ||
+ | : Spirit templar: 9 | ||
+ | : Air templar: 10 | ||
+ | : Fire templar: 11 | ||
+ | : Thief: 12 | ||
+ | : Watcher: 13 | ||
+ | : Assassin: 14 | ||
+ | : Bandit: 15 | ||
+ | : Fighter: 18 | ||
+ | : Swordmaster: 19 | ||
+ | : Barbarian: 20 | ||
+ | : Gladiator: 21 | ||
+ | : Ranger: 23 | ||
+ | : Gleeman: 24 | ||
+ | : Bard: 25 | ||
+ | : Alchemist: 27 | ||
+ | : Psionicist: 28 | ||
+ | : Druid: 29 | ||
− | + | <b>if level(var) == #</b> | |
− | + | : Returns true if the var's trust level is equal to the provided number, and | |
− | + | : false if not. The difference between level and trust is only significant if | |
− | + | : you have plans to prog in ways to murder other immortals, though. Other | |
− | + | : numeric operators can also be used. | |
− | + | <b>if isimmort(var)</b> | |
− | + | : Returns true if the var has their trust level set beyond 51, and false if not. | |
− | + | ||
− | + | <b>if hitprcnt(var) == #</b> | |
− | + | : Returns true if the var's hit percentage (Current hit points[[/Max]] hit points, | |
+ | : all * 100) is equal to the specified #. Other numeric operators can be substituted. | ||
− | + | <b>if adrenaline(var) == #</b> | |
− | + | : Returns true if a character's adrenaline is equal to the specifed #, and false | |
− | + | : if not. Other numeric operators can be substituted in. Automatically returns false | |
+ | : if the var is an NPC. Just for reference, a character's adrenaline is set to 20 | ||
+ | : after attacking a PC, and 2 after attacking a mob. | ||
− | + | <b>if position(var) == #</b> | |
− | + | : Returns true if the var is in the position associated with the provided #, and | |
+ | : false if not. Different numeric operators may also be used. Position numbers: | ||
+ | : Dead: 0 | ||
+ | : Mortal: 1 | ||
+ | : Incapacitated: 2 | ||
+ | : Stunned: 3 | ||
+ | : Sleeping: 4 | ||
+ | : Resting: 5 | ||
+ | : Sitting: 6 | ||
+ | : Fighting: 7 | ||
+ | : Standing: 8 | ||
− | + | <b>if goldamt(var) == #</b> | |
− | + | : Returns true if the var has the specified amount of gold. Other numeric operators | |
+ | : can also be used. | ||
− | + | <b>if skill[vnum of skill](var) == #</b> | |
− | + | : This check returns true if the var's skill level is equal to the specified number, | |
− | + | : and false otherwise. For example, if skill192($n) == 100 would return true if $n | |
− | + | : had 100% in hide (which has a vnum of 192). See [[Skill/Spell vnums]] for the vnums available, or | |
− | + | : use the <i>vnum</i> command to look up the desired skill. | |
− | + | <b>if isundead(var)</b> | |
− | + | : Returns true if the var is considered undead. | |
− | + | : Sample Usage: | |
− | + | :: if not isundead($n) | |
− | + | ::: mprangekill $n | |
− | + | :: endif | |
+ | : This would cause the thing containing the prog to attack something that is not undead, paying respect to PK range. | ||
− | + | == Task Checks == | |
− | + | ||
− | + | ||
− | + | <b>if hastask(var) == value</b> | |
− | + | : Returns true if the mob who has this prog has a task hub, var has a task from that mob, and value is the index of the specified prog. For example, if you wanted to check $n for if they have task slot 1 active, you would use the syntax "if hastask($n) == 1". this check will fail if it is originating from anything other than the origin mob. | |
− | + | ||
− | + | <b>if hascooldown(var) == value</b> | |
− | + | : Returns true if <i>var</i> has an active cooldown for task <i>value</i> from the originating mob. The syntax and functionality works the same as hastask() above. | |
− | + | ||
− | + | <b>if hascompleted(var) == value</b> | |
− | + | : Returns true if <i>var</i> has an entry for task <i>value</i> from the originating mob. The syntax and functionality works the same as hastask() above. | |
− | + | <b>if task<mob>(var) == value</b> | |
− | + | : Returns true if <i>var</i> has an active task for origin <i>mob</i> of slot <i>value</i>. Unlike the other checks, this can be used in any type of prog. See <i>if skill</i> for more details. | |
− | + | ||
− | + | ==Affect/Status Checks== | |
− | + | ||
− | + | ||
− | + | <b>if shopopen() == 1</b> | |
− | + | : Returns true if the shop is open, false if not. Note that this can have some strange results if a shop is open past midnight; in those cases you should be using if istime() and check it that way. | |
− | + | <b>if isbitset(var) == Bit #</b> | |
− | + | : Returns true if the var's bit # is true, and false if not. Should be confined to | |
+ | : PC's. | ||
− | + | <b>if iscriminal(var)</b> | |
− | + | : Returns true if the var is a criminal, and false if not. Should be confined to | |
+ | : PC's, for obvious reasons. | ||
− | + | <b>if inhouse(var) == House</b> | |
− | + | : Returns true if the var is in the specified house. House names should be singular, | |
− | + | : and unabbrieviated. | |
− | + | <b>if isinhouse(var)</b> | |
− | + | : Returns true if the var is marked as being of the same house as the room he is in | |
− | + | : (i.e. a Raider standing in the Raider Canyon). | |
− | + | <b>if snaffected(var) == vnum of spell affect</b> | |
− | + | : Returns true if the var is affected by the affect, specified by the given vnum. The | |
− | + | : vnum should be greater than 0. To use this check with an object, simply leave the | |
− | + | : var field blank. | |
− | + | <b>if roomaffected(var) == skill_vnum</b> | |
− | + | : Returns true if the room the variable is in is affected by a given vnum. Long thought not to exist. | |
− | + | <b>if isaffected(var) == Bit number of the affect</b> | |
− | + | : Returns true if the var is affected by the affect, specified by the bit number. | |
− | + | : Genuinely scorned since the advent of the much simpler snaffected, this could still | |
+ | : be useful if you want to target multiple affects that all use the same bit, like | ||
+ | : flight and its variants. | ||
− | + | <b>if isghost(var)</b> | |
− | + | : Returns true if the var is a ghost, and false if not. Should probably be used on any | |
− | + | : progs which would ordinarily do brutal things to a person. | |
− | + | ||
− | + | ||
− | + | <b>if isastral(var)</b> | |
− | + | : Returns true if the var is affected by astral projection, and false if not. | |
− | + | <b>if isflying(var)</b> | |
− | + | : Returns true if the var is flying. This includes all forms of flight, including | |
− | + | : levitation, mass flight, etc. | |
− | + | <b>if hasboat(var)</b> | |
− | + | : Returns true if var has an item of type boat in their inventory. | |
− | + | <b>if iswizi(var)</b> | |
− | + | : Returns true if the var is wizi, false if not. | |
− | + | ||
− | + | ||
− | + | ||
− | + | <b>if isindoors(var)</b> | |
− | + | : Returns true if the room the var is in is flagged with the "indoors" flag, and false | |
− | + | : if not. Keep in mind that as of this moment, this check only works for the room flag | |
− | + | : "indoors." It does not check for the room's sector, so it will still return false even | |
+ | : if the sector is "inside." | ||
+ | |||
+ | <b>if isfight(var) == name</b><p> | ||
+ | <b>if isfighting(var) == name</b> | ||
+ | : The same code with two different names, these return true if the var is fighting the | ||
+ | : mob or PC with the specified name, and false if not. The != operator can also be used | ||
+ | : with this check. If used without a name and operator, then the check will simply check | ||
+ | : whether or not the var is fighting at all. | ||
+ | |||
+ | <b>if tanking(var)</b> | ||
+ | : Returns true if the var is tanking something, and false if not. Common sense dictates | ||
+ | : that this should be restricted to situations where the var is fighting. | ||
+ | |||
+ | <b>if istracking(var)</b> | ||
+ | : Only to be called from a mob, this returns true if the mob is tracking the var, and | ||
+ | : false if not. | ||
+ | |||
+ | <b>if istrack(var)</b> | ||
+ | : Returns true if the var (which should probably be referencing a mob) is tracking, and | ||
+ | : false if not. | ||
+ | |||
+ | <b>if ischarmed(var)</b> | ||
+ | : Returns true if the var is affected by any form of charm, and false if not. | ||
+ | |||
+ | <b>if ismaster(var)</b> | ||
+ | : To be called only from a mob, this returns true if the var is the mob's master, and | ||
+ | : false if not. | ||
+ | |||
+ | <b>if isfollow(var)</b> | ||
+ | : Returns true if both a) var is following a person A, and b) var is in the same room | ||
+ | : as person A. | ||
+ | |||
+ | <b>if isgroup(var) & var2</b> | ||
+ | : Returns true if var and var2 are grouped, false if not. | ||
+ | |||
+ | <b>if isrange(var) == var2</b> | ||
+ | : Returns true if var is in var2's PK range, and false otherwise. | ||
+ | |||
+ | <b>if cansee(var) == var2</b> | ||
+ | : Returns true if var can see var2, and false if not. | ||
+ | |||
+ | <b>if hastrait([var]) == <traitname></b> | ||
+ | : This if check returns true if the is a PC and has the trait specified by traitname. | ||
+ | |||
+ | <b>if lagged(var)</b> | ||
+ | : If lagged returns true if a pc currently has a wait state of greater than zero. In | ||
+ | : general, this is true if the pc is currently bashed, busy casting a spell, or mplagged. | ||
+ | |||
+ | <b>if hassymbol(var) == #</b> | ||
+ | : This if check is used to see if the target has a particular void scholar symbol. Here, | ||
+ | : the argument is the last two digits of the symbol’s vnum. | ||
+ | |||
+ | <b>if language(var) == <language></b> | ||
+ | : This if check returns true if the target variable is speaking the given language. Here | ||
+ | : language is just one of the selected race names, with the exception of the ch’taren, | ||
+ | : who are denoted by "chtaren" (to spare the difficulty of parsing single quotes). | ||
+ | |||
+ | <b>if isanimal(var)</b> | ||
+ | : This if check returns true if the target is [[ACT_ANIMAL]]. | ||
+ | |||
+ | <b>if haspath(npc)</b> | ||
+ | : If haspath returns true if the target npc has a recorded path, as generated by the | ||
+ | : mppath command. | ||
+ | |||
+ | <b>if isfriend(<target>) [== faction number]</b><br> | ||
+ | <b>if isenemy(<target>) [== faction number]</b> | ||
+ | : Returns true if the target is a friend (for isfriend) or enemy (for isenemy) | ||
+ | : of the given faction. If the faction number is ommited, it uses the faction | ||
+ | : of the mob performing the check. | ||
+ | |||
+ | <b>if acctpoints(var) == #</b> | ||
+ | : Returns true if the target has that many account points. | ||
+ | |||
+ | <B>if isplaying(var) == song_skill_vnum <br> | ||
+ | if isharmonizing(var) == song_skill_vnum</B> | ||
+ | : Returns true if the target is playing (for isplaying) or is harmonizing (for isharmonizing) the given song. | ||
+ | : Note for older area builders: mobs <i>are</i> now able to play songs. | ||
+ | <br> | ||
+ | : Working example: [ 7085] Ilasa Eideo | ||
+ | |||
+ | ==Memory Checks== | ||
+ | : This section is fairly self-explanatory. If you've got to check up the slots on anything, | ||
+ | : be it bits, focuses, or mpvalues, this is the if-check section for you. | ||
+ | |||
+ | <b>if isbitset(var) == Bit #</b> | ||
+ | : Returns true if the var's bit # is true, and false if not. Should be confined to PC's. | ||
+ | |||
+ | <b>if mobvcheck(var) == #</b> | ||
+ | : Used in conjunction with mob memory, this check returns true if the value the mob | ||
+ | : associates with the var is equal to the #. Of course, other numeric operators may be | ||
+ | : used. Keep in mind that unlike bits, mob memory is stored on the mob itself, so if it | ||
+ | : dies, all such memory will be cleared. | ||
+ | |||
+ | <b>if value(value slot) == #</b> | ||
+ | |||
+ | <b>if mobvalue(mob slot) == #</b> | ||
+ | |||
+ | <b>if objvalue(obj slot) == #</b> | ||
+ | |||
+ | <b>if roomvalue(room slot) == #</b> | ||
+ | |||
+ | : Returns true if the # is equal to the value held by the slot. Slots number from | ||
+ | : 0 to 9, and can be set with the mpvalue commands. Other numeric operators can be | ||
+ | : substituted. NOTE: the newer "if value" works on rooms, mobs, or objects, and is | ||
+ | : generally preferred over the older checks. | ||
+ | |||
+ | <b>if value(local variable) == string</b> | ||
+ | |||
+ | : Value also works to check local variables. Example: | ||
+ | mpvalueset feeling happy | ||
+ | if value(feeling) == happy | ||
+ | smile | ||
+ | else | ||
+ | frown | ||
+ | endif | ||
− | |||
− | |||
− | |||
− | |||
− | + | <b>if remembers(var)</b> | |
− | + | : This checks whether or not a player has been stored within a mob's memory, via | |
− | + | : the mpremember command. | |
− | + | <b>if isfocused(var) [== <0|1>]</b> | |
− | + | : Returns true if the var is focused on something, and false if not. In the case of | |
− | + | : objects and rooms, just leave the var field blank. | |
+ | : The optional numerical argument indicates which slot to check; if left blank, slot 0 is checked | ||
+ | <b>if newbie(var)</b> | ||
+ | : Returns true if the var is flagged newbie and is a PC. Returns false otherwise. | ||
+ | : Var must have answered yes to "Are you new to Avendar?". | ||
− | + | ==Environmental Checks== | |
− | + | : This section deals primarily with if checks that describe the area surrounding the | |
− | + | : actor, otherwise known as the environment. | |
− | + | <b>if isanypcarea()</b> | |
− | + | : Returns true if there are any PC's in the area, and false if not. | |
− | + | <b>if isanypchere(var)</b> | |
− | + | : Returns true if there are any PC's in the room that the prog is called from, and | |
− | + | : false if not. | |
− | + | <b>if isanynpchere(var)</b> | |
− | + | : Returns true if there are any NPC's in the room that the prog is called from, and | |
− | + | : false if not. | |
+ | <b>if isanyobjere(var)</b> | ||
+ | : Returns true if there are any objects in the room that the prog is called from, and | ||
+ | : false if not. | ||
+ | <b>if objhere(vnum of object)</b> | ||
+ | : Checks whether or not the object of the specified vnum is in the same room as the | ||
+ | : calling mob/object. | ||
− | + | <b>if mobhere(vnum of mob)</b> | |
− | + | : Returns true if the calling mob/object is in the same room as the specified mob, and | |
− | + | : false if not. | |
− | + | <b>if ishere(var)</b> | |
− | + | : This check returns true if the calling mob/object is in the same room as the var, and | |
− | + | : false if not. | |
− | + | <b>if inroom(var) == vnum of room</b> | |
− | + | : Returns true if the var or calling object is in the room specified by the vnum. Other | |
− | + | : numeric operators can be substituted in. If called from an object, leave the var field | |
+ | : blank. The if check will return whether or not the calling object is in the specified room. | ||
− | + | <b>if inarea(var)</b> | |
− | + | : Returns true if the var is in the same area as the calling mob/object. | |
− | + | ||
− | + | <b>if isopen(var) == # or Direction</b> | |
− | + | : Returns true if there are no closed doors to the var's specified direction, and false | |
− | + | : if not. | |
− | + | : | |
+ | : NEW AS OF SPRING 2014: Will also return false if there is no exit in the direction. | ||
+ | : | ||
+ | : If this check is called by an object, then leave the var field blank. Note that | ||
+ | : the way this is phrased means that the path just has to be open, there does not have to | ||
+ | : be an actual door in the way. var can also be an object. List of numbers that correspond | ||
+ | : to directions: | ||
+ | : North 0 | ||
+ | : East 1 | ||
+ | : South 2 | ||
+ | : West 3 | ||
+ | : Up 4 | ||
+ | : Down 5 | ||
− | + | <b>if isseason() == # or season</b> | |
− | + | : Returns true if the current season is the same as the one specified. Names will be | |
+ | : converted automatically into their numeric equivalents, so you can feel free to use an | ||
+ | : operator other than ==. List of numbers that correspond to the seasons: | ||
+ | : spring 0 | ||
+ | : summer 1 | ||
+ | : autumn 2 | ||
+ | : winter 3 | ||
− | + | : NOTE: # doesn't seem to work, but the season name does. -Dov 8/28/13 | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | <b>if isphase() == #</b> <b>if rhosphase() == #</b> | |
− | + | : isphase for lunus due to poor planning, rhosphase for rhos. Returns true if that moon's | |
− | + | : current phase is equivalent to the specified number. Note that there is no text | |
− | + | : conversion, so you'll have to plot this out yourself. Since it's working with numbers, | |
− | + | : other numerical operators should be accepted without difficulty. List of numbers | |
− | + | : corresponding to the phases of the moon: | |
− | + | : Waning gibbous in the sky 0 | |
− | + | : Waning in the sky 1 | |
+ | : Waning crescent in the sky 2 | ||
+ | : Currently new 3 | ||
+ | : Waxing crescent in the sky 4 | ||
+ | : Waxing in the sky 5 | ||
+ | : Waxing gibbous in the sky 6 | ||
+ | : Currently full 7 | ||
− | + | <b>if rhossize() == #</b> | |
− | + | : Tiny 0 | |
− | + | : Small 1 | |
− | + | : Medium 2 | |
− | + | : Large 3 | |
− | + | : Huge 4 | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | <b>if islight()</b> | |
− | + | : Returns true if the sun is currently up. The actual hours vary from season to season. | |
− | + | <b>if isday() == #</b> | |
− | + | : Returns true if # is equal to the day of the month. Other numeric operators can be | |
− | + | : substituted in. | |
− | + | <b>if isdayofweek() == #</b> | |
− | + | : 0 - Lyrensday | |
− | + | : 1 - Iolenday | |
− | + | : 2 - Thelansday | |
− | + | : 3 - Endenday | |
− | + | : 4 - Nimensday | |
− | + | : 5 - Thethelsday | |
− | + | : 6 - Evenday | |
− | + | <b>if istime() == # </b> | |
− | + | : Returns true if # is equal to the current hour, numbering from 0 to 23. Other numeric | |
− | + | : operators can be substituted in. | |
− | + | <b>if roomflag(var) == <room flag name></b> | |
− | + | : This if check returns true if the room has the flag specified. Valid room flags include: | |
− | + | : dark, nogate, no_mob, indoors, nosum_to, nosum_from, noneforyou, vault, noyell, private, | |
− | + | : safe, solitary, pet_shop, no_recall, imp_only, gods_only, heroes_only, newbies_only, law, | |
− | + | : nowhere, nomagic, guild, noweather, uberdark, power_nexus, rough, has_water | |
− | + | <b>if sector(var) == <sector name></b> | |
− | + | : This if check returns true if the target is located in the sector with the specified name. | |
− | + | : Valid sectors include: | |
− | + | : inside, city, field, forest, hills, mountain, swim, noswim, air, desert, underwater, | |
− | + | : underground, road, swamp. | |
+ | <b>if precip(var) == #</b> | ||
+ | : -1 : Invalid; underground, or in a NOWEATHER room | ||
+ | : 0 : No precipitation | ||
+ | : 1 : Light rain/snow | ||
+ | : 2 : Rain/snow | ||
+ | : 3 : Heavy rain/snow, or the magical affect icestorm | ||
− | + | <b>if cloudcover(var) == #</b> | |
− | + | : # = % of the sky that is covered with clouds. | |
− | + | <b>if month() == <month number></b> | |
− | + | : Checks the month. Hopefully it takes other operators! | |
− | + | ||
− | + | ||
− | + | ==Item related== | |
− | + | : The following if-checks are used to describe items, or their relation to the actor. | |
− | + | ||
+ | <b>if objtargetcarry()</b> | ||
+ | : This check returns true when the object with the verb_prog is both in the character's | ||
+ | : inventory and is also the object (or target) of the command. This is | ||
+ | : helpful (or essential!) in situations with multiple objects having the same verb_progs. | ||
+ | : Example: | ||
+ | : This check returns true for "eat apple" from a <b>verb_prog eat</b>, only if the obj | ||
+ | : with the verb_prog is carried and also has "apple" in its name (ie, is the target). | ||
+ | : This distinguishes the item from other, non-progged apples that might be in the | ||
+ | : inventory, and also from other <b>verb_prog eat</b>-bearing items that are not | ||
+ | : apples (such as pears). | ||
+ | : See obj 22458 for the canonical example. | ||
+ | |||
+ | <b>if objtargetwear()</b> | ||
+ | : As with objtargetcarry(), but the object targetted must be worn/wielded/held and | ||
+ | : not just in the inventory. | ||
+ | |||
+ | <b>if isharvested()</b> | ||
+ | : Much like objtargetwear(), this has no target and is used on an object prog. If the | ||
+ | : object in question is a node, this check will determine if that node has been harvested | ||
+ | : recently by the character who triggered the prog. | ||
+ | |||
+ | <b>if incontainer(vnum)</b> | ||
+ | : Returns true if object is inside the container with prog. If vnum is omitted, returns | ||
+ | : true if container contains anything if vnum is omitted. Obviously, to be used with | ||
+ | : progs on containers. | ||
+ | |||
+ | <b>if isoverlimit(vnum of object)</b> | ||
+ | : Used to check an item's limits for various item loading progs. Returns true if the | ||
+ | : current number of the item is greater than the item limit. | ||
[ 34] Transmitt: Limit bugs on your progs. | [ 34] Transmitt: Limit bugs on your progs. | ||
Line 479: | Line 627: | ||
- tm | - tm | ||
− | + | <b>if iswielding(var) == vnum of the object</b> | |
− | + | : A bit of a misnomer, this returns true if the var is wearing the specified object, | |
− | + | : and false if not. As such, the vnum does not have to be restricted merely to weapons, | |
− | + | : but can be applied to any item that can be worn. | |
− | + | <b>if allcarrycount(var) == num</b> | |
− | + | : Returns true if the var is carrying the number of objects specified, regardless of | |
− | + | : whether the var can see the objects. Other numeric operators are acceptable. This applies | |
− | + | : to inventory and worn items both. | |
− | + | <b>if carrycount(var) == num</b> | |
− | + | : Returns true if the var is carrying the number of objects specified, not counting | |
− | + | : objects the var cannot see. Other numeric operators are acceptable. This applies | |
− | + | : to inventory and worn items both. | |
− | + | ||
− | + | ||
− | + | <b>if iscarrying(var) == vnum of the object</b><br/> | |
− | + | <b>if iscarrying(var) == full name of the object</b> | |
− | + | : Returns true if the var is carrying the specified object, and false if not. This | |
+ | : includes everything in the iswielding check, and further goes through the var's | ||
+ | : inventory. Keep in mind that the full name of the object must be used for the string version, | ||
+ | : which is often hard to come by. See mpresolve for one way to get it. | ||
− | + | <b>if isowner(var)</b> | |
− | + | <b>if isheld(var)</b> | |
− | + | : Restricted to obj progs, this is predominantly used in verb progs to make sure | |
− | + | : that only the person who actually has the object is activating the verb. These | |
− | + | : checks will return true if the var is the owner of the object, and false if not. | |
− | + | : Keep in mind that they are identical, meaning that isheld is a bit of a misnomer. | |
− | + | ||
− | + | <b>if isworn(var)</b> | |
− | + | : Isworn returns true if the calling object is being worn by the specified var, | |
− | + | : and false if not. Isworn should only be called from an object. | |
− | + | ||
− | + | <b>if iswearslotfull(var) == #</b> | |
− | + | : Returns true if the wear slot, specified by the #, is full. Here are the slot | |
− | + | : numbers. Slot number is from 1-22. | |
− | + | : 0: Light | |
− | + | : 1: Left finger | |
− | + | : 2: Right finger | |
− | + | : 3: Neck1 | |
− | + | : 4: Neck2 | |
− | + | : 5: Torso | |
− | + | : 6: Head | |
− | + | : 7: Legs | |
− | + | : 8: Feet | |
− | + | : 9: Hands | |
− | + | : 10: Arms | |
− | + | : 11: Shield | |
+ | : 12: Body | ||
+ | : 13: Waist | ||
+ | : 14: Wrist | ||
+ | : 15: Wrist | ||
+ | : 16: Wielded | ||
+ | : 17: Held | ||
+ | : 18: Floating | ||
+ | : 19: Dual wielded | ||
+ | : 20: Branded | ||
+ | : 21: Concealed | ||
+ | : 22: Concealed | ||
− | + | <b>if objtype() == #</b> | |
− | + | : Returns true if the calling object is of the type specified by the number. | |
− | + | : Objtype numbers: | |
− | + | : Light: 1 | |
− | + | : Scroll: 2 | |
− | + | : Wand: 3 | |
− | + | : Staff: 4 | |
− | + | : Weapon: 5 | |
− | + | : Treasure: 8 | |
− | + | : Armor: 9 | |
− | + | : Potion: 10 | |
− | + | : Clothing: 11 | |
− | + | : Furniture: 12 | |
− | + | : Trash: 13 | |
− | + | : Container: 15 | |
− | + | : Drink Container: 17 | |
− | + | : Key: 18 | |
− | + | : Food: 19 | |
− | + | : Money: 20 | |
− | + | : Boat: 22 | |
− | + | : NPC Corpse: 23 | |
− | + | : PC Corpse: 24 | |
− | + | : Fountain: 25 | |
− | + | : Pill: 26 | |
− | + | : Protect: 27 | |
− | + | : Map: 28 | |
− | + | : Potal: 29 | |
− | + | : Warp Stone: 30 | |
− | + | : Room Key: 31 | |
− | + | : Gem: 32 | |
− | + | : Jewelry: 33 | |
− | + | : Jukebox: 34 | |
− | + | : Instrument: 35 | |
− | + | : Net: 36 | |
− | + | : Arrow: 37 | |
− | + | : Bow: 38 | |
− | + | <b>if objval0() == #</b> | |
− | + | <b>if objval1() == #</b> | |
− | + | <b>if objval2() == #</b> | |
− | + | <b>if objval3() == #</b> | |
− | + | : Returns true if the object's v(0-3) slot is equal to the specified number. Other | |
− | + | : numeric operators can also be used. | |
+ | |||
+ | <b>if material() == Material type</b> | ||
+ | : Primarily for use in a give_prog, which will automatically reference the given object. | ||
+ | : Returns true if the given object is of the specified material, and false if not. | ||
− | + | <b>if perminvis([var])</b> | |
− | + | : If perminvis returns true if the target object is permanently invisible. If used in | |
− | + | : a give_prog, a blank argument can be specified, and it will default to targeting the | |
+ | : object which triggers the give_prog. | ||
− | + | <b>if recentowner([var]) == <name></b> | |
− | + | : This if check returns true if the name specified was a recent owner of a target. If | |
− | + | : used with a give_prog, no argument is needed, as it will default to targetting the | |
− | + | : triggering object of the prog. | |
− | + | <b>if isunderlimit(<vnum>)</b> | |
− | + | : This ifcheck determines, well, if the eq is under limit. Useful for alternative ways of | |
− | + | : loading limited equipment. | |
− | + | ||
− | + | <b>if objfrom(var) == <animal|celestial></b> | |
− | + | : This if check determines whether the target object is a part from an animal or a | |
+ | : celestial being. Originally designed for use with demon payments, it may find other | ||
+ | : application. When used in a give_prog, a blank target can be substituted, and it will | ||
+ | : default to using the trigger object for the give_prog. | ||
− | + | <b>if fountainhere()</b> | |
− | + | : Checks if there's a fountain here. Please use with with a var, as I think it crashes | |
− | + | : us without one. This does not currently work with objects. | |
− | + | <b>if level41corpsehere()</b> | |
− | + | : This if check returns true if a pc corpse of level 41 or higher is here. | |
− | + | ||
− | + | ||
− | + | ||
− | + | <b>if number([var]) == <vnum></b> | |
− | + | : This if check returns true if the target is of the given vnum. It can also be used | |
− | + | : without an argument in conjunction with a give_prog, in which case it will default | |
+ | : to targetting on the give_prog’s trigger. | ||
+ | : NOTE from Dov Jan 2014: this could be clearer -- the check works for mobs too, it seems (such as a mob who activates | ||
+ | : its own verb_prog -- see Tyvor's verb_prog) | ||
− | + | <b>If weight() == <value></b> | |
− | + | ||
− | + | :For mobs/characters, returns the weight of their carried gear. For objects, returns the object's weight. Keep in mind that weights are reported in 10ths of units. | |
− | + | : Presumably this works with <, >, <=, and >=. Found this in an old note from Aeolis with only the above line for documentation, so user beware! | |
− | + | ||
− | + | ||
+ | ==Miscellaneous== | ||
− | + | <b>if rand(#)</b> | |
+ | : Generates a random number between 1 and 100, returning true if it is less than the #, | ||
+ | : and false if it is not. | ||
− | + | <b>if port() == #</b> | |
− | + | : Tests the current port the MUD is running on; mostly used to distinguish production | |
− | + | : from development in progs. Can use other operators as well (<, <=, >, >=, !=). | |
− | + | ===String checking=== | |
− | + | <b>if compstr(#) == arg</b> | |
− | + | : This takes in the character's input, and checks to see if the #th word is equivalent | |
− | + | : to the arg. Used primarily for verb_progs, it's advised that the operator be | |
− | + | : restricted to == and !=. | |
− | + | <b>if compx() == arg</b> | |
− | + | : This checks to see if the arg is anywhere within the string. Again, restrict yourself | |
− | + | : to == and !=. | |
− | + | <b>if regex() == <regular expression></b> | |
− | + | : Returns true if the text ($x) variable is matched by the regular expression. Those of | |
− | + | : you who don't know what a 'regular expression' is probably won't find too much use for | |
− | + | : it, but it should be very useful for those who do. | |
− | + | ===Junk=== | |
− | + | <b>if demonstate() == #</b> | |
− | + | : Ashurian madness. Used for greater demon crap, somehow. Don't ask me. | |
− | + | <b>if hasrelief(var)</b> | |
− | + | : An antiquated check for the Raider vault items. It checks to see if the var is holding | |
− | + | : on to the four items. There's pretty much no reason to learn this check. | |
− | + | <b>if isweather() == #</b> | |
− | + | : Currently broken. Will automatically return false until further notice. | |
− | + | <b>if isexists()</b> | |
− | + | : Broken, do not use. | |
− | + | [[category: Leviticus]] | |
− | [[ | + |
Latest revision as of 09:45, 17 April 2019
Contents
If Checks
Imagine all the things that had to occur, not only in his life, but in everybody else's, to arrange it so on that particular night, the Big Bopper would be in a position to live or die depending on a flipping coin. I became so obsessed with that idea that I gradually became capable of seeing the specifics of everybody's death." -- Clyde Bruckman, The X-files: Clyde Bruckman's Final Repose
not
- All if checks may take an optional 'not' operator to invert their logic
- Example: if not ispc(var)
CHARACTER ATTRIBUTE CHECKS
- If you're trying to find out something about an actor in your prog, from their
- sex to the size of their wallet, this is the place to look. Pretty much every
- check that looks at an actor should be in here.
Basic PC Attributes (i.e. stats)
if ispc(var)
- Returns true if the target is a PC, false if not.
if isnpc(var)
- Returns true if the target is a NPC, false if not.
if name(var) == Name
- Does a straight comparison check between the name field value of the var and
- the provided name. Returns true if they're equal, and false if not. Other
- string operators can be used, such a /, which will cause the check to return true
- if the "Name" specified is a substring of the name field.
- NOTE: As of March 2014 you can now use this with vars on the right-hand-side, just like valname.
if valname(var) == var2
- Returns true if the name field value of the var is the same as the name value
- of var2.
if ismale(var)
if isfemale(var)
if isneuter(var)
- Returns true if the var is of the specified gender, and false if not.
if sex(var) == #
- Returns true if the var is of the sex associated with the #, and false if not.
- Different numeric operators may also be used.
- Numbers corresponding to sexes:
- Sexless: 0
- Male: 1
- Female: 2
if strength(var) == #
if dexterity(var) == #
if intelligence(var) == #
if constitution(var) == #
if wisdom(var) == #
if charisma(var) == #
- Returns true if the var's stat is equal to the #, false otherwise. Other numeric
- operators can be substituted in at will.
if majorsphere(var) == [#][name]
if minorsphere(var) == [#][name]
- Can supply either a sphere number or a sphere name, such as 'spirit'
- Returns true if the var's major or minor sphere matches the argument.
- Other numeric operators will also technically work, even if a name is supplied,
- but this is probably indicative of a hacky prog.
if chosenpath(var) == [#][name]
- Can supply either a path number or a path name, such as 'raging inferno' or 'none'
- Returns true if the var's chosen path matches the argument
- Other numeric operators will also technically work, even if a name is supplied,
- but this is probably indicative of a hacky prog.
if auragrade(var) == #
- Returns true if the var's aura grade matches the given criteria.
- Silver aura -4
- Bright gold aura -3
- Gold aura -2
- Pale gold aura -1
- No aura 0
- Faint red aura 1
- Red aura 2
- Dark red aura 3
- Black aura 4
if luck(var) == {lucky|normal|unlucky} [vs var]
- Performs an in-game luck check for the specified var, and tests whether the result came back lucky, normal, or unlucky. You may also use other operators, but in practice only == or != make sense.
- The result type (e.g., 'lucky') is just spelled out normally.
- May optionally make an opposed luck check by adding 'vs' plus a var after the normal check. This follows the normal opposed luck check rules.
- Example 1: if luck($n) == unlucky
- Example 2: if luck($i) == lucky vs $n
if savesX(var) == #
- Performs an in-game saves check, just like any spell. "X" is the type of effect, from the list below. # is : the level of the effect being saved against.
- Returns true if var makes their save, false if they don't
- DAM_NONE 0
- DAM_BASH 1
- DAM_PIERCE 2
- DAM_SLASH 3
- DAM_FIRE 4
- DAM_COLD 5
- DAM_LIGHTNING 6
- DAM_ACID 7
- DAM_POISON 8
- DAM_NEGATIVE 9
- DAM_HOLY 10
- DAM_ENERGY 11
- DAM_MENTAL 12
- DAM_DISEASE 13
- DAM_DROWNING 14
- DAM_LIGHT 15
- DAM_OTHER 16
- DAM_FEAR 17
- DAM_CHARM 18
- DAM_SOUND 19
- DAM_ILLUSION 20
- DAM_DEFILEMENT 21
if isgood(var)
if isneutral(var)
if isevil(var)
- Returns true if the var's alignment is of the specified type, and false if not.
if islawful(var)
if isbalanced(var)
if ischaotic(var)
- Returns true if the var's ethos is of the specified type, and false if not.
if size(var) == # or size
- Returns true if the var's is the specified size. The right hand argument can
- be either a word or a number. The word (tiny, small, medium, large, huge, giant)
- will be translated into a number, so all numeric operators can be substituted at
- will.
if israce(var) == Race
- Returns true if the var is of the specified race, and false if not. Race names
- should not be abbrieviated.
if class(var) == #
- Returns true if the var is of the class which is associated with the number. Other
- numeric operators can also be used. Class Numbers:
- Water scholar: 0
- Earth scholar: 1
- Void scholar: 2
- Spirit scholar: 3
- Air scholar: 4
- Fire scholar: 5
- Water templar: 6
- Earth templar: 7
- Void Templar: 8
- Spirit templar: 9
- Air templar: 10
- Fire templar: 11
- Thief: 12
- Watcher: 13
- Assassin: 14
- Bandit: 15
- Fighter: 18
- Swordmaster: 19
- Barbarian: 20
- Gladiator: 21
- Ranger: 23
- Gleeman: 24
- Bard: 25
- Alchemist: 27
- Psionicist: 28
- Druid: 29
if level(var) == #
- Returns true if the var's trust level is equal to the provided number, and
- false if not. The difference between level and trust is only significant if
- you have plans to prog in ways to murder other immortals, though. Other
- numeric operators can also be used.
if isimmort(var)
- Returns true if the var has their trust level set beyond 51, and false if not.
if hitprcnt(var) == #
- Returns true if the var's hit percentage (Current hit points/Max hit points,
- all * 100) is equal to the specified #. Other numeric operators can be substituted.
if adrenaline(var) == #
- Returns true if a character's adrenaline is equal to the specifed #, and false
- if not. Other numeric operators can be substituted in. Automatically returns false
- if the var is an NPC. Just for reference, a character's adrenaline is set to 20
- after attacking a PC, and 2 after attacking a mob.
if position(var) == #
- Returns true if the var is in the position associated with the provided #, and
- false if not. Different numeric operators may also be used. Position numbers:
- Dead: 0
- Mortal: 1
- Incapacitated: 2
- Stunned: 3
- Sleeping: 4
- Resting: 5
- Sitting: 6
- Fighting: 7
- Standing: 8
if goldamt(var) == #
- Returns true if the var has the specified amount of gold. Other numeric operators
- can also be used.
if skill[vnum of skill](var) == #
- This check returns true if the var's skill level is equal to the specified number,
- and false otherwise. For example, if skill192($n) == 100 would return true if $n
- had 100% in hide (which has a vnum of 192). See Skill/Spell vnums for the vnums available, or
- use the vnum command to look up the desired skill.
if isundead(var)
- Returns true if the var is considered undead.
- Sample Usage:
- if not isundead($n)
- mprangekill $n
- endif
- if not isundead($n)
- This would cause the thing containing the prog to attack something that is not undead, paying respect to PK range.
Task Checks
if hastask(var) == value
- Returns true if the mob who has this prog has a task hub, var has a task from that mob, and value is the index of the specified prog. For example, if you wanted to check $n for if they have task slot 1 active, you would use the syntax "if hastask($n) == 1". this check will fail if it is originating from anything other than the origin mob.
if hascooldown(var) == value
- Returns true if var has an active cooldown for task value from the originating mob. The syntax and functionality works the same as hastask() above.
if hascompleted(var) == value
- Returns true if var has an entry for task value from the originating mob. The syntax and functionality works the same as hastask() above.
if task<mob>(var) == value
- Returns true if var has an active task for origin mob of slot value. Unlike the other checks, this can be used in any type of prog. See if skill for more details.
Affect/Status Checks
if shopopen() == 1
- Returns true if the shop is open, false if not. Note that this can have some strange results if a shop is open past midnight; in those cases you should be using if istime() and check it that way.
if isbitset(var) == Bit #
- Returns true if the var's bit # is true, and false if not. Should be confined to
- PC's.
if iscriminal(var)
- Returns true if the var is a criminal, and false if not. Should be confined to
- PC's, for obvious reasons.
if inhouse(var) == House
- Returns true if the var is in the specified house. House names should be singular,
- and unabbrieviated.
if isinhouse(var)
- Returns true if the var is marked as being of the same house as the room he is in
- (i.e. a Raider standing in the Raider Canyon).
if snaffected(var) == vnum of spell affect
- Returns true if the var is affected by the affect, specified by the given vnum. The
- vnum should be greater than 0. To use this check with an object, simply leave the
- var field blank.
if roomaffected(var) == skill_vnum
- Returns true if the room the variable is in is affected by a given vnum. Long thought not to exist.
if isaffected(var) == Bit number of the affect
- Returns true if the var is affected by the affect, specified by the bit number.
- Genuinely scorned since the advent of the much simpler snaffected, this could still
- be useful if you want to target multiple affects that all use the same bit, like
- flight and its variants.
if isghost(var)
- Returns true if the var is a ghost, and false if not. Should probably be used on any
- progs which would ordinarily do brutal things to a person.
if isastral(var)
- Returns true if the var is affected by astral projection, and false if not.
if isflying(var)
- Returns true if the var is flying. This includes all forms of flight, including
- levitation, mass flight, etc.
if hasboat(var)
- Returns true if var has an item of type boat in their inventory.
if iswizi(var)
- Returns true if the var is wizi, false if not.
if isindoors(var)
- Returns true if the room the var is in is flagged with the "indoors" flag, and false
- if not. Keep in mind that as of this moment, this check only works for the room flag
- "indoors." It does not check for the room's sector, so it will still return false even
- if the sector is "inside."
if isfighting(var) == name
- The same code with two different names, these return true if the var is fighting the
- mob or PC with the specified name, and false if not. The != operator can also be used
- with this check. If used without a name and operator, then the check will simply check
- whether or not the var is fighting at all.
- Returns true if the var is tanking something, and false if not. Common sense dictates
- that this should be restricted to situations where the var is fighting.
- Only to be called from a mob, this returns true if the mob is tracking the var, and
- false if not.
- Returns true if the var (which should probably be referencing a mob) is tracking, and
- false if not.
- Returns true if the var is affected by any form of charm, and false if not.
- To be called only from a mob, this returns true if the var is the mob's master, and
- false if not.
- Returns true if both a) var is following a person A, and b) var is in the same room
- as person A.
- Returns true if var and var2 are grouped, false if not.
- Returns true if var is in var2's PK range, and false otherwise.
- Returns true if var can see var2, and false if not.
- This if check returns true if the is a PC and has the trait specified by traitname.
- If lagged returns true if a pc currently has a wait state of greater than zero. In
- general, this is true if the pc is currently bashed, busy casting a spell, or mplagged.
- This if check is used to see if the target has a particular void scholar symbol. Here,
- the argument is the last two digits of the symbol’s vnum.
- This if check returns true if the target variable is speaking the given language. Here
- language is just one of the selected race names, with the exception of the ch’taren,
- who are denoted by "chtaren" (to spare the difficulty of parsing single quotes).
- This if check returns true if the target is ACT_ANIMAL.
- If haspath returns true if the target npc has a recorded path, as generated by the
- mppath command.
if isenemy(<target>) [== faction number]
- Returns true if the target is a friend (for isfriend) or enemy (for isenemy)
- of the given faction. If the faction number is ommited, it uses the faction
- of the mob performing the check.
- Returns true if the target has that many account points.
if isharmonizing(var) == song_skill_vnum
- Returns true if the target is playing (for isplaying) or is harmonizing (for isharmonizing) the given song.
- Note for older area builders: mobs are now able to play songs.
- Working example: [ 7085] Ilasa Eideo
Memory Checks
- This section is fairly self-explanatory. If you've got to check up the slots on anything,
- be it bits, focuses, or mpvalues, this is the if-check section for you.
if isbitset(var) == Bit #
- Returns true if the var's bit # is true, and false if not. Should be confined to PC's.
if mobvcheck(var) == #
- Used in conjunction with mob memory, this check returns true if the value the mob
- associates with the var is equal to the #. Of course, other numeric operators may be
- used. Keep in mind that unlike bits, mob memory is stored on the mob itself, so if it
- dies, all such memory will be cleared.
if value(value slot) == #
if mobvalue(mob slot) == #
if objvalue(obj slot) == #
if roomvalue(room slot) == #
- Returns true if the # is equal to the value held by the slot. Slots number from
- 0 to 9, and can be set with the mpvalue commands. Other numeric operators can be
- substituted. NOTE: the newer "if value" works on rooms, mobs, or objects, and is
- generally preferred over the older checks.
if value(local variable) == string
- Value also works to check local variables. Example:
mpvalueset feeling happy if value(feeling) == happy smile else frown endif
if remembers(var)
- This checks whether or not a player has been stored within a mob's memory, via
- the mpremember command.
if isfocused(var) [== <0|1>]
- Returns true if the var is focused on something, and false if not. In the case of
- objects and rooms, just leave the var field blank.
- The optional numerical argument indicates which slot to check; if left blank, slot 0 is checked
if newbie(var)
- Returns true if the var is flagged newbie and is a PC. Returns false otherwise.
- Var must have answered yes to "Are you new to Avendar?".
Environmental Checks
- This section deals primarily with if checks that describe the area surrounding the
- actor, otherwise known as the environment.
if isanypcarea()
- Returns true if there are any PC's in the area, and false if not.
if isanypchere(var)
- Returns true if there are any PC's in the room that the prog is called from, and
- false if not.
if isanynpchere(var)
- Returns true if there are any NPC's in the room that the prog is called from, and
- false if not.
if isanyobjere(var)
- Returns true if there are any objects in the room that the prog is called from, and
- false if not.
if objhere(vnum of object)
- Checks whether or not the object of the specified vnum is in the same room as the
- calling mob/object.
if mobhere(vnum of mob)
- Returns true if the calling mob/object is in the same room as the specified mob, and
- false if not.
if ishere(var)
- This check returns true if the calling mob/object is in the same room as the var, and
- false if not.
if inroom(var) == vnum of room
- Returns true if the var or calling object is in the room specified by the vnum. Other
- numeric operators can be substituted in. If called from an object, leave the var field
- blank. The if check will return whether or not the calling object is in the specified room.
if inarea(var)
- Returns true if the var is in the same area as the calling mob/object.
if isopen(var) == # or Direction
- Returns true if there are no closed doors to the var's specified direction, and false
- if not.
- NEW AS OF SPRING 2014: Will also return false if there is no exit in the direction.
- If this check is called by an object, then leave the var field blank. Note that
- the way this is phrased means that the path just has to be open, there does not have to
- be an actual door in the way. var can also be an object. List of numbers that correspond
- to directions:
- North 0
- East 1
- South 2
- West 3
- Up 4
- Down 5
if isseason() == # or season
- Returns true if the current season is the same as the one specified. Names will be
- converted automatically into their numeric equivalents, so you can feel free to use an
- operator other than ==. List of numbers that correspond to the seasons:
- spring 0
- summer 1
- autumn 2
- winter 3
- NOTE: # doesn't seem to work, but the season name does. -Dov 8/28/13
if isphase() == # if rhosphase() == #
- isphase for lunus due to poor planning, rhosphase for rhos. Returns true if that moon's
- current phase is equivalent to the specified number. Note that there is no text
- conversion, so you'll have to plot this out yourself. Since it's working with numbers,
- other numerical operators should be accepted without difficulty. List of numbers
- corresponding to the phases of the moon:
- Waning gibbous in the sky 0
- Waning in the sky 1
- Waning crescent in the sky 2
- Currently new 3
- Waxing crescent in the sky 4
- Waxing in the sky 5
- Waxing gibbous in the sky 6
- Currently full 7
if rhossize() == #
- Tiny 0
- Small 1
- Medium 2
- Large 3
- Huge 4
if islight()
- Returns true if the sun is currently up. The actual hours vary from season to season.
if isday() == #
- Returns true if # is equal to the day of the month. Other numeric operators can be
- substituted in.
if isdayofweek() == #
- 0 - Lyrensday
- 1 - Iolenday
- 2 - Thelansday
- 3 - Endenday
- 4 - Nimensday
- 5 - Thethelsday
- 6 - Evenday
if istime() == #
- Returns true if # is equal to the current hour, numbering from 0 to 23. Other numeric
- operators can be substituted in.
if roomflag(var) == <room flag name>
- This if check returns true if the room has the flag specified. Valid room flags include:
- dark, nogate, no_mob, indoors, nosum_to, nosum_from, noneforyou, vault, noyell, private,
- safe, solitary, pet_shop, no_recall, imp_only, gods_only, heroes_only, newbies_only, law,
- nowhere, nomagic, guild, noweather, uberdark, power_nexus, rough, has_water
if sector(var) == <sector name>
- This if check returns true if the target is located in the sector with the specified name.
- Valid sectors include:
- inside, city, field, forest, hills, mountain, swim, noswim, air, desert, underwater,
- underground, road, swamp.
if precip(var) == #
- -1 : Invalid; underground, or in a NOWEATHER room
- 0 : No precipitation
- 1 : Light rain/snow
- 2 : Rain/snow
- 3 : Heavy rain/snow, or the magical affect icestorm
if cloudcover(var) == #
- # = % of the sky that is covered with clouds.
if month() == <month number>
- Checks the month. Hopefully it takes other operators!
- The following if-checks are used to describe items, or their relation to the actor.
if objtargetcarry()
- This check returns true when the object with the verb_prog is both in the character's
- inventory and is also the object (or target) of the command. This is
- helpful (or essential!) in situations with multiple objects having the same verb_progs.
- Example:
- This check returns true for "eat apple" from a verb_prog eat, only if the obj
- with the verb_prog is carried and also has "apple" in its name (ie, is the target).
- This distinguishes the item from other, non-progged apples that might be in the
- inventory, and also from other verb_prog eat-bearing items that are not
- apples (such as pears).
- See obj 22458 for the canonical example.
if objtargetwear()
- As with objtargetcarry(), but the object targetted must be worn/wielded/held and
- not just in the inventory.
if isharvested()
- Much like objtargetwear(), this has no target and is used on an object prog. If the
- object in question is a node, this check will determine if that node has been harvested
- recently by the character who triggered the prog.
if incontainer(vnum)
- Returns true if object is inside the container with prog. If vnum is omitted, returns
- true if container contains anything if vnum is omitted. Obviously, to be used with
- progs on containers.
if isoverlimit(vnum of object)
- Used to check an item's limits for various item loading progs. Returns true if the
- current number of the item is greater than the item limit.
[ 34] Transmitt: Limit bugs on your progs. Fri Nov 11 08:02:42 2005 To: immortal The overlimit bugs on your progs:
If isoverlimit(obj_vnum) returns false if there is no limit on the object or the current number of objects in circulation is less than or equal to the limit of the object. What this means: if the limit of the object is 5, it will return false if there are 5 of the object in circulation. If you're using this to do nothing if it returns true, and otherwise load the object, you will end up with one more item than the limit in circulation.
The solution is to use if isunderlimit(obj_vnum). This returns true if the number of items currently in circulation is less than the limit of the item. Otherwise it return false. So replace your overlimit checks with underlimit checks on mobs like Mindilast and the peddler.
For example: Instead of: if isoverlimit(obj_vnum) else mpoload obj_vnum endif
use: if isunderlimit(obj_vnum) mpoload obj_vnum endif
- tm
if iswielding(var) == vnum of the object
- A bit of a misnomer, this returns true if the var is wearing the specified object,
- and false if not. As such, the vnum does not have to be restricted merely to weapons,
- but can be applied to any item that can be worn.
if allcarrycount(var) == num
- Returns true if the var is carrying the number of objects specified, regardless of
- whether the var can see the objects. Other numeric operators are acceptable. This applies
- to inventory and worn items both.
if carrycount(var) == num
- Returns true if the var is carrying the number of objects specified, not counting
- objects the var cannot see. Other numeric operators are acceptable. This applies
- to inventory and worn items both.
if iscarrying(var) == vnum of the object
if iscarrying(var) == full name of the object
- Returns true if the var is carrying the specified object, and false if not. This
- includes everything in the iswielding check, and further goes through the var's
- inventory. Keep in mind that the full name of the object must be used for the string version,
- which is often hard to come by. See mpresolve for one way to get it.
if isowner(var) if isheld(var)
- Restricted to obj progs, this is predominantly used in verb progs to make sure
- that only the person who actually has the object is activating the verb. These
- checks will return true if the var is the owner of the object, and false if not.
- Keep in mind that they are identical, meaning that isheld is a bit of a misnomer.
if isworn(var)
- Isworn returns true if the calling object is being worn by the specified var,
- and false if not. Isworn should only be called from an object.
if iswearslotfull(var) == #
- Returns true if the wear slot, specified by the #, is full. Here are the slot
- numbers. Slot number is from 1-22.
- 0: Light
- 1: Left finger
- 2: Right finger
- 3: Neck1
- 4: Neck2
- 5: Torso
- 6: Head
- 7: Legs
- 8: Feet
- 9: Hands
- 10: Arms
- 11: Shield
- 12: Body
- 13: Waist
- 14: Wrist
- 15: Wrist
- 16: Wielded
- 17: Held
- 18: Floating
- 19: Dual wielded
- 20: Branded
- 21: Concealed
- 22: Concealed
if objtype() == #
- Returns true if the calling object is of the type specified by the number.
- Objtype numbers:
- Light: 1
- Scroll: 2
- Wand: 3
- Staff: 4
- Weapon: 5
- Treasure: 8
- Armor: 9
- Potion: 10
- Clothing: 11
- Furniture: 12
- Trash: 13
- Container: 15
- Drink Container: 17
- Key: 18
- Food: 19
- Money: 20
- Boat: 22
- NPC Corpse: 23
- PC Corpse: 24
- Fountain: 25
- Pill: 26
- Protect: 27
- Map: 28
- Potal: 29
- Warp Stone: 30
- Room Key: 31
- Gem: 32
- Jewelry: 33
- Jukebox: 34
- Instrument: 35
- Net: 36
- Arrow: 37
- Bow: 38
if objval0() == # if objval1() == # if objval2() == # if objval3() == #
- Returns true if the object's v(0-3) slot is equal to the specified number. Other
- numeric operators can also be used.
if material() == Material type
- Primarily for use in a give_prog, which will automatically reference the given object.
- Returns true if the given object is of the specified material, and false if not.
if perminvis([var])
- If perminvis returns true if the target object is permanently invisible. If used in
- a give_prog, a blank argument can be specified, and it will default to targeting the
- object which triggers the give_prog.
if recentowner([var]) == <name>
- This if check returns true if the name specified was a recent owner of a target. If
- used with a give_prog, no argument is needed, as it will default to targetting the
- triggering object of the prog.
if isunderlimit(<vnum>)
- This ifcheck determines, well, if the eq is under limit. Useful for alternative ways of
- loading limited equipment.
if objfrom(var) == <animal|celestial>
- This if check determines whether the target object is a part from an animal or a
- celestial being. Originally designed for use with demon payments, it may find other
- application. When used in a give_prog, a blank target can be substituted, and it will
- default to using the trigger object for the give_prog.
if fountainhere()
- Checks if there's a fountain here. Please use with with a var, as I think it crashes
- us without one. This does not currently work with objects.
if level41corpsehere()
- This if check returns true if a pc corpse of level 41 or higher is here.
if number([var]) == <vnum>
- This if check returns true if the target is of the given vnum. It can also be used
- without an argument in conjunction with a give_prog, in which case it will default
- to targetting on the give_prog’s trigger.
- NOTE from Dov Jan 2014: this could be clearer -- the check works for mobs too, it seems (such as a mob who activates
- its own verb_prog -- see Tyvor's verb_prog)
If weight() == <value>
- For mobs/characters, returns the weight of their carried gear. For objects, returns the object's weight. Keep in mind that weights are reported in 10ths of units.
- Presumably this works with <, >, <=, and >=. Found this in an old note from Aeolis with only the above line for documentation, so user beware!
Miscellaneous
if rand(#)
- Generates a random number between 1 and 100, returning true if it is less than the #,
- and false if it is not.
if port() == #
- Tests the current port the MUD is running on; mostly used to distinguish production
- from development in progs. Can use other operators as well (<, <=, >, >=, !=).
String checking
if compstr(#) == arg
- This takes in the character's input, and checks to see if the #th word is equivalent
- to the arg. Used primarily for verb_progs, it's advised that the operator be
- restricted to == and !=.
if compx() == arg
- This checks to see if the arg is anywhere within the string. Again, restrict yourself
- to == and !=.
if regex() == <regular expression>
- Returns true if the text ($x) variable is matched by the regular expression. Those of
- you who don't know what a 'regular expression' is probably won't find too much use for
- it, but it should be very useful for those who do.
Junk
if demonstate() == #
- Ashurian madness. Used for greater demon crap, somehow. Don't ask me.
if hasrelief(var)
- An antiquated check for the Raider vault items. It checks to see if the var is holding
- on to the four items. There's pretty much no reason to learn this check.
if isweather() == #
- Currently broken. Will automatically return false until further notice.
if isexists()
- Broken, do not use.