**************** $Mob Fields **************** #ACTOR refers to the person (could be a PC or NPC) who has triggered this code. SELF refers to the mobile who is performing the response. Thus, if you have a trigger on a mobile to greet anyone who walks into the room, ACTOR is the person walking into the room, and SELF is the mobile doing the greeting. We'll use ACTOR as an example, since that is what you will be using the majority of the time. The fields you can put after ACTOR are as follows: trighelp actor fields * #actor.name %actor.name% Example: point %actor.name% Refers to the actor's name. If this is a PC, it will be their regular regular name. If it is an NPC, it will be the list of names that they can be referred to. For example, an ogre guard might have the list of names 'guard hulking large ogre'. Obviously, if someone is speaking their name, you don't want them to say this. You will want them to say their "short description name", which is 'an ogre guard'. Only use %actor.name% if it's something like LOOK %actor.name% or GIVE %actor.name% SWORD. You couldn't use the short description with these, because the game would try to give "an" a sword, which doesn't exist. * #actor.following %actor.following% Example: if %actor.following% == %self% Returns the person that the actor is following. * #actor.group %actor.group% Returns 1 if the actor is part of any group, and 0 if not. It doesn't matter if any of them are grouped with the GROUP command, only that they are all following a common leader. * #actor.leader %actor.leader% Returns the leader of the group that the actor is in. If the actor is the leader of the group, it will return the actor. If they are different people, and if the master is in a different room than the actor, nothing will be returned. * #actor.zone %actor.zone% Example: if %actor.zone% == 40 Returns the zone number that the mob is from, which is the mob's vnum / 100. * #actor.shortdesc %actor.shortdesc% Example: say Why, hello there, %actor.shortdesc%! Refers to the short description of the NPC name. A cardinal might have the short description "a happy cardinal". Use this only when the mobile is speaking this name. If it is a PC, it will simply be the PC's name. * #actor.affected %actor.affected(spell name)% Example: if %actor.affected(greater sanctuary)% This will return TRUE if the actor is affected by the spell, and FALSE if not. * #actor.skill %actor.skill(skill_name)% Example: if %actor.skill(greater sanctuary)% > 80 This will return the percent the actor knows the skill to. * #actor.pc %actor.pc% Statement returns TRUE if the actor is a PC. * #actor.npc %actor.npc% Statement returns TRUE if the actor is an NPC. * #actor.id %actor.id% Example: if %actor.id% == %self.id% This returns the actor's ID number, which is unique for all NPCs and PCs in the game. Use this to find out if the actor is another character, for instance. * #actor.level | #actor.tlevel %actor.level% %actor.tlevel% Returns the actor's level and total levels, respectively. If a person is level 100, remorts, and then levels up 30 more levels, his level is 30, and total levels is 130. * #actor.hit | #actor.maxhit | #actor.mana | #actor.maxmana | #actor.move | #actor.maxmove %actor.hit% %actor.maxhit% %actor.mana% %actor.maxmana% %actor.move% %actor.maxmove% Returns the actor's HP, maximum HP, mana, maximum mana, movement, and maximum movement points, respectively. * #actor.align | #actor.gold | #actor.sex | #actor.height | #actor.weight %actor.align% %actor.gold% %actor.sex% %actor.height% %actor.weight% Returns the actor's alignment, gold, sex (female, male or neutral), height in inches, and weight in pounds, respectively. * #actor.room %actor.room% Returns the actor's room vnum. * #actor.cansee | #actor.canbeseen %actor.cansee% %actor.canbeseen% Examples: if %actor.cansee% say %actor.Name% can see me! if %actor.canbeseen% say I can see %actor.name% if !%self.cansee% say Help! I am blinded! The first returns TRUE if the actor can see the mob or obj that is executing the trigger. If a room is executing the trigger, it will return TRUE if the actor can see anything at all, meaning he is not blinded or has a light in a dark room. The second returns TRUE if the actor can be seen by the mob that the trigger is on. This obviously doesn't work on room/obj triggers. In the first variation, if actor is self, it will return TRUE if the mob can see anything in the room, meaning it is not blinded or has a light in a dark room. * #actor.race | #actor.class %actor.class% %actor.race% Returns the actor's class name (mage, cleric, thief...), or race name (elf, human, vampire...). * #actor.fighting %actor.fighting% Returns the character that the actor is fighting. * #actor.vnum %actor.vnum% Returns the actor's vnum. If it is a PC or a MOB without a Vnum (such as a customized mob created on the fly by the game), the vnum will be -1. * #actor.position %actor.position% Example: if %actor.position% == mortally wounded if %actor.position% == incap Returns the actor's position. This will be either be: dead, mortally wounded, incapacitated, stunned, sleeping, resting, sitting, fighting, standing, or floating. You may also use abbreviations of any of these positions. * #actor.str | #actor.stradd | #actor.int | #actor.wis | #actor.dex | #actor.con | #actor.cha %actor.str% %actor.stradd% %actor.int% %actor.wis% %actor.dex% %actor.con% %actor.cha% Returns the character's affected strength, strength add, intelligence, wisdom, dexterity, constitution, or charisma. Affected means the value from any equipment or spells they might have. * #actor.eq | #actor.inv | #actor.has %actor.eq% %actor.inv% %actor.has% Example: if %actor.eq(26)% if %actor.inv(12)% if %actor.has(217)% set obj %actor.inv% set obj %actor.eq(light)% set obj %actor.eq(26 id)% set obj %actor.inv(12 id)% set obj %actor.has(217 id)% The first returns 1 if the actor is wearing an object with that Vnum. The second returns 1 if the actor has an object with that Vnum in his or her inventory. The third returns 1 if the actor is either wearing or has in their inventory the object with that Vnum. The fourth returns the pointer to the first object in the actor's inventory list. The fifth will return the pointer to the item the actor is using as a light or 0 if none. The sixth will return the pointer to the item 26 if the actor is equiped with the item. The seventh will return the pointer to the item 12 if the actor has the item in thier inventory. The eighth will return the pointer to the item 217 if the actor has the item in thier inventory or is worn. * #actor.hmhr | #actor.hshr | #actor.hesh %actor.hmhr% %actor.hshr% %actor.hesh% Returns the pronoun connected with the sex of the actor. hmhr returns him or her, depending on if the actor is a male or female. hshr returns his or her, and hesh returns he or she. * #actor.plrflagged %actor.plrflagged% Example: if %actor.plrflagged(frozen)% say You are frozen. elseif !%actor.plrflagged(guild_m)% say You are not the Guild Master. endif Returns whether or not the actor has the plr flag set in the subfield variable. The list of available flags are: frozen = Character is frozen mute = Character is muted (cannot ooc, yell, gossip...) rpotw = Character is Role Player of the Week no_res = Character cannot be ress'ed forsake = Character is Forsaken wanted = Character is #1 on the wanted poster guild_m = Characer is guild master of their guild * #actor.next_in_room %actor.next_in_room% Example (whole code): set roomvar %actor.room% set targetchar %roomvar.people% while %targetchar% set nextchar %targetchar.next_in_room% if %targetchar.id% != %self.id% talk targetchar You are in this room! endif set targetchar %nextchar% done This is used to refer to the next person standing in the room. The only time when you would want to refer to this is in some kind of loop. One good application of this is an area spell that you can customize yourself. As you can see, the code for this looks complex, but really, this is a generic template which can be used for almost any kind of situation like that. Simply substituate the 'talk' statement with code that you want to execute. **************** $Obj Fields **************** #OBJECT or SELF refers to the object who is performing the response to the trigger. see also trighelp object fields * #object.name %object.name% Example: drop %object.name% Refers to the object's list of names. For instance, a large wooden shield might have 'shield wooden large' as its list of names. Use this when you want to do something directly with the object, such as drop or wear it. * #object.room %object.room% Returns the room the object is in. If the object is being carried or room, or inside another object which is sitting in a room, it will return the room of the person who is carrying or wearing it, or the room of the container it is in. * #object.shortdesc %object.shortdesc% Example: say You are wearing %object.shortdesc%! Refers to the object's short description, which is what you see when you type inventory. The same large wooden shield might have 'a large wooden shield' as its short description. Use this only when it is being spoken aloud. * #object.id %object.id% Example: if %object.id% == %self.id% Returns the object's id number, which is unique for every object in the game. This is useful for finding out if the object in question in another object, for instance. * #object.vnum %object.vnum% Returns the object's vnum. * #object.type %object.type% Returns the object's type. This is either: light, scroll, wand, staff, weapon, treasure, armor, potion, other, trash, container, note, drinkcon, key, food, money, pen, boat, fountain, clothing, corpse, bow, arrow, or quiver. * #object.val0 | #object.val1 | #object.val2 | #object.val3 %object.val0% %object.val1% %object.val2% %object.val3% Examples: say This weapon does damage of %object.val1% to %object.val2%! say The container is trapped with a level %object.val3% trap. This is the value of one of the 4 values in an object. This differs depending on what type of object it is. The best way to find out what each does is to OEDIT the object, and then go through the values listed. * #object.carried_by | #object.worn_by %object.carried_by% %object.worn_by% Example: set wearer %object.worn_by% say The one who wears the object is %wearer.name%! Returns the character that is either carrying the object, or wearing the object, respectively. If no one is carrying or wearing the object, it will return -1. * #object.next %object.next% This will return the next item in the object list. If the object were in a room it will return the next object in the room. Same for objects in a characters inventory or objects inside other objects. Example of a loop: set obj %actor.inv% while %obj% if %obj.type% == weapon yell Hurry, Guards %actor.shortdesc% has a weapon. Attack! End set obj %obj.next% done **************** $Room Fields **************** #SELF refers to the room who is performing the response to the trigger. To refer to another room, you would first set a temporary variable to that room, and then use that variable along with the fields below. For instance, if a mob had to access the name of the room that an actor is in, you would type this code: set temproom %actor.room% say The actor is in the room called %temproom.name%! For simplicity, we'll use the SELF variable for the examples: see also trighelp room fields * #room.name %self.name% Returns the room's name. * #room.north | #room.south | #room.east | #room.west | #room.up | #room.down %self.north(state)% %self.south(state)% %self.east(state)% %self.west(state)% %self.up(state)% %self.down(state)% Examples: if %self.north(closed)% This refers to the state of each of the 6 directions in a room. Valid states are: door (whether or not the direction has a door), closed, locked, open, unlocked This simply returns true or false if the door is set to the state given. To actually change these values, for instance to close a door, use the WDOOR command. * #room.vnum %self.vnum% Returns the room's vnum. * #room.people %self.people% Returns the first character in the room. Probably the only time you would want to do this is to iterate through a loop of everyone in the room. Read the help for %actor.next_in_room% in the Mob trigger fields for more information on this. * #room.chars | #room.npcs | #room.pcs %self.chars% %self.npcs% %self.pcs% Returns the number of chars, npcs, or pcs in the room. * #room.contents %self.contents% Returns the first object in the room. Probably the only time you would want to do this is to iterate through a loop of every item in the room. Read the help for %object.next% in the Obj trigger fields for more information on this. ******************** $Miscellaneous Fields ******************** #Miscellaneous These are fields that do not have to be "attached" to a mob, obj, or room. In other words, whereas to refer to a mob's vnum, one must put %actor.vnum%, these fields will take the place of the word 'actor'. They are listed below: see also trighelp Miscellaneous fields ************* * #people.vnum | #npcs.vnum | #pcs.vnum %people.vnum% %npcs.vnum% %pcs.vnum% ************* Example: say There are %people.112% characters in room 112. say There are %npcs.4812% mobiles in room 4812. say There are %pcs.1% player characters in room 1. 'vnum' is a room vnum, and each return the number of NPCs/PCs, NPCs, or PCs in the room. Anyone who is WizInvis at any level is not counted. *********** * #time %time.hour% %time.day% %time.month% %time.year% *********** Returns the hour, day number, month number, or year, respectively. ************* #random %random.char% %random.room% %random.room()% %random.5% %random.7 13% ************* The first returns a random character in the room. The second returns a random room in a zone. If no subfield is specified, it will be a room from the zone where the trigger is taking place. Otherwise, with a specified zone vnum, it will be a room from that zone. The third chooses a random number from 1 to 5, including 1 and 5. The fourth chooses a random number from 7 to 13, including 7 and 13. Obviously, these are all just examples, you may put any numbers you wish instead. ************************************************ * #locate %locate.char( [room vnum])% %locate.obj( [room vnum])% %locate.room()% ************************************************ Examples: if %locate.char(Mocirne 1700)% set char %locate.char(1711)% set obj %locate.obj(112 12)% if %locate.obj(14)% set room %locate.room(610)% This useful command returns a character, object, or room for use in a trigger. It will return the ID number of the character/obj/room, so you can use it to either find out if it exists: if %locate.obj(114)% say Object with vnum 114 is located in this room! end Or, you can set a variable to it to be used later: set room %locate.room(16)% mgoto %room% say I'm in room 16 now! For the character and object searches, if the subfield (the part in parentheses), has an optional room vnum separated by a space, it will search only in that specific room. If this is omitted, it will look only in the room the trigger is executing in, and if there is a '*', it will look throughout the entire world: if %locate.obj(16 2706)% say There is an object with vnum 16 in room 2706! elseif %locate.char(Melvin 114)% say Melvin is in room 114. elseif %locate.obj(8401 *)% say The object with vnum 8401 is somewhere in the world. end ****************************** * #trigger trigger %variable% This command forces an obj/room/mob to execute a trigger without an event actually triggering it. It is useful in situations where you can't do anything using normal game commands to trigger something. One example is yelling to trigger a room to do something. Rooms don't listen to yells, and thus it would be impossible to cause it to trigger on this. The TRIGGER command helps with this. First, create a trigger with type Auto Trigger on the obj/room/mob. Put whatever you want it do when triggered in the script. Next, edit the trigger of the "source". In the example in the preceding paragraph, source is the person yelling, and the room is what has the Auto Trigger on it. On the "source", add this line: trigger %variable% where %variable% could be %actor%, %obj%, %self%, or anything returned from the %locate% field above. The trig vnum is the Auto Trigger vnum to execute. Example: Room with Vnum 149 has the following Auto Trigger (trigger vnum 1701): > wecho Testing. Edit a mob trigger, put this into the script: yell Room #149, execute your trigger! trigger %locate.room(149)% 1701 ************************************************ * #string %string.abbrev( )% %string.arg1()% %string.arg2()% ************************************************ Examples: set arg lev %string.abbrev(%arg% lever)% %string.arg1(dagger bag)% %string.arg2(dagger bag)% Useful string commands the first returns true if string1 "lev" is an abbreviation of string2 "lever" in this case it would return true. The second will return the first arg from the list "dagger" and the third would return everything after the first arg "bag". so if you would need to get 3 arguments from this you could do something like this: set arg1 %string.arg1(dagger bag left)% set two_and_three %string.arg2(dagger bag left)% set arg2 %string.arg1(%two_and_three%)% set arg3 %string.arg2(%two_and_three%)% so now arg1 returns "dagger" arg2 returns "bag" and arg3 returns "left" *