As the subject indicated, patch level 5 of DG Scripts is now available. I've uploaded to ftp.circlemud.org the files dg_pl4_to_5_no_olc.patch.gz and dg_pl4_to_5_with_oasis.patch.gz, these are incremental patches only. If you do not yet have DG Scripts installed, you'll need to download the full patch level 4 plus this increment for now. Lots of new additions have been added to this patch level. An excerpt from the readme follows. Attached to this is a file called 0.trg, for those without any existing trigger files. ----------------------------------------------------------------------- New in patch level 5: Version Command Scripts may execute the "version" command to place DG Script version information into the mud log. Global Variable Contexts One new addition in this release is the ability to assign a 'context' to globals in a script. Up until now, all script globals were truely that: global to the script. Globals which act in that same manner now have a context id of -1. Through the "context <number>" command, a script may set its context to any long value. When refering to a global, if that global is found but has a different context then the current script context, and neither context is -1, the search continues. One possibility for this is to create an array of globals, though each has the same name and the context is used as the index. A bit messy perhaps, but it should work. Another use is to have a target owner of each instance of a global, such as the id number of a mob or object. This lets you have state-based scripts that store a unique state for each target. (Note that the .id field has been added with this release also.) Finally: this context idea has not had very much testing and is probably wrought with bugs. If you find any, please let me know! Remote Variable Assignment The "remote <variable name> <id>" command allows a script to set a global which will belong to another script. To operate, the variable must exist locally, either as a global or local variable, and the target id will get a copy of it. (Any subsequent changes will not be seen by the target without another remote call.) To get the id of a target, you may use the .id field of room, mob, or object variables. Context of the variable will follow over. Actor-type Variable Setting If a script has the id of some character, a value UID variable may be created with the "makeuid <variablename> <id>" command. Id numbers for mobs and objects begin at 200000 (100000 for older versions of DG Scripts) by default. Room id numbers begin at 50000 by default, and PC id numbers are their normal id as if DG Scripts were not present. Object Transformations Through the command "otransform <vnum>", an object in a script may become another object. Imagine, for example, as an object, an "ugly sword" which, as a wear (wield) trigger, transforms into a decent weapon, and in a remove trigger (new in this patch) reverts back to the ugly sword. Note that the object we transform into will NOT have the normal script associated with it's VNUM; instead it will inherit the script from the object doing the transformation. Mob Transformations By the same token, mob's can execute "mtransform <vnum>" to become another mob. Transformed mobs will keep the same HP and HP max as the originating mob, as well as the same gold, position, and experience value. As with objects, the mob will live at the same address in memory as the originating mob, thus no code should break due to the morphing. Object Remove Trigger This should be self-explanatory. Remove the object, fire the trigger (assuming the percentage change in the NArg is met). Mob Memory Mobs now have memory lists allowing them to remember an unlimited number of characters. Associated with each character in memory is an action to perform upon seeing the character. Each time a character enters the room of a mob with memory, or each time the mob enters another room, a check of the memory list is performed. To remember a character, the mob must preform the "mremember <victim> [<special action>]" command. If no special action is specified, the memory trigger commands will be performed. Otherwise the special action will be performed. An example; imagine a mob that acts as a courier of objects: mremember sammy give sword sammy The "mforget <victim>" command will delete all memory of the victim from the mob's list. Mob Hunting "mhunt <victim>" allows the hunt to begin. Player Skill Checking For an actor-type variable, you may determine the percentage of learnedness as follows: %actor.skill(name of skill)% If you can think of other good uses for the %var.function(parameter)% syntax, I'm interested in hearing them. Actor Global Referencing Assume a mob is referenced as a variable %mob% for script A Assume that a global %global% is within the script for that mob (script B) Within script A, %mob.global% allows you to refer to the "global" global from script B. Text Handling Variables that are text (%speech%, in a speech trigger, for example) how have some functions: %text.strlen% lets you count the characters %text.trim% cuts whitespace from each end %text.car% returns the first word (Lisp/Scheme, anyone?) %text.cdr% returns all except the first word Triggers that use a string argument may now use * as the first character to indicate they will accept a match on ANY input. Also, the "extract <to-variable> <word-num> <text>" command allows you to extract a specific word from the text, into a variable. ----------------------------------------------------------------------- --8<-- #1 memory test trigger~ 0 o 100 ~ say I remember you, %actor.name%! ~ #2 mob greet test~ 0 g 100 ~ say Hello, %actor.name%, how are things to the %direction%? ~ #3 obj get test~ 1 g 100 ~ oecho You hear, 'Please put me down, %actor.name%' ~ #4 room test~ 2 g 100 ~ wait 50 wsend %actor% you enter a room ~ #5 car/cdr test~ 0 d 100 test~ say speech: %speech% say car: %speech.car% say cdr: %speech.cdr% ~ $~ +------------------------------------------------------------+ | Ensure that you have read the CircleMUD Mailing List FAQ: | | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html | +------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 12/15/00 PST