Category: OLC Topic: add_mob_script (Can now be used on rooms and objects too!!) This function, though a bit unwieldy, allows you to add or modify a script for some room, object or mob. If the entity already has a script triggered by what you specify here, then it will be over-written. After entering this command, you will be prompted to input the script. In your script, there are certain variables you can put in: %% Percent Sign %M Actor's Name %m Target's Name, if it's a MOB %o Target's Name, if target is an Object %S The Entity 'executing' the script. An example script for a mob might be: (Suppose the trigger is when the actor types wear dagger, and the dagger's Vnum is the same as the target number for the script.) say %M, that's a sharp %o you have there, better be careful!;; pause 1;; emote glances again at the dagger and starts hammering on his latest sword.;; NOTE: Enter all this at once, on one line. usage: add_mob_script [mob_num] [trigger_cmd] [actor_num] ['discriminator_string'] [target_num] [takes_precedence] usage: add_room_script [rm_num] [trigger_cmd] [actor_num] ['discriminator_string'] [target_num] [takes_precedence] usage: add_obj_script [obj_num] [trigger_cmd] [actor_num] ['discriminator_string'] [target_num] [takes_precedence] NOTE: If 'discriminator_string' is a number, prepend DESCRIM_ to it or it will not work, for example: DESCRIM_55 Arguments: mob_num/rm_num is the number of the entity which should get this script trigger_cmd: Should be one of the commands we support: close, donate, drop, eat, enter, examine, exit, fill, follow, get, give, group, hit, list, lock, "look, meditate, open, order, pay, prone, remove, rest, say, shoot, sit, slap, sleep, stand, tell, throw, ungroup, unlock, wake, wear, yell actor_num: The mob which can trigger this script, if -1 then it can be anyone discriminator_string: An optional trigger condition, designed for communications, but has extensions that now work for other commands. For the communications (say, yell, tell), it will match any string which contains it, and it is NOT case sensitive. NOTE: If a few cases, where there is a target involved, and also another object, like: give [obj] [critter], the discriminator_string will be the number of the OBJECT involved. NOTE: Use 'NA' (no quotes) if you don't want or need a descriminator. On non-communication triggers, the following discriminators can be used: FEM, MALE, NEUTER, BARD, CLERIC, WARRIOR, SAGE WIZARD, THIEF, ALCHEMIST, HUMAN, ANITRE, DARKLING, DRAGON, DWARF, OGRUE, ELF, UNDEAD, ANIMAL, MONSTER When added, these have the meaning of 'only'. So, if you make FEM your desriminator, then the script will only be triggered on FEMALES. You can add several by doing something like: FEM.THIEF.ELF, which will mean that this script will only work on a female, elven thief. SPECIAL DISCRIMINATORS FOR CERTAIN TRIGGERS: -------------------------------------------- enter: The discriminator is the direction entered from: above, below, north, northwest, northeast, east, southeast, south, southwest, west put: The discriminator is the object number of the bag. Enter -1 if it can be any container. target_num: This can be a MOB or OBJECT number, which ever makes sense to the trigger command. takes_precedence: If this action should pre-empt already-running scripts, enter anything but zero (0), if NOT, then enter a zero (0). ----------------------------------------------------------------------- Special Scripting Commands: pause, exact_damage, oload, mload, affect_hp, affect_mana, affect_mov, is_greater_than, is_less_than, is_equal_to, is_in_posn ----------------------------------------------------------------------- NOTE: the use of the 'pause' command can be very useful, as it helps to space out the mobs actions. The pauses are the length of a round of battle, about 2-3 seconds each. NOTE 2: You must do an amsave/asave/aosave in the zone that the entity belongs to in order to have your changes made permanent through a reboot. mstat/rstat/ostat will give you the zone that the entity belongs to. ------------------------------------------------------------------------ Caveats: Only one command per line. Comments not implemented at this time. Your 'if' construct must have an else statement, even if it is empty. Note that each command must end with double semi-colons. Comforts: You should be unable to seriously harm the game, no matter what awful script you write! Bad loops could waste resources though. Expanded Scripting Capability: ============================== NOTE: square brackes should not be used in the actual script, they are just used to delineate commands in the examples below. Defining what Entity is to take the script action: -------------------------------------------------- Currently all commands are from the perspective of the mob/room/obj that 'owns' the script. Now you may specify the commands to be 'executed' by other actors. For instance, suppose you wanted to check if the actor had a specific piece of eq in his/her inventory? The answer to this problem is found below. To specify that the action should be taken by someone else, use this syntax: Action to be taken by the actor: **%M [normal script command] Action to be taken by the target. **%m [normal script command] Action to be taken by script owner (this is the default). **%S [normal script command] Action to be taken by target, if target is an object. **%o [normal script command] For instance, in this example we query whether or not the actor has object #44 in his/her possession. **%M if does_own 44 =============================== High Level Constructs: ---------------------- if [conditional command and arguments] [do this block of stuff] else [do this block of stuff] end =============================== Low Level Constructs: ------------------------------- script_goto_true [label] [conditional command and args] script_goto_false [label] [conditional command and args] script_jump_true [line number] [conditional command and args] script_jump_false [line number] [conditional command and args] label: [your_label] =============================== Conditional Commands: (See 'help does_own' for more information.) ------------------------------- TRUE, FALSE, is_equal_to, is_less_than, is_greater_than, is_in_posn, does_own Special Scripting Commands: -------------------------------- recho: Room wide echo. silent_junk: Junk object without any external messages. oload: Load an object from nowhere. =============================== Example Mob Script: ------------------------------- Trigger: give Actor Mob: -1 Target Mob: 76 Precedence: 1 Discriminator: 334 . start of script text: --------------------- say Ahhh, you must know of Korg!!!;; if does_own 334 335;; say I own both hearts;; else;; say I don't own both hearts;; end;; say Hrm....;; say End of script..;; ============================== Room Scripting Commands: ------------------------------ recho: Echo a message to the room. tell: The room tells a player a message. zecho: Cause a message to be echoed across the entire zone. wizchat: Cause a message to be sent to the wizchat channel. rm_move_all: Force all players to exit in a certain direction. rm_move: Force one player to exit in a certain direction. rm_transport_all: Move all mobs to another room. rm_transport: Move one mob to another room. neighbor_echo: Echo a message to a neighboring room (like after a move). other_room_echo: Echo a message to a different room, by VNUM. rm_omove_all: Force all objects to exit in a certain direction. rm_omove: Force one object to exit in a certain direction. rm_otransport: Force an object to go to another room. rm_otransport_all: Force all objecs to go to another room. oload: mload: ============================== Object Scripting Commands: ------------------------------ recho: Echo a message to the room. tell: The room tells a player a message. zecho: Cause a message to be echoed across the entire zone. wizchat: Cause a message to be sent to the wizchat channel. obj_move_all: Force all players to exit in a certain direction. obj_move: Force one player to exit in a certain direction. neighbor_echo: Echo a message to a neighboring room (like after a move). obj_omove_all: Force all objects to exit in a certain direction. obj_omove: Force one object to exit in a certain direction. pull: Triggered by: pull [descriminator], see help for pull. push: Triggered by: push [descriminator], see help for push. See Also: olc amsave mstat rm_script list_scripts stat_script affect_hp See Also: affect_mana affect_mov comparators rm_comm