Prog Section 7

From Immwiki
Jump to: navigation, search
= 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 


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.
 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 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_HARM                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).


Affects/Status Checks:
 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 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 isfight(var) == name
 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.
 if tanking(var)
 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.
 if istracking(var)
 Only to be called from a mob, this returns true if the mob is tracking the var, and 
 false if not.
 if istrack(var)
 Returns true if the var (which should probably be referencing a mob) is tracking, and
 false if not.
 if ischarmed(var)
 Returns true if the var is affected by any form of charm, and false if not. 
 if ismaster(var)
 To be called only from a mob, this returns true if the var is the mob's master, and 
 false if not.
 if isfollow(var)
 Returns true if both a) var is following a person A, and b) var is in the same room
 as person A.
 if isgroup(var) & var2
 Returns true if var and var2 are grouped, false if not.
 if isrange(var) == var2
 Returns true if var is in var2's PK range, and false otherwise.
 if cansee(var) == var2
 Returns true if var can see var2, and false if not.
 if lagged(var)
 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.
 if hassymbol(var) == #
 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.
 if language(var) == <language>
 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).
 if isanimal(var)
 This if check returns true if the target is ACT_ANIMAL.
 if haspath(npc)
 If haspath returns true if the target npc has a recorded path, as generated by the
 mppath command.
 if isfriend(<target>) [== faction number]
 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.
 if acctpoints(var) == #
 Returns true if the target has that many account points.
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 that "if value" (a new and improved command) works on a rooms,
 mobs, or objects.


 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)
 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. 


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. 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 
 if isphase() == #
 Unfortunately, this will only check for the phases of Lunus. Returns true if Lunus'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 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. 


Item related:
The following if-checks are used to describe items, or their relation to the actor. 
 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 iscarrying(var) == vnum 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.
 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
   Drin 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() == #
 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.


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.
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() == #</b>
Ashurian madness. Used for greater demon crap, somehow. Don't ask me.
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.
if isweather() == #</b>
Currently broken. Will automatically return false until further notice. 
if isexists()
Broken, do not use.

Prog Section 6 | Builder Appendix 1 | Leviticus -- Builder Resources Page